conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add reduce() and reload() to disabled builtins\n" }, { "from": "human", "value": "\"\"\"\nThis disables builtin functions (and one exception class) which are removed\nfrom Python 3.3.\n\nThis module is designed to be used like this:\n\n from future import disable...
python
chosen
[ { "from": "system", "value": "Add Tom Hanks in a way that's actually reachable\n" }, { "from": "human", "value": "import re\n\nfrom pal.services.service import Service\nfrom pal.services.service import wrap_response\n\n\nclass JokeService(Service):\n _JOKES = {\n 'open the pod bay door...
python
chosen
[ { "from": "system", "value": "Add release() method to Lock.\n" }, { "from": "human", "value": "import attr\n\n\n@attr.s\nclass Lock:\n\n lock_manager = attr.ib()\n resource = attr.ib()\n id = attr.ib()\n lock_timeout = attr.ib(default=10.0)\n valid = attr.ib(default=False)\n\n ...
python
chosen
[ { "from": "system", "value": "Add a simple test of getavgpdb.\n" }, { "from": "human", "value": "import os\nimport unittest\nimport subprocess\nimport utils\nTOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))\nutils.set_search_paths(TOPDIR)\n\nfrom allosmod.util import check...
python
chosen
[ { "from": "system", "value": "Add args flexibility to event create to match EAS requirements\n" }, { "from": "human", "value": "from inbox.models.account import Account\nfrom inbox.models.event import Event\nfrom inbox.events.actions.backends import module_registry\n\n\ndef create_event(account_...
python
chosen
[ { "from": "system", "value": "Add notifications count to global envar\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\"\"\"Jinja globals module for pybossa-discourse.\"\"\"\n\nfrom flask import Markup, request\n\n\nclass DiscourseGlobals(object):\n \"\"\"A class to implement Disco...
python
chosen
[ { "from": "system", "value": "Update model script to support task database schema\n\n" }, { "from": "human", "value": "class MessageModel:\n def __init__(self, message, duration, creation_date, message_category):\n # We will automatically generate the new id\n self.id = 0\n ...
python
chosen
[ { "from": "system", "value": "Make Benchmark a class, not a namedtuple.\n" }, { "from": "human", "value": "import collections\n\nimport redis\n\nBENCHMARK_FIELDS = [\n 'author', 'author_url', 'date_submitted', 'date_updated',\n 'name', 'summary', 'tags', 'title', 'url'\n]\n\nBenchmark = co...
python
chosen
[ { "from": "system", "value": "tools: Store the depth (d) on the stack and restore when backtracking\n" }, { "from": "human", "value": "# Module:\t__init__\n# Date:\t\t8th November 2008\n# Author:\tJames Mills, prologic at shortcircuit dot net dot au\n\n\"\"\"Circuits Tools\n\ncircuits.tools cont...
python
chosen
[ { "from": "system", "value": "style: Change variables to lower case\n" }, { "from": "human", "value": "import pyrebase\n\n\ndef initialise(FB_API_KEY, project_name):\n config = {\n \"apiKey\": FB_API_KEY,\n \"authDomain\": \"{}.firebaseapp.com\".format(project_name),\n \"databa...
python
chosen
[ { "from": "system", "value": "Fix Capstone installation error on virtualenvs\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom setuptools import setup\nfrom setuptools import find_packages\n\nsetup(\n author = 'Christian Heitman',\n author_email = 'cnheitman@f...
python
chosen
[ { "from": "system", "value": "Add OSF_URL to send_email helper.\n" }, { "from": "human", "value": "from django.core.mail.message import EmailMultiAlternatives\nfrom django.template.loader import get_template\nfrom project.celery import app\nfrom project.settings import EMAIL_FROM_ADDRESS, BASE_U...
python
chosen
[ { "from": "system", "value": "Make the skip apply to any system missing crypt\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Import python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\nimport logging\nimport re\n\n# Import Salt Libs\nimport salt...
python
chosen
[ { "from": "system", "value": "Remove Kalite until Arabic language is available\n" }, { "from": "human", "value": "\"\"\"Bardarash in Kurdistan, Iraq\"\"\"\nfrom .idb_jor_azraq import * # pragma: no flakes\nfrom django.utils.translation import ugettext_lazy as _\n\n\nUSER_FORM_FIELDS = (\n ('...
python
chosen
[ { "from": "system", "value": "Add some more content in tests including with statsmodels.\n" }, { "from": "human", "value": "\"\"\" Run this file to check your python installation.\n\"\"\"\n\ndef test_import_pandas():\n import pandas\n\n\ndef test_pandas_version():\n import pandas\n vers...
python
chosen
[ { "from": "system", "value": "Add CORS header to API responses\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_restful import abort, Api, Resource\n\napp = Flask(\"pre-fixlist\")\napi = Api(app)\n\nclass PrefixListList(Resource):\n\n def get(self):\n # Return a l...
python
chosen
[ { "from": "system", "value": "Read mongo user and passwd from config file\n" }, { "from": "human", "value": "import falcon, json, pymongo\n\n\nMONGO_DB_USER_FILE = '/home/frank/word_cloud-backend/config/mongodb-user'\nmongo_db_user_config = open(MONGO_DB_USER_FILE, 'r').read()\n\n\nuser_name = m...
python
chosen
[ { "from": "system", "value": "Check consultant groups aren't duplicated\n" }, { "from": "human", "value": "from radar.validation.core import Field, Validation, ListField, ValidationError\nfrom radar.validation.meta import MetaValidationMixin\nfrom radar.validation.validators import not_empty, no...
python
chosen
[ { "from": "system", "value": "Remove repetitive getMessage calls in KillProcesshandler\n" }, { "from": "human", "value": "import sys\nimport os\nfrom logging import Handler as LoggingHandler\n\n\nclass KillProcessHandler(LoggingHandler):\n\n @profile\n def emit(self, record):\n if r...
python
chosen
[ { "from": "system", "value": "Add a basic test for irange\n\nMake sure `irange` is there, it doesn't return a list, and it acts like\n`range` on some test arguments.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n" }, { "from": "gpt", "value": "#!/...
python
chosen
[ { "from": "system", "value": "conan: Copy find modules to root of module path\n" }, { "from": "human", "value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.2\"\n\n\nclass CPPCheckTargetCMakeConan(ConanFile):\n name = \"cppcheck-target-...
python
chosen
[ { "from": "system", "value": "Tweak comment about 202 response\n" }, { "from": "human", "value": "\"\"\"Implement a server to check if a contribution is covered by a CLA(s).\"\"\"\nfrom aiohttp import web\n\nfrom . import abc\nfrom . import ContribHost\nfrom . import ServerHost\nfrom . import CL...
python
chosen
[ { "from": "system", "value": "Replace currency full name with currency code.\n" }, { "from": "human", "value": "import moneyed\n\n\nFFXOS_ACTIVITY_NAME = 'Submit FirefoxOS device price'\n\n\ndef get_currency_choices():\n return sorted(((currency, data.name) for currency, data in moneyed.CURRE...
python
chosen
[ { "from": "system", "value": "Add local site-packages to PYTHONPATH.\n\nTo pick up the local version of PyOpenSSL.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom optparse import OptionParser\n\nfrom jinja2 import Template\n\n\nTEMPLATE = open(os.path.join(os.path.dirna...
python
chosen
[ { "from": "system", "value": "Add mpv spawning to qutebrowser\n\nSigned-off-by: Tomas <5fad2aa041dd6f0fec7c9125f282be028fd2d7b0@Tomass-MacBook-Pro.local>\n" }, { "from": "human", "value": "c.fonts.completion.category = \"bold 16pt monospace\"\nc.fonts.completion.entry = \"16pt monospace\"\nc.fon...
python
chosen
[ { "from": "system", "value": "Make the directory if it doesn't exist\n" }, { "from": "human", "value": "import keyczar\nfrom keyczar import keyczart\nimport os\ndirectory = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'keyset')\nif not os.listdir(directory):\n os.makedirs(director...
python
chosen
[ { "from": "system", "value": "Use lxml as a parsing engine for bs4\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nimport requests\n\nfrom bs4 import BeautifulSoup\n\n\ndef main():\n r = requests.get('http://www.whatismyip.com')\n\n soup = BeautifulSoup(r.text)\n\n ip_address =...
python
chosen
[ { "from": "system", "value": "Set default number of articles on page to 16, up from 12.\n" }, { "from": "human", "value": "from django.conf import settings\n\n\nARTICLE_COPYRIGHT = getattr(settings, 'NEWSROOM_ARTICLE_COPYRIGHT', \"\")\nARTICLES_PER_PAGE = getattr(settings, 'NEWSROOM_ARTICLES_PER...
python
chosen
[ { "from": "system", "value": "Update RAM per 2021-06-10 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom troposphere import Tags\n\nfrom . import AWSObject\nfrom .validators im...
python
chosen
[ { "from": "system", "value": "Fix URL patterns for different Django versions.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\ntry:\n from django.conf.urls import patterns, url\nexcept ImportError:\n from django.conf.urls.defaults import patterns, url\n\n\nurlp...
python
chosen
[ { "from": "system", "value": "Remove use of assert statements since this does not conform to general best practice.\n\nThis is unfortunate, because the code is much more verbose than before and NOT as clear.\n" }, { "from": "human", "value": "\"\"\"\nFunctions related to HTTP Basic Authorization...
python
chosen
[ { "from": "system", "value": "Add more basic plotting tests\n" }, { "from": "human", "value": "from nose.tools import assert_less\nfrom nose.tools import assert_greater_equal\nimport os.path\nimport numpy as np\n\nfrom nose import SkipTest\n\nfrom sklearn import datasets\n\nimport umap\nimport u...
python
chosen
[ { "from": "system", "value": "Update docstring and expand doctests.\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\n\nimport functools\nimport collections\n\ndef save_method_args(method):\n \"\"\"\n Wrap a method such that when i...
python
chosen
[ { "from": "system", "value": "Print a quit message when shutting down a bot\n" }, { "from": "human", "value": "from twisted.internet import reactor\nfrom Hubbot import Hubbot, HubbotFactory\nimport GlobalVars\n\nclass BotHandler:\n botfactories = {}\n\n def __init__(self):\n for (se...
python
chosen
[ { "from": "system", "value": "Add tag to downloaders test so it is actually run.\n" }, { "from": "human", "value": "import os\n\nfrom django.test import TestCase, tag\nfrom typing import List\nfrom unittest.mock import patch, call\nfrom urllib.error import URLError\n\nfrom data_refinery_workers....
python
chosen
[ { "from": "system", "value": "Include an override to the default manager to allow geospatial querying.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.gis.db import models\n\nclass Campground(models.Model):\n campground_code = models.CharField(max_leng...
python
chosen
[ { "from": "system", "value": "Add failed management command test\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom useful.tasks import call_management_command\n\n\nclass ManagementCommandTestCase(TestCase):\n \"\"\"Test calling a management command as a Celery task\"...
python
chosen
[ { "from": "system", "value": "Add description attr to Change\n" }, { "from": "human", "value": "import uuid\n\nimport jsonschema\n\nimport changeling.exception\n\n\nclass Change(object):\n\n schema = {\n 'name': 'change',\n 'properties': {\n 'id': {'type': 'string'},\...
python
chosen
[ { "from": "system", "value": "Add BugStats and BugsGrid widgets\n" }, { "from": "human", "value": "from moksha.lib.base import Controller\nfrom moksha.lib.helpers import Category, MokshaApp, Not, not_anonymous, MokshaWidget\nfrom moksha.api.widgets.containers import DashboardContainer\nfrom moks...
python
chosen
[ { "from": "system", "value": "Disable bake for now because it doesn't match rawresult models\n" }, { "from": "human", "value": "from invoke import Collection\nfrom mongoengine import ConnectionError\n\nfrom openelex.settings import init_db\nfrom fetch import fetch\n\nimport archive, cache, datas...
python
chosen
[ { "from": "system", "value": "Update API path, handle updated SubjectGuid\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.conf import settings\nfrom legistar.bills import LegistarAPIBillScraper\nfrom lametro.models import SubjectGuid, Subject\n...
python
chosen
[ { "from": "system", "value": "Fix in error when analyze directories without duplicates\n" }, { "from": "human", "value": "import os\nfrom threading import Thread\n\ndef _delete(path: str, src: str, link: bool):\n\tos.remove(path)\n\tif link:\n\t\tos.symlink(src, path)\n\ndef manager_files(paths,...
python
chosen
[ { "from": "system", "value": "Add needs to block so the queue doesnt end up full\n" }, { "from": "human", "value": "from collections import defaultdict\nfrom Queue import Queue\nfrom threading import Thread\nimport thread\n\n_results = defaultdict(list)\n\nclass Worker(Thread):\n \"\"\"Thread...
python
chosen
[ { "from": "system", "value": "Fix create action for key value pair\n" }, { "from": "human", "value": "from st2actions.runners.pythonrunner import Action\nfrom st2client.client import Client\nfrom st2client.models.datastore import KeyValuePair\n\n\nclass KVPAction(Action):\n\n def run(self, ke...
python
chosen
[ { "from": "system", "value": "Send data in trackChecker callbacks\n" }, { "from": "human", "value": "from threading import Timer\nfrom . import track\n\n_listeners = []\n\nclass TrackChecker():\n\tdef __init__(self, interval = 5):\n\t\tself.listeners = []\n\t\tself.CHECK_INTERVAL = interval\n\t\...
python
chosen
[ { "from": "system", "value": "Make signup not require token in API\n" }, { "from": "human", "value": "from rest_framework import viewsets, status\nfrom rest_framework.authtoken.models import Token\nfrom rest_framework.decorators import detail_route\nfrom rest_framework.response import Response\n...
python
chosen
[ { "from": "system", "value": "Fix order of operations issues\n" }, { "from": "human", "value": "__version__ = '0.10.0'\nversion = __version__\n\nfrom rabbitpy.connection import Connection\nfrom rabbitpy.exchange import Exchange\nfrom rabbitpy.message import Message\nfrom rabbitpy.amqp_queue impo...
python
chosen
[ { "from": "system", "value": "Add ovp_core_0011 migration as dependency for ovp_organizations_0023\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2017-06-27 02:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nim...
python
chosen
[ { "from": "system", "value": "Release: Copy created MSI to dedicated folder.\n\n* The \"dist\" folder is erased each time and we determine the result\n name from being the only MSI file.\n" }, { "from": "human", "value": "# Copyright 2017, Kay Hayen, mailto:kay.hayen@gmail.com\n#\n# Par...
python
chosen
[ { "from": "system", "value": "Use SimpleCache instead of Filesystemcache as it can cause errors due to use of different pickle versions.\n" }, { "from": "human", "value": "import os\nimport tempfile\n\n# SERVER CONFIGURATION\n\nSERVER_HOST = \"127.0.0.1\"\nSERVER_PORT = 5000\n\n# SSL config: pat...
python
chosen
[ { "from": "system", "value": "Check of repo was pulled\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\nimport git\n\n\nclass PullPush:\n\n def __init__(self, repo_dir):\n self.repo_dir = repo_dir\n self.repo = None\n\n def pull(self, source_repo):\n \"\"...
python
chosen
[ { "from": "system", "value": "Make easy_run better by taking the generator from coroutines\n" }, { "from": "human", "value": "from urllib.parse import urljoin\nimport time\nimport asyncio\nfrom typing import Any\nfrom typing import Callable\n\n\nTRELLO_URL_BASE = 'https://api.trello.com/1/'\n\n\...
python
chosen
[ { "from": "system", "value": "Add random projection matrix generation and random projection.\n" }, { "from": "human", "value": "\"\"\"\nRandom projection, Assignment 1c\n\"\"\"\n" }, { "from": "gpt", "value": "\"\"\"\nRandom projection, Assignment 1c\n\"\"\"\nimport numpy as np\nimpo...
python
chosen
[ { "from": "system", "value": "Fix method to use quote, not quote_plus\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\ntry:\n from urllib import quote_plus\nexcept ImportError:\n from urllib.parse import quote_plus\n\n\ndef urlify(string):\n \"\"\" ...
python
chosen
[ { "from": "system", "value": "Return the whole user in successful login\n" }, { "from": "human", "value": "from collections import namedtuple\n\nfrom flask import Blueprint, request, jsonify\nfrom flask_jwt_extended import jwt_required, get_jwt_identity\n\nfrom .models import User\nfrom .errors ...
python
chosen
[ { "from": "system", "value": "Add author name and body to the weblog RSS feed.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.contrib.syndication.views import Feed\nfrom .models import Entry\n\nclass WeblogEntryFeed(Feed):\n title = \"The Django weblo...
python
chosen
[ { "from": "system", "value": "Split send_message out in to _send_message to reuse functionality later\n" }, { "from": "human", "value": "import requests\n\nfrom .error import PushoverCompleteError\n\nclass PushoverAPI(object):\n def __init__(self, token):\n self.token = token\n\n de...
python
chosen
[ { "from": "system", "value": "Test for sequence of chords\n" }, { "from": "human", "value": "import unittest\nimport tempfile\nfrom pyknon.MidiFile import MIDIFile\nfrom pyknon.genmidi import Midi, MidiError\nfrom pyknon.music import NoteSeq, Note\n\n\nclass TestMidi(unittest.TestCase):\n def...
python
chosen
[ { "from": "system", "value": "Update eval kernel to use python magic.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nfrom jupyter_kernel import MagicKernel\nimport os\n\nclass EvalKernel(MagicKernel):\n implementation = 'Eval'\n implementation_version = '1.0'\n...
python
chosen
[ { "from": "system", "value": "Remove generate error page from admin site\n" }, { "from": "human", "value": "from jingo import register\n\nfrom olympia.amo.urlresolvers import reverse\n\n\n@register.function\ndef admin_site_links():\n return {\n 'addons': [\n ('Search for add...
python
chosen
[ { "from": "system", "value": "Check that fullpath is a regular file before continuing\n" }, { "from": "human", "value": "# This file is part of the File Deduper project. It is subject to\n# the the revised 3-clause BSD license terms as set out in the LICENSE\n# file found in the top-level direct...
python
chosen
[ { "from": "system", "value": "Add post save signal for user creation\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nSTANDARD_EMAIL = \"anonymous@readthedocs.org\"\n\nclass UserProfile (models.Model):\n \"\"\"Additional informati...
python
chosen
[ { "from": "system", "value": "Add loggedin keyword to adzerk Ads.\n" }, { "from": "human", "value": "from urllib import quote\n\nfrom pylons import c, g\n\nfrom r2.lib.pages import Ads as BaseAds\nfrom r2.models.subreddit import DefaultSR\n\n\nFRONTPAGE_NAME = \"-reddit.com\"\n\nclass Ads(BaseAd...
python
chosen
[ { "from": "system", "value": "[FIX] website_sale_management: Fix auto_install typo in manifest\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n{\n 'name': 'Website Sale - Sale Management',\n 'version': '1.0',\n 'category': 'Website',\n 'description': \"\"\"\nDisplay ord...
python
chosen
[ { "from": "system", "value": "Use django 3 to make migration\n" }, { "from": "human", "value": "# Generated by Django 2.2.27 on 2022-04-12 10:28\n\nimport django.contrib.postgres.fields.jsonb\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencie...
python
chosen
[ { "from": "system", "value": "Add code to split month and year into new columns.\n" }, { "from": "human", "value": "\"\"\"\nName: Paul Briant\nDate: 12/11/16\nClass: Introduction to Python\nAssignment: Final Project\n\nDescription:\nCode for Final Project\n\"\"\"\n\nimport pandas\nfrom datetime ...
python
chosen
[ { "from": "system", "value": "Add application variable for the procfile.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n wsgi\n ~~~~\n\n ieee wsgi module\n\"\"\"\n\nfrom werkzeug.serving import run_simple\nfrom werkzeug.wsgi import DispatcherMiddleware\n\nfrom myip....
python
chosen
[ { "from": "system", "value": "Refactoring: Replace loop by dictionary comprehension\n" }, { "from": "human", "value": "from excerptconverter.baseexcerptconverter import BaseExcerptConverter\n\n\nclass ConverterManager:\n @staticmethod\n def converter_configuration():\n export_option...
python
chosen
[ { "from": "system", "value": "Use correct URI for looking up environment resources\n" }, { "from": "human", "value": "\"\"\" Acquia Cloud API server list resource. \"\"\"\n\nfrom .acquialist import AcquiaList\n\n\nclass EnvironmentList(AcquiaList):\n\n \"\"\"Dict of Acquia Cloud API Server re...
python
chosen
[ { "from": "system", "value": "Test does not have to fail under windows\n" }, { "from": "human", "value": "import unittest\nimport sys\n\nfrom sos_notebook.test_utils import sos_kernel\nfrom ipykernel.tests.utils import execute, wait_for_idle, assemble_output\n\n@unittest.skipIf(sys.platform == '...
python
chosen
[ { "from": "system", "value": "Add more informative error message for yank options assertion test.\n" }, { "from": "human", "value": "#!/usr/local/bin/env python\n\n\"\"\"\nTest various utility functions.\n\n\"\"\"\n\n#==============================================================================...
python
chosen
[ { "from": "system", "value": "Fix checking a name against an object\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass SnoRemoteConnect(ModuleData):\n\timplements(IPlug...
python
chosen
[ { "from": "system", "value": "Add TinyDbReader to observers init\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding=utf-8\nfrom __future__ import division, print_function, unicode_literals\n\nfrom sacred.commandline_options import CommandLineOption\n\nfrom sacred.observers.base i...
python
chosen
[ { "from": "system", "value": "Add support for custom user model (Django 1.5+)\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext as _\n\n\nclass AbstractAsset(models.Model):\n name = models.CharField(_(\"Name\"), max_length=255)\n\n ...
python
chosen
[ { "from": "system", "value": "Make sure slug gets updated on date change\n" }, { "from": "human", "value": "\"\"\"Unit tests for events models.\"\"\"\nimport datetime\n\nfrom app.events.factories import EventFactory\nfrom app.events.models import Event\n\n\ndef test_event_factory(db): # noqa: D...
python
chosen
[ { "from": "system", "value": "Clarify work action in AsynchronousMessageSender\n" }, { "from": "human", "value": "from bot.logger.message_sender import IntermediateMessageSender, MessageSender\nfrom bot.multithreading.work import Work\nfrom bot.multithreading.worker import Worker\n\n\nclass Asyn...
python
chosen
[ { "from": "system", "value": "Fix missing message in ValidationError" }, { "from": "human", "value": "from django.contrib.auth import authenticate\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom rest_framework import serializers\n\n\nclass AuthTokenSerializer(serializers.Seriali...
python
chosen
[ { "from": "system", "value": "Use -dev tag for in-dev versions\n" }, { "from": "human", "value": "\"\"\"\nConvert docs to Dash.app's docset format.\n\"\"\"\n\nfrom __future__ import absolute_import, division, print_function\n\n\n__author__ = 'Hynek Schlawack'\n__version__ = '2.0.0'\n__license__ ...
python
chosen
[ { "from": "system", "value": "Test TVTKScene garbage collection and renaming\n" }, { "from": "human", "value": "\"\"\" Tests for the garbage collection of objects in tvtk package.\n\"\"\"\n# Authors: Deepak Surti, Ioannis Tziakos\n# Copyright (c) 2015, Enthought, Inc.\n# License: BSD Style.\n\ni...
python
chosen
[ { "from": "system", "value": "Use FilterSpec instead of GenericSpec in sample_proj\n" }, { "from": "human", "value": "from datafilters.filterform import FilterForm\nfrom datafilters.specs import (GenericSpec, DateFieldFilterSpec,\n GreaterThanFilterSpec, ContainsFilterSpec,\n GreaterThanZe...
python
chosen
[ { "from": "system", "value": "Fix tests remove unneccessary imports\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls import patterns, include, url\nfrom django.views.generic import View\n\n\nurlpatterns = patterns('',\n url(r'foo$', View.as_view(), name=\"fo...
python
chosen
[ { "from": "system", "value": "Change a test name to CamelCase instead of snake, to conform with TFX convention.\n\nPiperOrigin-RevId: 246340014\n" }, { "from": "human", "value": "# Copyright 2019 Google LLC. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License...
python
chosen
[ { "from": "system", "value": "Tweak debugging messages, add comments\n" }, { "from": "human", "value": "import logging\n\nlogger = logging.getLogger('tohu')\n\n\nclass CustomGeneratorMetaV2(type):\n\n def __new__(metacls, cg_name, bases, clsdict):\n logger.debug('[DDD] CustomGeneratorM...
python
chosen
[ { "from": "system", "value": "Adjust rasa shell help test to changes.\n" }, { "from": "human", "value": "from typing import Callable\nfrom _pytest.pytester import RunResult\n\n\ndef test_shell_help(run: Callable[..., RunResult]):\n output = run(\"shell\", \"--help\")\n\n help_text = \"\"\"...
python
chosen
[ { "from": "system", "value": "Fix argument order in BuildAndCompress pseudo-builder\n" }, { "from": "human", "value": "def build_and_compress(env, source, target):\n env.Tool('compactor')\n uncompressed = env.Program('uncompressed', source)\n compressed = env.Compact(\n target = ...
python
chosen
[ { "from": "system", "value": "Update Development Status from Planning to Alpha\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nsetup(\n name='incuna-pigeon',\n\n version='0.0.0',\n\n description='Notification management',\n url='https://github.com/...
python
chosen
[ { "from": "system", "value": "Include LICENSE.txt in the package tarball\n" }, { "from": "human", "value": "from distutils.core import setup\nsetup(\n name = 'sdnotify',\n packages = ['sdnotify'],\n version = '0.3.0',\n description = 'A pure Python implementation of systemd\\'s servi...
python
chosen
[ { "from": "system", "value": "Add the markdown readme to the pip package.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='tfr',\n version='0.1',\n description='Time-frequency reassigned spectrograms',\n url='http://github.com/bzamecnik/tfr',\n a...
python
chosen
[ { "from": "system", "value": "Remove all info pertaining to pygooglechart\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='django-sentry',\n version='.'.join(map(str, __import__('sentry').__version__)),\n author='D...
python
chosen
[ { "from": "system", "value": "Exclude unit tests from install\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name=\"cumulus\",\n version=\"0.1.0\",\n description=\"Girder API endpoints for interacting with cloud providers.\",\n author=\"Chr...
python
chosen
[ { "from": "system", "value": "Remove support for deprecated Python versions.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport io\n\nfrom setuptools import find_packages, setup, Extension\n\n\nwith io.open('README.rst', encoding='utf8') as readme:\n long_description = readme.re...
python
chosen
[ { "from": "system", "value": "Remove download URL since Github doesn't get his act together. Damnit\n\ngit-svn-id: https://django-robots.googlecode.com/svn/trunk@36 12edf5ea-513a-0410-8a8c-37067077e60f\n\ncommitter: leidel <48255722c72bb2e7f7bec0fff5f60dc7fb5357fb@12edf5ea-513a-0410-8a8c-37067077e60f>\n" ...
python
chosen
[ { "from": "system", "value": "Add node specific tag generation\n" }, { "from": "human", "value": "import io\nimport os\n\nimport yaml\n\nfrom solar.extensions import base\n\n\nclass Discovery(base.BaseExtension):\n\n VERSION = '1.0.0'\n ID = 'discovery'\n PROVIDES = ['nodes_resources']\...
python
chosen
[ { "from": "system", "value": "Fix scope used for Cloud Search.\n" }, { "from": "human", "value": "# Copyright 2015 Google Inc. All rights reserved.\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 m...
python
chosen
[ { "from": "system", "value": "Switch from returning a set to returning a list\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\n\n\nfrom xmlrpc2 import client as xmlrpc2\n\n\nclass BaseProcessor(object):\n\n def __init__(self, index, *...
python
chosen
[ { "from": "system", "value": "Fix migrations - drop old domain\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import models, migrations\n\n\ndef update_site_forward(apps, schema_editor):\n ...
python
chosen
[ { "from": "system", "value": "Remove some bug on mysql elements.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom system.DBMysql import connect\nfrom system.ConfigLoader import getCfg\n\ndef loginUser(login, password):\n ''' Try to login a user regardi...
python
chosen
[ { "from": "system", "value": "Create new session on restart\n" }, { "from": "human", "value": "import os\n\nfrom slackbot.bot import respond_to\nfrom slackbot.bot import listen_to\nfrom wit import Wit\n\nfrom wit_actions import actions\n\nwit_client = Wit(\n access_token=os.environ['WIT_A...
python
chosen
[ { "from": "system", "value": "Increment patch number following bugfix." }, { "from": "human", "value": "\"\"\"Main initialization for the WeGovNow extension.\"\"\"\n\nVERSION = (3, 1, 1)\n__version__ = '.'.join(map(str, VERSION))\n\n\ntry:\n from geokey.extensions.base import register\n\n ...
python
chosen
[ { "from": "system", "value": "Add plot legend in the example\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Usage examples\n\n\"\"\"\nfrom __future__ import print_function, division\n\nimport numpy as np\nimport matplotlib.pylab as plt\nimport seaborn as...
python
chosen