conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix name of entity graph url " }, { "from": "human", "value": "from django.conf.urls import patterns, url, include\nfrom django.utils.translation import ugettext as _\n\nfrom .views import (\n RealmView,\n EntityDetailView,\n EntityNetworkView,\n)\n\nentity...
python
chosen
[ { "from": "system", "value": "Handle TypeError while testing all regression learners\n" }, { "from": "human", "value": "import unittest\nimport inspect\nimport pkgutil\n\nimport Orange\nfrom Orange.data import Table\nfrom Orange.regression import Learner\n\n\nclass RegressionLearnersTest(unittes...
python
chosen
[ { "from": "system", "value": "Remove cProfile inclusion, always read file as binary\n\nSigned-off-by: Dan McGee <2591e5f46f28d303f9dc027d475a5c60d8dea17a@archlinux.org>\n" }, { "from": "human", "value": "import sys\nimport cProfile\n\nfrom . import AsciiData, BinaryData\n\ndef parsefile(name):\n...
python
chosen
[ { "from": "system", "value": "Add link to source code in documentation\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the direct...
python
chosen
[ { "from": "system", "value": "feature/oop-api-refactoring: Remove redundant parentheses around if conditions\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom os.path import sep\n\n\nKEY = 'go'\nLABEL = 'Go'\n\nDEPENDENCIES = ['go']\nTEMP_DIR = 'go'\nSUFFIX = 'go'\n\n# go build ...
python
chosen
[ { "from": "system", "value": "Make \\G or \\g to end a query.\n" }, { "from": "human", "value": "from prompt_toolkit.buffer import Buffer\nfrom prompt_toolkit.filters import Condition\n\nclass CLIBuffer(Buffer):\n def __init__(self, always_multiline, *args, **kwargs):\n self.always_mul...
python
chosen
[ { "from": "human", "value": "Make the quantum top-level a namespace package.\n\nChange-Id: I8fa596dedcc72fcec73972f6bf158e53c17b7e6d\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenStack LLC\n# All Rights Reserved.\n#\n# Licensed under the ...
python
chosen
[ { "from": "system", "value": "Update example with correct form, and with comment.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n#\n# Add a singleton feature to the misc column of all tokens of a certain form.\n#\n# Format\n# add_misc_features.py filename > transform.conll\n#\n\ni...
python
chosen
[ { "from": "system", "value": "Handle var names that are uppercase\n" }, { "from": "human", "value": "\"\"\"\nraven.core.processors\n~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\nclass Proce...
python
chosen
[ { "from": "system", "value": "Add a convenience method to get the player ship\n" }, { "from": "human", "value": "from . import packet as p\n\nclass Tracker:\n def __init__(self):\n self.objects = {}\n\n def update_object(self, record):\n try:\n oid = record['object...
python
chosen
[ { "from": "system", "value": "Prepare test hashing for complex types.\n" }, { "from": "human", "value": "# Copyright (c) 2016 Renata Hodovan, Akos Kiss.\n#\n# Licensed under the BSD 3-Clause License\n# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.\n# This file may not be copied,...
python
chosen
[ { "from": "system", "value": "Fix line length to pass CI" }, { "from": "human", "value": "\"\"\"rippl URL Configuration\"\"\"\nfrom django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.views.generic import TemplateView\nfrom .registration.forms import RecaptchaRegV...
python
chosen
[ { "from": "system", "value": "Fix a badly indented line. (PEP8 E121)\n" }, { "from": "human", "value": "import sys\n\nfrom os.path import dirname, abspath\n\nsys.path.insert(0, dirname(dirname(abspath(__file__))))\n\nfrom django.conf import settings\n\nsettings.configure()\n\nproject = 'django-s...
python
chosen
[ { "from": "system", "value": "Fix channel filtering to work properly\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport yaml\n\n\nclass ChannelFilter(object):\n def __init__(self, path=None):\n if path is None:\n path = os.path.join(os.path.dirname...
python
chosen
[ { "from": "system", "value": "Implement more TGT Hunter cards\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n# Ram Wrangler\nclass AT_010:\n\tplay = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast())\n\n\n##\n# Spells\n\n# Lock and Load\nclass AT_0...
python
chosen
[ { "from": "system", "value": "Tweak example image conversion settings.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport deepzoom\n\n# Specify your source image\nSOURCE = \"helloworld.jpg\"\n\n# Create Deep Zoom Image creator with weird parameters\ncreat...
python
chosen
[ { "from": "system", "value": "Use OPENCV_CAMERA_SOURCE environment variable to set source\n" }, { "from": "human", "value": "import cv2\nfrom base_camera import BaseCamera\n\n\nclass Camera(BaseCamera):\n video_source = 0\n\n @staticmethod\n def set_video_source(source):\n Camera...
python
chosen
[ { "from": "system", "value": "[python] Update example to use api-key.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nsys.path += ['../']\n\nfrom epidb.client import EpiDBClient\n\ndata = 'data'\n\nclient = EpiDBClient()\nres = client.survey_submit(data)\n\nprint res\n\n"...
python
chosen
[ { "from": "system", "value": "Set default settings to dev\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"cg.settings\")\n\n from django.core.management import execute_from...
python
chosen
[ { "from": "system", "value": "Fix the events page, so that upcoming event shows up.\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\n\nfrom flask import Blueprint, render_template\nfrom sqlalchemy import and_\n\nfrom models import Event\n\nblueprint = Blueprint(\"base...
python
chosen
[ { "from": "system", "value": "Read our .env when we test.\n" }, { "from": "human", "value": "import os\n\nfrom django import get_version\nfrom django.conf import settings\n\n\ndef pytest_report_header(config):\n return 'django: ' + get_version()\n\n\ndef pytest_configure():\n if not settin...
python
chosen
[ { "from": "system", "value": "Adjust so it works properly with types\n" }, { "from": "human", "value": "from django.views.generic import TemplateView\n\n\nclass ResponsiveTestView(TemplateView):\n template_name = \"responsive_design_helper/%s.html\"\n\n def get_template_names(self, **kwarg...
python
chosen
[ { "from": "system", "value": "Update the example proxy list\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the command line:\n\...
python
chosen
[ { "from": "system", "value": "Add CSV file name format setting example\n" }, { "from": "human", "value": "import os\nimport re\n\nfrom imap import EmailCheckError, EmailServer\nfrom postgresql import DatabaseServer\n\n\nCSV_FOLDER = os.getcwd()\n\n# Restrict emails by sender.\nEMAIL_FROM = 'send...
python
chosen
[ { "from": "system", "value": "Update how version is determined\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom collections import namedtuple\n\nimport pbr.version\n\n\n__version__ = pbr.version.VersionInfo('instabrade').version_string()\n\nPageID = namedtuple(\"...
python
chosen
[ { "from": "system", "value": "Add init code to deal with AWS HTTP API\n" }, { "from": "human", "value": "from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient\nfrom tornado.httputil import url_concat\nimport datetime\nimport hashlib\nimport hmac\n\n\nclass SQSRequest(HTTPReques...
python
chosen
[ { "from": "system", "value": "Add fragment_keys method to PageQuerySet\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass PageQuerySet(models.QuerySet):\n\n def published(self):\n return self.filter(is_published=True)\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "system", "value": "Fix sorting of the imports.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '1.6.2'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__maintainer__ = 'Pierre Cazenave'\n...
python
chosen
[ { "from": "system", "value": "Add Mike as a contributor.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '2.0.0'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__maintainer__ = 'Pierre Cazenave'\n_...
python
chosen
[ { "from": "system", "value": "Add timing to show time complexity.\n" }, { "from": "human", "value": "import timeit\n\ndef insertion(_list):\n '''Sorts a list via the insertion method.'''\n if type(_list) is not list:\n raise TypeError('Entire list must be numbers')\n for i in ran...
python
chosen
[ { "from": "system", "value": "Check if dir exists before calling listdir\n\nChanges along the way to how we clean up and detach after\ncopying an image to a volume exposed a problem in the cleanup\nof the brick/initiator routines.\n\nThe clean up in the initiator detach was doing a blind listdir\nof /dev/di...
python
chosen
[ { "from": "system", "value": "Remove special case from StringIO.\n" }, { "from": "human", "value": "try:\n from io import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\ntry:\n FileNotFoundError = FileNotFoundError\nexcept NameError:\n FileNotFoundError = IOError\n\n...
python
chosen
[ { "from": "system", "value": "Add checking empty product code\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport csv\n\nclass CsvConverter:\n\n def __init__(self, csv_file_path):\n self.csv_file_path = csv_file_path\n self.rows = []\n ...
python
chosen
[ { "from": "system", "value": "Add usage string for fallthrough cases\n" }, { "from": "human", "value": "\"\"\"calc.py: A simple calculator.\"\"\"\n\nimport sys\n\ndef add_all(nums):\n return sum(nums)\n\ndef multiply_all(nums):\n return reduce(lambda a, b: a * b, nums)\n\nif __name__ == '_...
python
chosen
[ { "from": "system", "value": "Change process killing from -9 to -15\n" }, { "from": "human", "value": "#!/usr/bin/env python \n#-*- coding: utf-8 -*- \n\n\"\"\"\nclean zombie processes\n\"\"\"\n# @author chengdujin\n# @contact chengdujin@gmail.com\n# @created Aug. 22, 2013\n\n\nimport sys \nrelo...
python
chosen
[ { "from": "system", "value": "Fix for import error with matplotlib Qt4Agg backend\n" }, { "from": "human", "value": "#\n# Plot.py -- Plotting function for Ginga FITS viewer.\n#\n# Eric Jeschke (eric@naoj.org)\n#\n# Copyright (c) Eric R. Jeschke. All rights reserved.\n# This is open-source soft...
python
chosen
[ { "from": "system", "value": "Fix crash when there are no includes for a task\n" }, { "from": "human", "value": "# Copyright 2017 Codethink Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may ...
python
chosen
[ { "from": "system", "value": "Fix provider check causing Devshell auth failure\n\nThis commit builds on commit 13c4926, allowing Devshell credentials to\nbe used only with Google storage.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2015 Google Inc. All Rights Reserved...
python
chosen
[ { "from": "system", "value": "[IMP] hr_payroll_account: Remove useless dependency to hr_expense\n" }, { "from": "human", "value": "#-*- coding:utf-8 -*-\n# Part of Odoo. See LICENSE file for full copyright and licensing details.\n{\n 'name': 'Payroll Accounting',\n 'category': 'Human Resou...
python
chosen
[ { "from": "system", "value": "[IMP] Add required dependency to mqo_programs." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\n{\r\n 'name': \"MQO Programs\",\r\n\r\n 'summary': \"\"\"Manage programs\"\"\",\r\n\r\n 'description': \"\"\"\r\n MQO module for managing progr...
python
chosen
[ { "from": "system", "value": "Fix a bug on a query example for python\n\nMethods used by the former example, `query.more()` and `query.next()`, do not exist any longer. \r\nI've modified them to `query.execute()`, according to `BaseXClient.py`, to make it run as good as it should be." }, { "from":...
python
chosen
[ { "from": "system", "value": "Fix extracted star coordinates from 1- to 0-based indexing\n\nNote that center of first pixel is 0, ie. edge of first pixel is -0.5\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Dec 25 15:19:55 2017\n\n@author: vostok\n\"\"\"\n\n...
python
chosen
[ { "from": "system", "value": "Stop adding translation function to builtins\n\nIn unittests __init__ translation function is still being added to\nbuiltins, this is not required anymore as it is not being installed.\n\nChange-Id: I19da395b72622a6db348f5a6dd569c7747eaa40d\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Fix a mistake made while merging\n" }, { "from": "human", "value": "from pip._vendor.six.moves.urllib import parse as urllib_parse\n\n\nclass PackageIndex(object):\n \"\"\"Represents a Package Index and provides easier access to endpoints\n \"\"\"\n\n def _...
python
chosen
[ { "from": "system", "value": "Use MysqlQueryTask for getting clan data\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file ...
python
chosen
[ { "from": "system", "value": "Use email username if no realname is found in header\n" }, { "from": "human", "value": "from email import message_from_string, utils\nimport json\n\nfrom django.db import models\nfrom dateutil.parser import parse\n\n\nclass EmailManager(models.Manager):\n def cre...
python
chosen
[ { "from": "system", "value": "Add validation to example script.\n" }, { "from": "human", "value": "\"\"\"\\\nUsage:\n dot.py [options] [<path>] [<address>]\n dot.py -h | --help\n dot.py --version\n\nWhere:\n <path> is the file to serve\n <address> is what to listen on, of the form <host>[:<...
python
chosen
[ { "from": "system", "value": "Remove admin autodiscovery since Django does that for us now\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\nfrom django.vie...
python
chosen
[ { "from": "system", "value": "Disable GDB \"startup-with-shell\" only on Unix platform\n" }, { "from": "human", "value": "# Copyright (c) 2014-present PlatformIO <contact@platformio.org>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except i...
python
chosen
[ { "from": "system", "value": "Python: Return the vector rather than printing it.\n" }, { "from": "human", "value": "# Copyright 2015 Carnegie Mellon University\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licen...
python
chosen
[ { "from": "system", "value": "Add warning when server handler task queue is full\n" }, { "from": "human", "value": "__all__ = [\n 'SocketServer',\n]\n\nimport errno\nimport logging\n\nfrom g1.asyncs.bases import servers\nfrom g1.asyncs.bases import tasks\n\nLOG = logging.getLogger(__name__)\n...
python
chosen
[ { "from": "system", "value": "Add basic tests for configuration\n" }, { "from": "human", "value": "\"\"\"Tests for the config command\n\"\"\"\n\nfrom pip.status_codes import ERROR\nfrom tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin\n\n\ndef test_no_options_passed_should_...
python
chosen
[ { "from": "system", "value": "Check if the installed python2.4 have ssl support.\n" }, { "from": "human", "value": "def test(options, buildout):\n from subprocess import Popen, PIPE\n import os\n import sys\n\n python = options['python']\n if not os.path.exists(python):\n r...
python
chosen
[ { "from": "system", "value": "Use python's built in system for percent-encoding\n" }, { "from": "human", "value": "from urllib.request import urlopen\nimport Utilities\n\nFILENAME_CUE = \"File:\"\nIMAGE_LOCATION_CUE = '<div class=\"fullMedia\"><a href=\"https://upload.wikimedia.org/wikipedia/com...
python
chosen
[ { "from": "system", "value": "Add integrator property for Operations\n" }, { "from": "human", "value": "import hoomd.integrate\n\n\nclass Operations:\n def __init__(self, simulation=None):\n self.simulation = simulation\n self._compute = list()\n self._auto_schedule = Fal...
python
chosen
[ { "from": "system", "value": "Fix how SECRET_KEY is generated\n\nUse secrets.choice instead of random.sample to generate the secret key." }, { "from": "human", "value": "#!/usr/bin/env python\n# This script will generate a random 50-character string suitable for use as a SECRET_KEY.\nimport rand...
python
chosen
[ { "from": "system", "value": "Move db fixture to the inside of the method\n" }, { "from": "human", "value": "import pytest\n\n\n__version__ = '0.1.1'\n\n\ndef pytest_configure(config):\n # Register the marks\n config.addinivalue_line(\n 'markers',\n 'haystack: Mark the test a...
python
chosen
[ { "from": "system", "value": "Fix bad indentation that broke the PEP8 !\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"\n Alignak REST backend\n\t\n\tThis module is an Alignak REST backend\n\"\"\"\n# Application version and manifest\nVERSION = (0,...
python
chosen
[ { "from": "system", "value": "Allow arbitrary kwargs for die utility function. by: Glenn, Giles" }, { "from": "human", "value": "# Copyright (c) 2011 Resolver Systems Ltd.\n# All Rights Reserved\n#\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nfrom datet...
python
chosen
[ { "from": "system", "value": "V8: Switch new ports master to master3a\n\nBUG=595708\nTBR=tandrii@chromium.org\n\nReview URL: https://codereview.chromium.org/1854673002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@299638 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "va...
python
chosen
[ { "from": "system", "value": "Raise exception for state not overriding main\n" }, { "from": "human", "value": "import time\nimport transitions\n\nfrom panoptes.utils.logger import has_logger\n\n\n@has_logger\nclass PanState(transitions.State):\n\n \"\"\" Base class for PANOPTES transitions \"...
python
chosen
[ { "from": "system", "value": "Allow governing templatetag to be called with a Statement object\n" }, { "from": "human", "value": "from django import template\n\nregister = template.Library()\n\n@register.filter(name='governing')\ndef governing(party, date):\n return party.is_governing(date)\n...
python
chosen
[ { "from": "system", "value": "Remove code which should never have made it in\n" }, { "from": "human", "value": "\"\"\"\nThis module implements python classes which inherit from\nand extend the functionality of the ROOT canvas classes.\n\"\"\"\n\nimport ctypes, ctypes.util\nctypes.cdll.LoadLibrar...
python
chosen
[ { "from": "system", "value": "Drop support for Python 2.6\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import with_statement\nimpor...
python
chosen
[ { "from": "system", "value": "[RM-11742] Remove unneeded creation of .conf file\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n" }, { "from": "human", "value": "import pytest\nimport subprocess\n\n\ndef test_help(tmpdir, cli):\n with cli(\n args=...
python
chosen
[ { "from": "system", "value": "Fix bug where ONESTOP_REGISTRY env var was not checked\n" }, { "from": "human", "value": "\"\"\"Read and write Onestop data.\"\"\"\nimport sys\nimport os\nimport glob\nimport json\nimport argparse\nimport urllib\n\nimport mzgeohash\n\nimport util\nimport entities\ni...
python
chosen
[ { "from": "system", "value": "Update function names from dm.py and removed import to configure.py\n" }, { "from": "human", "value": "# outer __init__.py\n\"\"\"\nImplementation of some simple and dumb audio codecs, like Delta Modualtion\n\"\"\"\n\nfrom ssc.aux import pack, unpack\nfrom ssc.dm im...
python
chosen
[ { "from": "system", "value": "Fix datetime fields in Backup and SupportTicket\n\nThis closes #23.\n" }, { "from": "human", "value": "from .. import DerivedBase, Property, Base\n\nclass Backup(DerivedBase):\n api_name = 'backups'\n api_endpoint = '/linode/instances/{linode_id}/backups/{id}'...
python
chosen
[ { "from": "system", "value": "Update to use Node instead of Host\n" }, { "from": "human", "value": "from nanomon import resources\nfrom nanomon import registry\n\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\n\nwebserver_group = resources.MonitoringGroup('webservers', port=80)\nwww...
python
chosen
[ { "from": "system", "value": "Fix find courses page title in bok choy test suite\n" }, { "from": "human", "value": "\"\"\"\nFind courses page (main page of the LMS).\n\"\"\"\n\nfrom bok_choy.page_object import PageObject\nfrom bok_choy.promise import BrokenPromise\nfrom . import BASE_URL\n\n\ncl...
python
chosen
[ { "from": "system", "value": "Use 2to3 for Python 3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(name='natural',\n version='0.1.4',\n description='Convert data to their natural (human-readable) format',\n long_description='''\nExa...
python
chosen
[ { "from": "system", "value": "Update Django requirements for 1.8\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom ez_setup import use_setuptools\nuse_setuptools()\nfrom setuptools import setup, find_packages\n\nsetup(name='django-elect',\n version='0.1',\n description='A simp...
python
chosen
[ { "from": "system", "value": "Remove infinite loop if user is neither native nor verified\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.http import HttpResponseRedirect\n\nDETACH_PATH = '/user/detach'\nACTIVATE_PATH = '/user/activate'\n\nclass DetachMiddleware(...
python
chosen
[ { "from": "human", "value": "Add RefusePickup class (for parsing)\n" }, { "from": "gpt", "value": "from .util import XPathObject\n\n\nclass RefusePickup(XPathObject):\n \"\"\"Defines attribute to XPath specification matching\"\"\"\n\n input_properties = {\n 'success_msg': '//*[@id=\...
python
chosen
[ { "from": "system", "value": "Add in channel value for disabling ansi\n" }, { "from": "human", "value": "###\n# Copyright (c) 2012, spline\n# All rights reserved.\n#\n#\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\nfrom supybot.i18n import PluginInternationalization, ...
python
chosen
[ { "from": "system", "value": "Move EnglishDefaults class out of English\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals\n\nfrom .tokenizer_exceptions import TOKENIZER_EXCEPTIONS\nfrom .tag_map import TAG_MAP\nfrom .stop_words import STOP_WORDS\nfrom .le...
python
chosen
[ { "from": "system", "value": "Fix formatting for the EventSearchForm class.\n" }, { "from": "human", "value": "from django import forms\n\nimport settings\n\nOUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES\nEVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES\n\n\nclass EventSearchForm(forms.Form):...
python
chosen
[ { "from": "system", "value": "Fix issue with wsgi and translations." }, { "from": "human", "value": "from pyramid.httpexceptions import HTTPNotFound\nfrom pyramid.i18n import TranslationString as _\n\ndef get_or_create(session, model, **kw):\n \"\"\" Django's get_or_create function\n\nhttp://...
python
chosen
[ { "from": "system", "value": "Add search_fields = ['question'] to PollAdmin\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom apps.polls.models import Poll, Choice\n\nclass ChoiceInline(admin.TabularInline):\n model = Choice\n extra = 3\n\nclass PollAdmin(admin.Mo...
python
chosen
[ { "from": "system", "value": "Revert \"make REPO.SERVE_* attributes distinct from other attributes (username, password)\"\n\nThis reverts commit 1553f4bae5f315666fac5ad9f6600ba8b076a84b.\n" }, { "from": "human", "value": "class REPO:\n '''Repo attributes'''\n TYPE = 'type'\n\n DIRECTORY...
python
chosen
[ { "from": "system", "value": "Add util for not using os.walk\n" }, { "from": "human", "value": "import os\n# Current directory\n# If you call this from the current directory without abspath,\n# then it will not work since __file__ is a relative path\nos.path.dirname(os.path.abspath(__file__))\n"...
python
chosen
[ { "from": "system", "value": "Update default smart contract addresses\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nUINT64_MAX = 2 ** 64 - 1\nUINT64_MIN = 0\n\nINT64_MAX = 2 ** 63 - 1\nINT64_MIN = -(2 ** 63)\n\nUINT256_MAX = 2 ** 256 - 1\n\n# Deployed to Ropsten revival on 2017-0...
python
chosen
[ { "from": "system", "value": "Update unit tests to match correct behaviour\n" }, { "from": "human", "value": "import os\nimport sys\nimport unittest\nsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nfrom smartbot import events\n\n\nclass TestEvents(unittest.Test...
python
chosen
[ { "from": "system", "value": "Rename the only context processor.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.sites.models import Site\nfrom settings import DeploymentType\n\ndef context_processor(request):\n context = {}\n context['DEPLOYMENT'] ...
python
chosen
[ { "from": "system", "value": "Remove debug printing of doctree during a test\n" }, { "from": "human", "value": "\r\nimport os\r\nfrom xml.etree import ElementTree\r\nfrom utils import with_app, pretty_print_xml\r\n\r\n\r\n#=========================================================================...
python
chosen
[ { "from": "system", "value": "Fix constructor test, since constructor does not append / at the end\n" }, { "from": "human", "value": "import os, sys\nsys.path.append(os.path.abspath('..'))\n\nimport unittest\nfrom mock import patch\nfrom pynexus import api_client\n\nclass NexusTest(unittest.Test...
python
chosen
[ { "from": "system", "value": "Test WSGI start_response is called\n" }, { "from": "human", "value": "import mock\nimport unittest\n\nfrom resto.wsgi import Middleware\n\n\nclass AppTestCase(unittest.TestCase):\n\n def setUp(self):\n self.environ = {\n 'wsgi.version': (1, 0),\...
python
chosen
[ { "from": "system", "value": "Fix deprecation warning in fixture retrieval.\n" }, { "from": "human", "value": "import pytest\n\n\n@pytest.fixture(scope='session', autouse=True)\ndef init_config():\n\t__import__('pmxbot').config = {}\n\n\n@pytest.fixture(params=['mongodb', 'sqlite'])\ndef db_uri(...
python
chosen
[ { "from": "system", "value": "Change interpolation sentinels to prevent collissions with pillar data\n" }, { "from": "human", "value": "#\n# -*- coding: utf-8 -*-\n#\n# This file is part of reclass (http://github.com/madduck/reclass)\n#\n# Copyright © 2007–14 martin f. krafft <madduck@madduck.ne...
python
chosen
[ { "from": "system", "value": "Refactor test to eliminate assertRaises() error with Python 2.6\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom pyparsing import ParseException\nfrom regparser.grammar.atomic import *\n\n\nclass GrammarAtomicTests(TestCase):\n def test_em...
python
chosen
[ { "from": "system", "value": "Test case for monotonically decreasing graphs\n\nGenerate time series data for values that decrease monotonically over\ntime.\n" }, { "from": "human", "value": "from wordgraph.points import Point\nimport wordgraph\n\nEPOCH_START = 1407109280\n\ndef time_values(value...
python
chosen
[ { "from": "system", "value": "Add logging to script test\n" }, { "from": "human", "value": "from gevent import monkey\nmonkey.patch_all() # noqa\nimport sys\nimport time\n\nfrom raiden.network.transport import UDPTransport\nfrom raiden.network.sockfactory import socket_factory\n\n\nclass DummyP...
python
chosen
[ { "from": "system", "value": "Add CCS811 to device factory\n" }, { "from": "human", "value": "from src.Sensors.BME280 import BME280\nfrom src.Sensors.BME680 import BME680\nfrom src.Sensors.DS18B20 import DS18B20\nfrom src.Notification.Subscriber.LED.RGB import RGB\n\n\nclass Factory:\n\n @sta...
python
chosen
[ { "from": "system", "value": "Disable message signing for now\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom celery import Celery\n\n\napp = Celery('aubergine')\napp.config_from_object('aubergine.settings.celeryconfig')\napp.autodiscover_tasks(['aubergine'], re...
python
chosen
[ { "from": "system", "value": "[REF] pstats_print2list: Add print_stats to init file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__author__ = 'Vauxoo'\n__email__ = 'info@vauxoo.com'\n__version__ = '0.1.0'\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfr...
python
chosen
[ { "from": "system", "value": "Rename 'pwd' field in windows shadow.info output\n\nThis makes the field name consistent with the other shadow modules. Note\nthat the passwd field is not used at all in Windows user management, so\nthis is merely a cosmetic change.\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Fix warnings under Python 3\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom ofxparse import OfxParser as op, OfxPrinter\nfrom unittest import TestCase\nfrom os import close, remove\nfrom tempfile import mkstemp\nimport sys\nsys.path...
python
chosen
[ { "from": "system", "value": "Add new function in init\n" }, { "from": "human", "value": "\"\"\"\nBasic Template system for project pinksign,\nsimilar to the template part of PasteScript but without any dependencies.\n\n\"\"\"\n\nfrom .pypinksign import (\n PinkSign, get_npki_path, url_encode...
python
chosen
[ { "from": "system", "value": "ADD try-except to handle import error\n" }, { "from": "human", "value": "import PySide2.QtCore\n\n# Prints PySide2 version\n# e.g. 5.11.1a1\nprint(PySide2.__version__)\n\n# Gets a tuple with each version component\n# e.g. (5, 11, 1, 'a', 1)\nprint(PySide2.__version_...
python
chosen
[ { "from": "system", "value": "Remove unnecessary parameter, fix type detection bug\n" }, { "from": "human", "value": "import logging\nimport time\n\nimport requests\nfrom googleapiclient.errors import HttpError\n\n\n# Number of retries in case of API errors\nNUM_RETRIES = 3\n\n# Delay between re...
python
chosen