conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "system",
"value": "Add docstrings to mocked time methods\n"
},
{
"from": "human",
"value": "from time import time\n\n\nclass MockTime:\n time_passed = 0.0\n\n def time(self):\n return time() + self.time_passed\n\n def sleep(self, seconds):\n self.time_passed += ... | python | chosen |
[
{
"from": "system",
"value": "[NCL-3741] Remove user token from logs\n"
},
{
"from": "human",
"value": "import asyncio\nimport logging\n\nfrom jose import jwt, JWTError\n\nfrom repour.config import config\n\nlogger = logging.getLogger(__name__)\n\n\n@asyncio.coroutine\ndef verify_token(token):\n... | python | chosen |
[
{
"from": "system",
"value": "Print parsed args, useful for demo.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\"\"\"\nUsage:\n tig init\n tig commit <msg>\n tig checkout <start-point> [-b <branch-name>]\n tig diff\n tig log\n tig branch\n tig merge <branch>\n\nOptions:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add decorator for loading instance of a model in a view.\n"
},
{
"from": "human",
"value": "from django.utils.decorators import available_attrs\nfrom django.utils.http import urlquote\nfrom django.http import HttpResponse\nfrom django.template import loader, Request... | python | chosen |
[
{
"from": "system",
"value": "Add integration test for isACaptureP()\n"
},
{
"from": "human",
"value": "\"\"\" Integration tests for the rules module \"\"\"\n\nimport unittest\n\n# pylint: disable=import-error\nfrom res import types\nfrom src import coordinate\nfrom src import gamenode\nfrom src... | python | chosen |
[
{
"from": "system",
"value": "Make form update existing instance if uid matches\n"
},
{
"from": "human",
"value": "from django import forms\n\nfrom django_vend.core.forms import VendDateTimeField\nfrom .models import VendOutlet\n\n\nclass VendOutletForm(forms.ModelForm):\n\n deleted_at = Vend... | python | chosen |
[
{
"from": "system",
"value": "Add more fields to the release display\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import Game, Framework, Release, Asset\n\n\nclass GameAdmin(admin.ModelAdmin):\n list_display = ['name', 'uuid', 'owner', 'framework', 'publ... | python | chosen |
[
{
"from": "system",
"value": "Fix global search placeholder text\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django import forms\n\nfrom utilities.forms import BootstrapMixin\n\n\nOBJ_TYPE_CHOICES = (\n ('', 'All Objects'),\n ('Circuits', (\n (... | python | chosen |
[
{
"from": "system",
"value": "Add move operation to user item\n"
},
{
"from": "human",
"value": "from __future__ import (absolute_import, division, print_function, unicode_literals)\nfrom builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, ... | python | chosen |
[
{
"from": "system",
"value": "Move default value assignments before kwargs\n"
},
{
"from": "human",
"value": "from larvae.base import LarvaeBase\n\n\nclass Person(LarvaeBase):\n \"\"\"\n Details for a Person in Popolo format.\n \"\"\"\n\n _schema_name = \"person\"\n\n __slots__ = ... | python | chosen |
[
{
"from": "system",
"value": "Print debug-friendly repr of APIAccessCredential\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\n\nimport uuid\nimport base64\nimport os\n\nf... | python | chosen |
[
{
"from": "system",
"value": "Remove use of yield_per which clashes with 'joined' load. "
},
{
"from": "human",
"value": "import logging \n\nfrom pprint import pprint\nimport elasticsearch\n\nfrom grano.core import es, es_index\nfrom grano.model import Entity\nfrom grano.logic import entities\n\... | python | chosen |
[
{
"from": "system",
"value": "Add test specific url configuration\n"
},
{
"from": "human",
"value": "# Django imports\nfrom django.test import TestCase\n\n\nclass OWebViewTests(TestCase):\n \"\"\"Provides view related tests\"\"\"\n fixtures = ['oweb_testdata_01.json']\n"
},
{
"from... | python | chosen |
[
{
"from": "system",
"value": "Add particle filter overview information.\n"
},
{
"from": "human",
"value": "\"\"\"Particle filters.\"\"\"\n\nfrom hoomd.filter.filter_ import ParticleFilter # noqa\nfrom hoomd.filter.all_ import All # noqa\nfrom hoomd.filter.set_ import Intersection, SetDifferenc... | python | chosen |
[
{
"from": "system",
"value": "Add device_key on every call in GPIO client\n"
},
{
"from": "human",
"value": "from rpc import RPCClient\n\n\nclass GPIOClient(RPCClient):\n\n def __init__(self, rabbit_url, device_key):\n super(GPIOClient, self).__init__(\n rabbit_url=rabbit_ur... | python | chosen |
[
{
"from": "system",
"value": "Check the number of items a little bit later\n\nDue to MB-22749\n\nChange-Id: Icffe46201223efa5645644ca40b99dffe4f0fb31\nReviewed-on: http://review.couchbase.org/76413\nTested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>\nReviewed-by: Pavel Paulau <dd8... | python | chosen |
[
{
"from": "system",
"value": "Add filter to show button only if selected role tutor\n"
},
{
"from": "human",
"value": "from django import template\nfrom datetime import datetime\nfrom wye.base.constants import WorkshopStatus\nregister = template.Library()\n\n\ndef show_draft_button(workshop, use... | python | chosen |
[
{
"from": "system",
"value": "Make the console app work with the new user model.\n"
},
{
"from": "human",
"value": "from django.shortcuts import render_to_response\n\nfrom account.auth import *\n\n\n'''\n@author: Anant Bhardwaj\n@date: Mar 21, 2013\n\nDatahub Console\n'''\n\n@dh_login_required\n... | python | chosen |
[
{
"from": "system",
"value": "Fix pep8 missing newline at end of file\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015-2017:\n# Matthieu Estrada, ttamalfor@gmail.com\n#\n# This file is part of (AlignakApp).\n#\n# (AlignakApp) is free sof... | python | chosen |
[
{
"from": "system",
"value": "Read commandline args as isbns\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport yaml\nfrom amazon.api import AmazonAPI\n\nclass Books:\n def __init__(self, config_file):\n self.config = yaml.load(open(config_file, 'r'))\n self.amazon = Amazo... | python | chosen |
[
{
"from": "system",
"value": "Add vmin, vmax and possible labels to display of images\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nimport numpy as np\nfrom matplotlib import pyplot as plt\nimport meta\nfrom meta impor... | python | chosen |
[
{
"from": "system",
"value": "Add message before running ansible.\n"
},
{
"from": "human",
"value": "from app.system.updater import check_updates, do_upgrade, run_ansible\nfrom app.views import SimpleBackgroundView\nfrom .base import BaseService, BlockingServiceStart\n\n\nclass UpdaterService(Ba... | python | chosen |
[
{
"from": "system",
"value": "Add support for reading snapshots for auditor reader\n"
},
{
"from": "human",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\nscope = \"System Implied\"\ndescription = \"\"\"\n A user wit... | python | chosen |
[
{
"from": "system",
"value": "Fix some confusion of creating folders\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport shutil\nimport subprocess\nimport string\nimport random\n\nfrom chunsabot.database import Database\nfrom chunsabot.botlogic import brain\n\nRNN_PATH = Database.l... | python | chosen |
[
{
"from": "system",
"value": "Remove PCF 1.12 from CI.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nfrom jinja2 import Template\n\nclusters = ['1_12', '2_0', '2_1', '2_2']\n# Commenting out this as we only have one example and it breaks\ntiles = [] # [d for d in os.list... | python | chosen |
[
{
"from": "system",
"value": "Add signal to invalidate cache when groups change.\n"
},
{
"from": "human",
"value": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\n\nfrom django.contrib.auth.models import User, Group\n\nfrom .models import UserProfile, Group... | python | chosen |
[
{
"from": "system",
"value": "Add (failing) test for getting all processes\n"
},
{
"from": "human",
"value": "import px_process\n\n\ndef test_create_process():\n process_builder = px_process.PxProcessBuilder()\n process_builder.pid = 7\n process_builder.username = \"usernamex\"\n pro... | python | chosen |
[
{
"from": "system",
"value": "Add _services keyword argument to MultiSharer's send.\n"
},
{
"from": "human",
"value": "from .base import AbstractSharer\n\n\nclass MultiSharer(AbstractSharer):\n def __init__(self, **kw):\n super(MultiSharer, self).__init__()\n self.sharers = {}\n... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Remove the __future__ flags\"\n\nThis reverts commit 24b3332ca0c0005483d5f310604cca984efd1ce9.\n"
},
{
"from": "human",
"value": "import sys\nimport types\nfrom ast import PyCF_ONLY_AST\n\nPY2 = sys.version_info[0] == 2\nPYPY = hasattr(sys, 'pypy_translatio... | python | chosen |
[
{
"from": "system",
"value": "Fix super() call for py2.7\n"
},
{
"from": "human",
"value": "import io\nimport pcpp\n\n\nclass FortranPreprocessor(pcpp.Preprocessor):\n def __init__(self):\n super().__init__()\n\n def parse_to_string_lines(self, text):\n with io.StringIO() as ... | python | chosen |
[
{
"from": "system",
"value": "Simplify version string and update to reflect current status.\n"
},
{
"from": "human",
"value": "\"\"\"\ndjango-selectable is a collection of tools and widgets for using/creating auto-complete selection widgets using Django and jQuery UI.\n\"\"\"\n\n__version_info__... | python | chosen |
[
{
"from": "system",
"value": "Add option to remove newlines; remove bug on messages sent by someone without a username\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"\nA program to extract raw text from Telegram chat log\n\"\"\"\nimport argparse\nfrom json import loads\n\ndef m... | python | chosen |
[
{
"from": "system",
"value": "Fix an error accessing the twitter returned auth object\n"
},
{
"from": "human",
"value": "\"\"\"\nCommand for getting the Twitter oauth access.\n\nhttp://talkfast.org/2010/05/31/twitter-from-the-command-line-in-python-using-oauth/\n\"\"\"\nfrom django.core.manageme... | python | chosen |
[
{
"from": "system",
"value": "Configure payday for no db timeout\n"
},
{
"from": "human",
"value": "\"\"\"This is installed as `payday`.\n\"\"\"\nfrom gittip import wireup\n\n\ndef payday():\n db = wireup.db()\n wireup.billing()\n wireup.nanswers()\n\n\n # Lazily import the billing m... | python | chosen |
[
{
"from": "system",
"value": "Add a remote option to Say\n"
},
{
"from": "human",
"value": "from pyheufybot.module_interface import Module, ModulePriority, ModuleType\n\nclass ModuleSpawner(Module):\n def __init__(self, bot):\n self.bot = bot\n self.name = \"Say\"\n self.... | python | chosen |
[
{
"from": "system",
"value": "Fix test for change in panel text\n"
},
{
"from": "human",
"value": "import sys\n\nimport pytest\n\nfrom PyQt5 import QtGui, QtWidgets\n\n# Local\nfrom sas.qtgui.MainWindow.WelcomePanel import WelcomePanel\n\n\nclass WelcomePanelTest:\n '''Test the WelcomePanel''... | python | chosen |
[
{
"from": "system",
"value": "Fix test that may break with DOM element no longer attached, since the DOM element in question is reloaded.\n"
},
{
"from": "human",
"value": "import zeit.content.article.edit.browser.testing\n\n\nclass Supertitle(zeit.content.article.edit.browser.testing.EditorTest... | python | chosen |
[
{
"from": "system",
"value": "Update the output file name\n"
},
{
"from": "human",
"value": "# -*- coding:utf-8 -*-\nimport os\nimport subprocess\nimport sys\n\nsource = sys.argv[1]\nTYPES = ('.jpeg', '.png', '.jpg')\n\ndef convert_a_img(img_file):\n\tfilename = os.path.split(img_file)[1]\n\turl... | python | chosen |
[
{
"from": "system",
"value": "Reset Content-Length after changing the length of the response\n"
},
{
"from": "human",
"value": "try:\n from django.utils.deprecation import MiddlewareMixin\nexcept ImportError:\n MiddlewareMixin = object\n\n\nclass PageStatusMiddleware(MiddlewareMixin):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix `is_anonymous` for Django 2\n"
},
{
"from": "human",
"value": "from django.conf import settings\n\nif settings.HOOVER_RATELIMIT_USER:\n from django.http import HttpResponse\n from . import signals\n from hoover.contrib.ratelimit.limit import RateLimit\n... | python | chosen |
[
{
"from": "system",
"value": "Update custom JSONEncoder to treat TimestampedData as dict\n\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport json as _json\n\nfrom functools import partial\n\nfrom il2fb.commons.events import Event\n\n\n__all__ = ('dumps', 'loads', )\n\n\nclass ... | python | chosen |
[
{
"from": "system",
"value": "Use lru_cache instead of a dict cache in FunctionDispatch\n\nThis has no affect on the microbenchmark, but seems appropriate for\nconsistency with the previous commit.\n"
},
{
"from": "human",
"value": "import attr\n\n\n@attr.s(slots=True)\nclass FunctionDispatch(ob... | python | chosen |
[
{
"from": "system",
"value": "Add `delimiter` and `html_map` to HTML formatter and do not register it by default"
},
{
"from": "human",
"value": "from django.template import defaultfilters as filters\nfrom avocado.formatters import Formatter, registry\n\n\nclass HTMLFormatter(Formatter):\n de... | python | chosen |
[
{
"from": "system",
"value": "Apply gevent patch earlier based on output of `flask run`\n"
},
{
"from": "human",
"value": "import codecs\nimport os\nimport gevent.monkey\n\nfrom dallinger.experiment_server.experiment_server import app\n\n\ngevent.monkey.patch_all()\n\napp.config[\"EXPLAIN_TEMPLA... | python | chosen |
[
{
"from": "system",
"value": "Add test for test incoming call\n"
},
{
"from": "human",
"value": "from django.test import TestCase, Client\n\n\nclass HomePageTest(TestCase):\n\n def setUp(self):\n self.client = Client()\n\n def test_home_page(self):\n # Act\n response =... | python | chosen |
[
{
"from": "system",
"value": "Verify the full interface of the context object\n\nImproved testcase for get_test_admin_context method\nChange-Id: I8c99401150ed41cbf66b32cd00c7f8353ec4e267\n"
},
{
"from": "human",
"value": "#\n# Copyright 2010 OpenStack Foundation\n#\n# Licensed under the Ap... | python | chosen |
[
{
"from": "system",
"value": "MAINT: Make default version number be a dev version\n"
},
{
"from": "human",
"value": "name = 'package-name' # See https://www.python.org/dev/peps/pep-0008/\npath = name.lower().replace(\"-\", \"_\").replace(\" \", \"_\")\nversion = '0.1.0' # https://python.org/de... | python | chosen |
[
{
"from": "system",
"value": "Add user agent to GitHub cloning\n"
},
{
"from": "human",
"value": "import re\nimport requests\n\n\nURL_REGEX = re.compile(r'https?://(?:www.)?github.com/(?P<account>[^\\s]+)')\n\n\ndef matches_url(url):\n \"\"\"Check with a URL matches a GitHub account URL.\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Add algorithm argument to get_hash\n"
},
{
"from": "human",
"value": "\n# -*- coding: utf-8 -*-\n'''\nUse pycrypto to generate random passwords on the fly.\n'''\n\n# Import python libraries\ntry:\n import Crypto.Random # pylint: disable=E0611\n HAS_RANDOM = T... | python | chosen |
[
{
"from": "system",
"value": "Make sure to update correct load balancer\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport argparse\nimport subprocess\nimport json\nimport sys\n\n\nparser = argparse.ArgumentParser()\nargs = parser.parse_args()\n\n\ndef info(msg):\n sys.stdout.w... | python | chosen |
[
{
"from": "system",
"value": "Create unknown users, when authenticated successfully"
},
{
"from": "human",
"value": "import kerberos\nimport logging\n\nfrom django.conf import settings\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.backends import ModelBackend\n\n\nlog... | python | chosen |
[
{
"from": "system",
"value": "Use api/1/ as url prefix for all REST interfaces\n\nThis allows separating the \"normal\" web code from the rest api.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the s... | python | chosen |
[
{
"from": "system",
"value": "Fix the gift certificate module so that an invalid code won't throw an exception.\n"
},
{
"from": "human",
"value": "\"\"\"\nGiftCertificate processor\n\"\"\"\nfrom django.utils.translation import ugettext as _\nfrom l10n.utils import moneyfmt\nfrom models import Gi... | python | chosen |
[
{
"from": "system",
"value": "Add note about virtualenv support\n"
},
{
"from": "human",
"value": "import sys\nimport sysconfig\nimport site\n\nif __name__ == '__main__':\n # This is a hack due to the distutils in debian/ubuntu's python3 being misconfigured\n # see discussion https://githu... | python | chosen |
[
{
"from": "system",
"value": "Fix error when displaying other types of surveys\n"
},
{
"from": "human",
"value": "from django import template\n\nfrom wagtail_personalisation.adapters import get_segment_adapter\n\nregister = template.Library()\n\n@register.simple_tag\ndef filter_surveys_by_segmen... | python | chosen |
[
{
"from": "system",
"value": "Revert that last change.. and do a proper fix\n"
},
{
"from": "human",
"value": "\nimport os\nfrom kokki import *\n\nenv.include_recipe(\"boto\")\n\n# Mount volumes and format is necessary\n\nfor vol in env.config.aws.volumes:\n env.cookbooks.aws.EBSVolume(vol.ge... | python | chosen |
[
{
"from": "system",
"value": "Add constraint from name method\n"
},
{
"from": "human",
"value": "from whylog.constraints import DifferentConstraint, IdenticalConstraint, TimeConstraint\nfrom whylog.constraints.exceptions import UnsupportedConstraintTypeError\n\n\nclass ConstraintRegistry(object)... | python | chosen |
[
{
"from": "system",
"value": "Refactor create english superset code to create english superset dictionaries in batches of 10K. Also re-include untranslated words.\n"
},
{
"from": "human",
"value": "import optparse\nimport os\n\noptparser = optparse.OptionParser()\noptparser.add_option(\"-d\", \"... | python | chosen |
[
{
"from": "system",
"value": "Update charms.hadoop reference to follow convention\n"
},
{
"from": "human",
"value": "from charms.reactive import when, when_not, set_state, remove_state\nfrom charms.hadoop import get_hadoop_base\nfrom jujubigdata.handlers import HDFS\nfrom jujubigdata import util... | python | chosen |
[
{
"from": "system",
"value": "Fix the basic test to make a line\n"
},
{
"from": "human",
"value": "import matplotlib.pyplot as plt\nimport mplleaflet\n\ndef test_basic():\n plt.plot([0, 0], [1, 1])\n mplleaflet.fig_to_html()\n\n\ndef test_scatter():\n plt.scatter([0, 10, 0, 10], [0, 0, ... | python | chosen |
[
{
"from": "system",
"value": "Allow MySQL to set a default role\n"
},
{
"from": "human",
"value": "\"\"\"empty message\n\nRevision ID: 4093ccb6d914\nRevises: None\nCreate Date: 2014-04-30 22:02:09.991428\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '4093ccb6d914'\ndown_revis... | python | chosen |
[
{
"from": "system",
"value": "Reset message into empty string of sinonAssertion\n"
},
{
"from": "human",
"value": "properties = [\"SinonSpy\", \"SinonStub\", \"SinonMock\"]\nproduction_properties = [\"spy\", \"stub\", \"mock\"]\n\ndef _clear_item_in_queue(queue):\n for item in reversed(queue)... | python | chosen |
[
{
"from": "system",
"value": "Fix error logging in galaxy-cachefile-external-validator\n\nbin/galaxy-cachefile-external-validator is a symlink to bin/travis.py\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\nimport logging\nfrom cargoport.utils import yield_packages, downlo... | python | chosen |
[
{
"from": "system",
"value": "Switch to JSON containing database.tar.gz\n"
},
{
"from": "human",
"value": "from ..utils.data_utils import get_file\nimport numpy as np\nimport cPickle as pickle\nimport tarfile\n\ndef load_data(path='peptone_dspp.tar.gz'):\n \"\"\"Loads the MNIST dataset.\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Write name of last page in txt file\n"
},
{
"from": "human",
"value": "import os\n\n\ndef make_chapter_files():\n os.chdir('../static/images')\n\n for _, dirs, files in os.walk(os.getcwd()):\n\n dirs = [d for d in dirs if not d[0] == '.']\n files... | python | chosen |
[
{
"from": "system",
"value": "[Feature] Add a class for representing the current version\n\nThis patch implements the `Version` class inside of the `__init__.py`\nfile alongside the rest of Hypatia's meta-data. The class has public\ninteger properties representing the major, minor, and patch portions\nof t... | python | chosen |
[
{
"from": "system",
"value": "[trunk] Convert back slashes to forward slashes before executing Python processes\n"
},
{
"from": "human",
"value": "import subprocess\r\nimport sys\r\n\r\ndef ExecuteProcess(args, verbose=False, isCSharp=False):\r\n if isCSharp and sys.platform.startswith(\"darw... | python | chosen |
[
{
"from": "system",
"value": "Add a hacky method of subbing 'official' names which are awkward, for more handy ones. i.e. 'United Kingdom of Great Britain & Northern Ireland -> Great Britain.\n"
},
{
"from": "human",
"value": "\"\"\"Utility functions for dealing with repository and geo data.\"\"... | python | chosen |
[
{
"from": "system",
"value": "Update : try/except in destructurate greatly enhances performances on mass read/write\n"
},
{
"from": "human",
"value": "from collections import Sequence\n\n# Enums beautiful python implementation\n# Used like this :\n# Numbers = enum('ZERO', 'ONE', 'TWO')\n# >>> Nu... | python | chosen |
[
{
"from": "system",
"value": "Fix dependency order issue in get_version\n"
},
{
"from": "human",
"value": "VERSION = (0, 9, 0, 'beta', 1)\n\n\ndef get_version():\n from django.utils.version import get_version as django_get_version\n return django_get_version(VERSION) # pragma: no cover\n"
... | python | chosen |
[
{
"from": "system",
"value": "Modify config to fit with PEP8 standard\n"
},
{
"from": "human",
"value": "#!env/bin/python\nfrom migrate.versioning import api\nfrom config import SQLALCHEMY_DATABASE_URI\nfrom config import SQLALCHEMY_MIGRATE_REPO\nfrom app import db\nimport os.path\ndb.create_all... | python | chosen |
[
{
"from": "system",
"value": "Fix path to 404 handler\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nurlpatterns = patterns(\n '',\n url(r'^', include('tinyblog.urls')),\n)\n\nhandler404 = 'tinyblog.tests.views.test_404'\n"
},
{
"from": "g... | python | chosen |
[
{
"from": "system",
"value": "Use assertIn in tests for better error message.\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n# ! python2\n\nfrom __future__ import (absolute_import, division, print_function, unicode_literals)\n\nimport os\nimport tempfile\n\nfrom django.test import... | python | chosen |
[
{
"from": "system",
"value": "Use UTC timestamp as timestamp\n"
},
{
"from": "human",
"value": "from time import time\n\n\ndef dynamic_import(path):\n module, builder = path.rsplit(\".\", 1)\n return getattr(__import__(module, fromlist=[builder]), builder)\n\n\ndef current_ts():\n \"\"\... | python | chosen |
[
{
"from": "system",
"value": "Fix list columns for all models\n"
},
{
"from": "human",
"value": "from flask.ext.admin import Admin\nfrom flask.ext.admin.contrib.sqla import ModelView\n\nimport db.schema as schema\nimport db.query as query\nfrom handlers.rest import app\n\nadmin = Admin(app, url=... | python | chosen |
[
{
"from": "system",
"value": "Add a dummy server - Tests are broken\n"
},
{
"from": "human",
"value": "import unittest\nimport mock\nfrom tikplay import server\n\n\nclass ServerTestcase(unittest.TestCase):\n def setUp(self):\n self.handler_class = mock.MagicMock()\n self.server_... | python | chosen |
[
{
"from": "system",
"value": "Return COMSPEC as the shell for Windows\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\n# Import python libs\nimport os\n\n# Import third party libs\nimport yaml\nimport logging\n\n# Import salt libs\nimport sa... | python | chosen |
[
{
"from": "system",
"value": "Add a toplevel warning against legacy keras.preprocessing utilities\n\nPiperOrigin-RevId: 434866390\n"
},
{
"from": "human",
"value": "# Copyright 2016 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"... | python | chosen |
[
{
"from": "system",
"value": "Use striptags from genshi for striphtml, since we have to have genshi anyway\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"WebHelpers used in SAUCE.\n\n@author: moschlar\n\"\"\"\n\nfrom datetime import datetime\n\nfrom tg import url as tgurl\n#fr... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for team views\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom .models import Team\n\n\nclass TeamTestCase(TestCase):\n def setUp(self):\n Team.objects.create(name=\"Test Team 1\", number=1)\n\n def test_team_crea... | python | chosen |
[
{
"from": "system",
"value": "Remove checks for deprecated keys in outcomes\n"
},
{
"from": "human",
"value": "def assert_outcomes(result, **expected):\n outcomes = result.parseoutcomes()\n\n for key in 'seconds', 'pytest-warnings', 'warnings', 'warning':\n if key in outcomes:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add 67P/Churyumov–Gerasimenko to example data\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\"\"\"Example data.\n\n\"\"\"\n\nfrom astropy import time\nfrom astropy import units as u\n\nfrom poliastro.bodies import Earth\nfrom poliastro.twobody import State\n\n... | python | chosen |
[
{
"from": "system",
"value": "Support programmatically passing password in alias route\n"
},
{
"from": "human",
"value": "from flask import redirect\nfrom flask import render_template\nfrom flask import request\n\nimport database.link\nfrom linkr import app\nfrom uri.link import *\nfrom uri.main... | python | chosen |
[
{
"from": "system",
"value": "Cut out old hash function\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\n\ndef hash_dict(d):\n \"\"\"Hashes a dictionary\n\n :param dict d: A dictionary to recursively hash\n :return: the hash value of t... | python | chosen |
[
{
"from": "system",
"value": "Throw 500 error on SQLAlchemy integrity error\n"
},
{
"from": "human",
"value": "import os\nfrom datetime import date\n\nfrom pyramid.response import FileResponse\nfrom pyramid.view import view_config\n\n\n@view_config(route_name='home', renderer='templates/index.ht... | python | chosen |
[
{
"from": "system",
"value": "Fix wagtail module paths in news\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.core.paginator import EmptyPage, PageNotAnInteger, Paginator\nfrom django.utils.translation import ugettext_lazy as _\nfrom wagtail.wagtailcore.models i... | python | chosen |
[
{
"from": "system",
"value": "Remove an unnecessary class attribute\n"
},
{
"from": "human",
"value": "from .. import idiokit\nfrom ._iputils import parse_ip\nfrom ._conf import hosts\nfrom ._dns import DNSError, a, aaaa\n\n\ndef _filter_ips(potential_ips):\n results = []\n for ip in poten... | python | chosen |
[
{
"from": "system",
"value": "Check whether unzip or tar are used instead of unarchive\n"
},
{
"from": "human",
"value": "import ansiblelint.utils\nimport os\nfrom ansiblelint import AnsibleLintRule\n\nclass CommandsInsteadOfModulesRule(AnsibleLintRule):\n id = 'ANSIBLE0006'\n shortdesc = ... | python | chosen |
[
{
"from": "system",
"value": "Add logging for health check\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand, CommandError\nimport time\n\nfrom django_celery_beat.models import PeriodicTask\nfrom django.utils import timezone\nfrom datetime import timedelta\n\... | python | chosen |
[
{
"from": "system",
"value": "Fix scope when setting up multiprocessing with coverage\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\n\ndef patch_process_for_coverage():\n # patch multiprocessing module to get coverage\n # https://bitbucket.org/ned/coveragepy/issue/117/enable-c... | python | chosen |
[
{
"from": "system",
"value": "Check number is the field that is different\n"
},
{
"from": "human",
"value": "import unittest\n\nimport inidiff\n\nINI_1 = '''[test]\nnumber=10\n'''\n\nINI_2 = '''[test]\nnumber=20\n'''\n\n\nclass TestDiff(unittest.TestCase):\n \"\"\"Test diffs diff things.\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Fix for bug where we were using SwapCached instead of Cached values in availableMemory Calculation\n"
},
{
"from": "human",
"value": "/*\n * Copyright 2012-2014 inBloom, Inc. and its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"... | python | chosen |
[
{
"from": "system",
"value": "Update cli for recently added models\n"
},
{
"from": "human",
"value": "import ujson as json\nfrom sift.build import DatasetBuilder\nfrom sift.models import links, text, embeddings\n\nclass BuildDocModel(DatasetBuilder):\n \"\"\" Build a model over a corpus of te... | python | chosen |
[
{
"from": "system",
"value": "Add get_language method for TranslationsMixin\n"
},
{
"from": "human",
"value": "class TranslationsMixin(object):\n \"Helper for getting transalations\"\n\n SLUG_FIELD_FOR_TRANSLATIONS = 'slug' # Overide in models if needed\n LANG_FIELD_FOR_TRANSLATION... | python | chosen |
[
{
"from": "system",
"value": "FEATURE: Add root dir for temp files\n"
},
{
"from": "human",
"value": "# -*- coding:utf-8 -*-\n\n\"\"\"\n stonemason.util.tempfn\n ~~~~~~~~~~~~~~~~~~~~~~\n Generate a temp filename\n\"\"\"\n\n__author__ = 'ray'\n__date__ = '8/30/12'\n\nimport os\nimport er... | python | chosen |
[
{
"from": "system",
"value": "Replace {T} with a unicode tap symbol approximation and replace {S} with a unicode snowflake, how exiting. More symbol replacements to follow\n"
},
{
"from": "human",
"value": "import urllib\n\nfrom util import hook, http\n\n\ndef card_search(query):\n base_url =... | python | chosen |
[
{
"from": "system",
"value": "Fix tests with Django 2.0\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom django.db import models\nfrom tinymce import HTMLField\n\n\nclass TestModel(models.Model):\n \"\"\"\n A model for testing TinyMCE 4 rendering\n \"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Add UserAdmin and GroupAdmin to custom AdminSite\n"
},
{
"from": "human",
"value": "from .models import Idea, Outstanding\nfrom django.contrib import admin\nfrom django.contrib.admin import AdminSite\nfrom django.contrib.auth.models import User, Group\n\n\nclass MyA... | python | chosen |
[
{
"from": "system",
"value": "Subzero: Change the echoing in shellcmd().\n\nThis makes it much easier to copy/paste the output.\n\nBUG= none\nR=jvoung@chromium.org\n\nReview URL: https://codereview.chromium.org/611983003\n"
},
{
"from": "human",
"value": "import os\nimport subprocess\nimport sys... | python | chosen |
[
{
"from": "system",
"value": "Add show_statistics to public API\n\nPiperOrigin-RevId: 322842576\n"
},
{
"from": "human",
"value": "# coding=utf-8\n# Copyright 2020 The TensorFlow Datasets Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fil... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.