conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix beam parse model test\n" }, { "from": "human", "value": "import spacy\nimport pytest\n\n@pytest.mark.models\ndef test_beam_parse():\n nlp = spacy.load('en_core_web_sm')\n doc = nlp(u'Australia is a country', disable=['ner'])\n ents = nlp.entity(doc, bea...
python
chosen
[ { "from": "system", "value": "Test profiles manager filterting method\n" }, { "from": "human", "value": "import json\n\nfrom nose.tools import eq_, raises\nfrom mock import MagicMock, patch\n\nfrom buffer.managers.profiles import Profiles\nfrom buffer.models.profile import PATHS\n\nmocked_respon...
python
chosen
[ { "from": "system", "value": "Support for X-Ten machine IDs\n" }, { "from": "human", "value": "\"\"\" Filesystem utilities\n\"\"\"\nimport contextlib\nimport os\n\nRUN_RE = '\\d{6}_[a-zA-Z\\d]+_\\d{4}_[AB][A-Z\\d]{9}'\n\n@contextlib.contextmanager\ndef chdir(new_dir):\n \"\"\"Context manager ...
python
chosen
[ { "from": "system", "value": "Create simple CLI for the `places` function\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Console script for postalcodes_mexico.\"\"\"\nimport sys\nimport click\n\n\n@click.command()\ndef main(args=None):\n \"\"\"Console script for postalcod...
python
chosen
[ { "from": "system", "value": "Allow retrieval of a random quote\n" }, { "from": "human", "value": "from tastypie.authorization import DjangoAuthorization\nfrom tastypie import fields\nfrom tastypie.resources import ModelResource, ALL_WITH_RELATIONS\nfrom quotations.apps.quotations import models ...
python
chosen
[ { "from": "system", "value": "ADD new exception -> EnvironmentNotFound!\n" }, { "from": "human", "value": "\"\"\"Specific PyGrid exceptions.\"\"\"\n\n\nclass PyGridError(Exception):\n def __init__(self, message):\n super().__init__(message)\n\n\nclass AuthorizationError(PyGridError):\n...
python
chosen
[ { "from": "system", "value": "Fix for Delay warnings when using USB audio (untested)" }, { "from": "human", "value": "#!/usr/bin/env python2\n\n'''\n More complex configuration, to run in addition to 'config.sh'.\n'''\n\nif raw_input('Set USB sound card as default ? [y][N]') in 'y', 'Y', 'yes...
python
chosen
[ { "from": "system", "value": "Add some (inefective) score maximizing attempts\n" }, { "from": "human", "value": "import time\n\nfrom stock_awesome.obj import market\n\n\n\ndef main():\n \"\"\"\n Algorithm: Wait for an ask, then send a fill or kill for the quantity of the ask at the ask\n ...
python
chosen
[ { "from": "system", "value": "Handle a Django deprecation properly.\n\nShould have done this in commit cb4eae7b7.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\" Simple urls for use in testing the gcframe app. \"\"\"\n\nfrom __future__ import unicode_literals\n\n# The defaul...
python
chosen
[ { "from": "system", "value": "Make steps and out arguments optional and add defaults\n" }, { "from": "human", "value": "from argparse import ArgumentParser\nfrom matplotlib import pyplot as plt\nfrom graph import Greengraph\n\ndef process():\n parser = ArgumentParser(\n description=\"P...
python
chosen
[ { "from": "system", "value": "Validate that we can translate a NEWOBJECT into a FETCHOBJECT\n" }, { "from": "human", "value": "import os\nimport select\n\nimport groundstation.fs_watcher as fs_watcher\nfrom groundstation.peer_socket import PeerSocket\n\nfrom integration_fixture import StationInt...
python
chosen
[ { "from": "system", "value": "Fix imports for Python 2 & 3 compatibility\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Top-level package for judicious.\"\"\"\n\n__author__ = \"\"\"Jordan W. Suchow\"\"\"\n__email__ = 'jwsuchow@gmail.com'\n__version__ = '0.1.0'\n\nfrom judici...
python
chosen
[ { "from": "system", "value": "Add the new domains db\n" }, { "from": "human", "value": "from corehq.preindex import ExtraPreindexPlugin\nfrom django.conf import settings\n\nExtraPreindexPlugin.register('domain', __file__, (\n settings.NEW_USERS_GROUPS_DB, settings.NEW_FIXTURES_DB, 'meta'))\n"...
python
chosen
[ { "from": "system", "value": "Make sure AVAILABLE_LAYOUTS is a tuple\n\nThe .keys() function is a generator in Python 3.\n" }, { "from": "human", "value": "import inspect\n\nfrom .random import random\nfrom .circular import circular\nfrom .force_directed import fruchterman_reingold\n\n\n_layout_...
python
chosen
[ { "from": "system", "value": "Move Sites to the settings menu (and use decorator syntax for hooks)\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.core import urlresolvers\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom wagtail.wagtailco...
python
chosen
[ { "from": "system", "value": "Improve dispatch of actions in main\n" }, { "from": "human", "value": "\nimport logging\n\nfrom version import __version__\n\nlogger = logging.getLogger(__name__)\nlogger.debug('Loading %s ver %s' % (__name__, __version__))\n\n\n# Actions represents the available te...
python
chosen
[ { "from": "system", "value": "CUDA: Reorder FloatModel checks in ascending order\n" }, { "from": "human", "value": "from llvmlite import ir\n\nfrom numba.core.datamodel.registry import register_default\nfrom numba.core.extending import register_model, models\nfrom numba.core import types\nfrom n...
python
chosen
[ { "from": "system", "value": "Add factory for the Provider model\n" }, { "from": "human", "value": "\"\"\"Factories for the silver app.\"\"\"\n# import factory\n\n# from .. import models\n" }, { "from": "gpt", "value": "import factory\n\nfrom silver.models import Provider\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Save temporary pictures to local directory\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom pysnap import Snapchat\nimport secrets\n\ns = Snapchat()\ns.login(secrets.USERNAME, secrets.PASSWORD)\n\nfriends_to_add = [friend['name'] for friend in s.get_...
python
chosen
[ { "from": "system", "value": "Remove deprecation warning by using new style item pipeline definition\n" }, { "from": "human", "value": "SPIDER_MANAGER_CLASS = 'slybot.spidermanager.SlybotSpiderManager'\nEXTENSIONS = {'slybot.closespider.SlybotCloseSpider': 1}\nITEM_PIPELINES = ['slybot.dupefilte...
python
chosen
[ { "from": "system", "value": "Set ComboBox class default ID to wx.ID_ANY" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n## \\package custom.combo\n\n# MIT licensing\n# See: LICENSE.txt\n\n\nimport wx\nfrom wx.combo import OwnerDrawnComboBox\n\n\nclass ComboBox(OwnerDrawnComboBox):\n...
python
chosen
[ { "from": "system", "value": "Change call method for Python2.7\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom apscheduler.schedulers.blocking import BlockingScheduler\nimport logging\nimport subprocess\n\nlogging.basicConfig()\nscheduler = BlockingScheduler()\n\n\...
python
chosen
[ { "from": "system", "value": "Use IRC Nicks instead of real names.\n" }, { "from": "human", "value": "import random\nfrom base import BaseMatcher\n\n\nclass VolunteerMatcher(BaseMatcher):\n dev_text = \"volunteer someone\"\n all_text = \"volunteer a dev\"\n dev_candidates = ['Steve', 'A...
python
chosen
[ { "from": "system", "value": "Order similar artist results properly\n" }, { "from": "human", "value": "import echonest\nfrom artists.models import Artist\nfrom echonest.models import SimilarResponse\nfrom users.models import User\nfrom .models import (GeneralArtist, UserSimilarity, Similarity,\n...
python
chosen
[ { "from": "system", "value": "Fix typo/bug in validate_params function\n" }, { "from": "human", "value": "from django import template\n\nclass InvalidParamsError(template.TemplateSyntaxError):\n ''' Custom exception class to distinguish usual TemplateSyntaxErrors \n and validation erro...
python
chosen
[ { "from": "system", "value": "Write a slightly less dumb protocol?\n" }, { "from": "human", "value": "from twisted.internet import reactor, protocol\n\nfrom hubbot.moduleinterface import ModuleInterface\n\n\nclass Echo(protocol.Protocol):\n \"\"\"This is just about the simplest possible proto...
python
chosen
[ { "from": "system", "value": "Add bed_type to cnes_establishment model\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, String, func\nfrom app import db\n\nclass CnesBed(db.Model):\n __tablename__ = 'cnes_bed'\n year = Column(Integer, primary_key=True)\n ...
python
chosen
[ { "from": "system", "value": "Refactor Expr object to be more self contained\n" }, { "from": "human", "value": "import re\n\n\nclass Expr(object):\n def __init__(self, name, regex):\n self.name = name\n self.regex = regex\n\n def on_match(self, string):\n return [self....
python
chosen
[ { "from": "human", "value": "Add test for notify dataset/create\n" }, { "from": "gpt", "value": "from mock import patch\n\nimport unittest\n\nimport ckan.model as model\nfrom ckan.model.domain_object import DomainObjectOperation\n\nfrom ckanext.syndicate.plugin import SyndicatePlugin\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Implement corrupted Mukla, Hogger and Nat\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n" }, { "from": "gpt", "value": "from ..utils import *\n\n\n##\n# Minions\n\nclass OG_122:\n\t\"Mukla, Tyrant of the Vale\"\n\tplay = Gi...
python
chosen
[ { "from": "system", "value": "Update command to take file argument\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom huts.utils import export\n\nclass Command(BaseCommand):\n args = ''\n help = 'Dumps the huts, agencies, and regions in the json ap...
python
chosen
[ { "from": "system", "value": "Validate returned content-type is application/json\n" }, { "from": "human", "value": "import logging\n\nimport hypothesis\n\nfrom client import SwaggerClient\nfrom templates import APITemplate\nfrom strategies import hypothesize_parameters\n\n\nlog = logging.getLogg...
python
chosen
[ { "from": "system", "value": "Convert tuple to list for concatination\n" }, { "from": "human", "value": "import os\nimport subprocess\n\ndef install(*packages):\n env = os.environ.copy()\n env['DEBIAN_FRONTEND'] = \"noninteractive\"\n subprocess.call(['sudo', '-E', 'apt-get', '-y', 'ins...
python
chosen
[ { "from": "system", "value": "Allow proxy minions to load static grains\n\nAdd the `__proxyenabled__` global var so the extra grains are loaded.\nInside the `config` function of the extra grains check if the minion\nis a proxy, then try loading from <conf_file>/proxy.d/<proxy id>/grains.\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Allow render_fields to override the default template.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import, unicode_literals\nimport itertools\nfrom .util import trim\n\ndef render(item, **field...
python
chosen
[ { "from": "system", "value": "Test cases for push with export flag\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom couchapp import commands\nfrom couchapp.errors import AppError\n\nfrom mock import Mock, patch\nfrom nose.tools import raises\n\n\n@patch('couchapp.commands.docum...
python
chosen
[ { "from": "system", "value": "Configure TEMPLATES in test settings.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom os.path import dirname\n\nMIU_TEST_ROOT = dirname(__file__)\n\nINSTALLED_APPS = [\n \"django.contrib.auth\",\n \"django.contrib.contenttype...
python
chosen
[ { "from": "system", "value": "Make Selector.scope test more rigorous\n" }, { "from": "human", "value": "from contextlib import contextmanager\nfrom scell import Selector\nfrom pytest import raises, fixture\n\n\ndef test_select(selector):\n res = list(selector.select())\n assert res\n fo...
python
chosen
[ { "from": "system", "value": "Refactor GSI, LSI to use base Index class\n" }, { "from": "human", "value": "missing = object()\n\n\nclass GlobalSecondaryIndex(object):\n def __init__(self, hash_key=None, range_key=None,\n write_units=1, read_units=1, name=missing):\n sel...
python
chosen
[ { "from": "system", "value": "Remove updated at while comparing.\n" }, { "from": "human", "value": "from lib import BaseTest\n\n\nclass ShowMirror1Test(BaseTest):\n \"\"\"\n show mirror: regular mirror\n \"\"\"\n fixtureCmds = [\"aptly mirror create mirror1 http://mirror.yandex.ru/de...
python
chosen
[ { "from": "system", "value": "Fix adapter debugging on Linux.\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport sys\nif 'darwin' in sys.platform:\n sys.path.append('/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python')\nsys.path.append('.')\n\nimport a...
python
chosen
[ { "from": "system", "value": "Add newsig.c as a dependency to sigtools module.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n\n config = Configuration('signal', parent_p...
python
chosen
[ { "from": "system", "value": "Add N0GSG DMRX MostHeard to AWS Lambda function\n" }, { "from": "human", "value": "#!/usr/bin/env python2\nfrom StringIO import StringIO\n\nimport boto3\n\nfrom dmr_marc_users_cs750 import (\n get_users, get_groups,\n write_contacts_csv,\n write_contacts_xl...
python
chosen
[ { "from": "system", "value": "Implement creating arguments for multiple strings\n" }, { "from": "human", "value": "import argparse\n\nimport yaml\n\n\ndef parse_arguments_based_on_yaml(yaml_file):\n with open(yaml_file) as f:\n yaml_data = yaml.load(f)\n\n # to start with, support o...
python
chosen
[ { "from": "system", "value": "Increment patch version to 0.6.2\n" }, { "from": "human", "value": "\"\"\"yolk\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.6.1'\n" }, { "from": "gpt", "value": "\"\"\"yolk\n\nAuthor: Rob Cakebread <cakebr...
python
chosen
[ { "from": "system", "value": "Add documentation to the default view\n\ngit-svn-id: 54fea250f97f2a4e12c6f7a610b8f07cb4c107b4@292 439a9e5f-3f3e-0410-bc46-71226ad0111b\n" }, { "from": "human", "value": "from django.http import Http404\nfrom django.shortcuts import get_object_or_404\nfrom django.con...
python
chosen
[ { "from": "system", "value": "Update dascham with pygame GO button load\n" }, { "from": "human", "value": "# dashcam.py\n# A Raspberry Pi powered, GPS enabled, 3D printed bicycle dashcam\n# By Matthew Timmons-Brown, The Raspberry Pi Guy\n\nimport pygame\nimport picamera\nimport os\n\nos.putenv('...
python
chosen
[ { "from": "system", "value": "Rename Source's get_episodes_for() method to fetch()\n" }, { "from": "human", "value": "from abc import ABC, abstractmethod\n\n\nclass TVShowNotFound(Exception):\n \"\"\" Raised when a reference does not match any TV Show available \"\"\"\n\n\nclass EpisodeSource...
python
chosen
[ { "from": "system", "value": "Use Werkzeug's safe_str_cmp() instead of hmac.compare_digest()\n\nWerkzeug will use the latter on Python >2.7.7, and provides a fallback\nfor older Python versions.\n" }, { "from": "human", "value": "import hmac\n\nimport bcrypt\n\nfrom sqlalchemy.schema import Colu...
python
chosen
[ { "from": "system", "value": "Add \"until\" attribute to list handled by hook\n\nTaskWarrior 2.5.1 (and possibly earlier versions) does not shift the\n\"until\" attribute appropriately during recurrence. This hook provides a\nworkaround for that.\n\nFixes [#6](https://github.com/tbabej/task.shift-recurrence...
python
chosen
[ { "from": "system", "value": "Fix python3 compatibility issues with doc fix\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim: set fileencoding=utf-8 :\n# Andre Anjos <andre.anjos@idiap.ch>\n# Fri 20 Sep 14:45:01 2013\n\n\"\"\"Blitz++ Array bindings for Python\"\"\"\n\nfrom ._libra...
python
chosen
[ { "from": "system", "value": "Break the loop at the first gap\n" }, { "from": "human", "value": "ranges = []\nfor line in open('input.txt', 'r'):\n ranges.append(tuple(map(int, line.split('-'))))\nranges.sort()\n\nlowest = 0\nfor l, r in ranges:\n if l <= lowest <= r:\n lowest = r +...
python
chosen
[ { "from": "system", "value": "Remove logger from ggrc init\n\nThe logger from ggrc init is never used and should be removed.\n" }, { "from": "human", "value": "\n# Copyright (C) 2016 Google Inc., authors, and contributors\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE ...
python
chosen
[ { "from": "system", "value": "Add task for pushing code with rsync\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom fabric.api import env, run, sudo, task\nfrom fabric.context_managers import cd, prefix\n\nenv.use_ssh_config = True\nhome = '~/jarvis2'\n\n\n@task\ndef pull_code():...
python
chosen
[ { "from": "system", "value": "Fix the phone number thing\n" }, { "from": "human", "value": "from django.contrib.gis import serializers\nfrom rest_framework import serializers\n\nfrom people.models import Customer\nfrom people.models import InternalUser\n\n\nclass CustomerSerializer(serializers.M...
python
chosen
[ { "from": "system", "value": "Add missing translations on API model\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport uuid\nimport hmac\n\nfrom django.db import models\nfrom django.conf import settings\nfrom django.contrib.auth import get_user_model\n\ntry...
python
chosen
[ { "from": "system", "value": "Add Disqus and Google Analytics to web site\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- #\nfrom __future__ import unicode_literals\n\n# This file is only used if you use `make publish` or\n# explicitly specify it as your config ...
python
chosen
[ { "from": "system", "value": "Add backwards compatible CharLCD wrapper\n" }, { "from": "human", "value": "from .common import Alignment, CursorMode, ShiftMode, BacklightMode\nfrom .contextmanagers import cursor, cleared\n" }, { "from": "gpt", "value": "import warnings\n\nfrom .common...
python
chosen
[ { "from": "system", "value": "Add ORM freeze thing to SystemKeyValue migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom south.db import db\nfrom south.v2 import SchemaMigration\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n db.rename_table...
python
chosen
[ { "from": "system", "value": "Write the nowplaying movie id to file\n" }, { "from": "human", "value": "#!/usr/bin/python\n#coding: utf-8\nimport requests\nimport re\nif __name__==\"__main__\":\n\tpage = requests.get('https://movie.douban.com/nowplaying/beijing/')\n\tcontent=page.text.encode(\"ut...
python
chosen
[ { "from": "system", "value": "Add support for QTest with PySide" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright © 2014-2015 Colin Duquesnoy\n# Copyright © 2009- The Spyder Developmet Team\n#\n# Licensed under the terms of the MIT License\n# (see LICENSE.txt for details)\...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Remove queue declaration (EAFP)\"\"\n\nThis reverts commit 2dd5a5b422d8c1598672ea9470aee655eca3c49d.\n" }, { "from": "human", "value": "import amqp\nfrom contextlib import closing\n\n\ndef __get_channel(connection):\n return connection.channel()...
python
chosen
[ { "from": "system", "value": "Revert \"Removed Javascript from Markdown by adding display priority to def config.\"\n\nThis reverts commit 58e05f9625c60f8deba9ddf1c74dba73e8ea7dd1.\n" }, { "from": "human", "value": "\"\"\"Markdown Exporter class\"\"\"\n\n#----------------------------------------...
python
chosen
[ { "from": "system", "value": "Fix: Add encoding line for Python 3\n" }, { "from": "human", "value": "import sys\nimport os\nimport operator\nsys.path.insert(1, os.path.abspath('..'))\nfrom wsinfo import Info\n\ncnt = 0\nmax_cnt = 100\nservers = {}\n\nwith open(\"urls.txt\", \"r\") as f:\n for...
python
chosen
[ { "from": "system", "value": "Use bytes to check Flask response\n\nThe Flask response is a byte (not Unicode)\nstring, so we should explicitly compare it\nto a bytes constant so the test works in\nboth Python 2 and Python 3.\n" }, { "from": "human", "value": "import unittest\nimport saliweb.test...
python
chosen
[ { "from": "system", "value": "Update form field to EmailField not CharField\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom django.core import validators\nfrom .validators import validate_disposable_email\n\n\nclass DisposableEmailField(forms.CharFiel...
python
chosen
[ { "from": "system", "value": "Add first structure of the script\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n#\n# Author: Massimo Menichinelli\n# Homepage: http://www.openp2pdesign.org\n# License: MIT\n#\n\nimport xlsxwriter\n\nworkbook = xlsxwriter.Workbook('FabLab-BusinessPlan...
python
chosen
[ { "from": "system", "value": "Update project downloader to do diffs before overwriting\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\nfrom bs4 import BeautifulSoup\nimport requests\n\nr = requests.get(\"https://projects.archlinux.org/\")\nsoup = BeautifulSoup(r.text)\nrepos = soup.sele...
python
chosen
[ { "from": "system", "value": "Add docstring to online checker\n" }, { "from": "human", "value": "import http.client\n\n\ndef __is_online(domain, sub_path, response_status, response_reason):\n conn = http.client.HTTPSConnection(domain, timeout=1)\n conn.request(\"HEAD\", sub_path)\n resp...
python
chosen
[ { "from": "system", "value": "Remove work around for NullHandler\n\nlogging module added NullHandler in Python 2.7, we have\ndropped Python 2.6 support now, so don't need the work around\nany more.\n\nChange-Id: Ib6fdbc2f92cd66f4846243221e696f1b1fa712df\n" }, { "from": "human", "value": "# flake...
python
chosen
[ { "from": "system", "value": "Use Solr for testing with Travis CI\n" }, { "from": "human", "value": "from defaults import *\n\nDATABASES = {\n 'default': {\n #'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'ENGINE': 'django.contrib.gis.db.backends.postgis',\n# 'ENG...
python
chosen
[ { "from": "system", "value": "Fix view count cutoff for YT\n" }, { "from": "human", "value": "from gdata.youtube.service import YouTubeService, YouTubeVideoQuery\nfrom django.utils.encoding import smart_str\nimport re\n\nclass YoutubeMusic:\n def __init__(self):\n self.service = YouTub...
python
chosen
[ { "from": "system", "value": "acronym: Remove test with mixed-case word\n\nsee: https://github.com/exercism/x-common/pull/788\n" }, { "from": "human", "value": "import unittest\n\nfrom acronym import abbreviate\n\n\n# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0\n\ncl...
python
chosen
[ { "from": "system", "value": "Check the parameters for the Join command correctly" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom heufybot.moduleinterface import IBotModule\nfrom heufybot.modules.commandinterface import BotCommand\nfrom zope.interface import implements\...
python
chosen
[ { "from": "system", "value": "Mark master as development version\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport celery\n\nfrom tornado import ioloop\n\nfrom .connection import ConnectionPool\nfrom .producer import NonBlockingTaskProducer\nfrom .result import ...
python
chosen
[ { "from": "system", "value": "Fix the things that are broken\n" }, { "from": "human", "value": "#######################\n# PRODUCTION SETTINGS #\n#######################\n\nfrom os import environ\n\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom .base import *\n\nDEBUG = False\n...
python
chosen
[ { "from": "system", "value": "Validate sub and jti claims\n" }, { "from": "human", "value": "\n__version__ = \"0.3.0\"\n__author__ = 'Michael Davis'\n__license__ = 'MIT'\n__copyright__ = 'Copyright 2015 Michael Davis'\n\n\nfrom .exceptions import JOSEError\nfrom .exceptions import JWSError\nfrom...
python
chosen
[ { "from": "system", "value": "Add width and height to pixbuf_from_string() and scale the image if any of them are set" }, { "from": "human", "value": "#\n# Kiwi: a Framework and Enhanced Widgets for Python\n#\n# Copyright (C) 2012 Async Open Source\n#\n# This library is free software; you can re...
python
chosen
[ { "from": "system", "value": "Use common object for csvio calls\n" }, { "from": "human", "value": "\"\"\"\nHacker News Top:\n -Get top stories from Hacker News' official API\n -Record all users who comment on those stories\n\nAuthor: Rylan Santinon\n\"\"\"\n\nfrom api_connector import *\nfrom ...
python
chosen
[ { "from": "system", "value": "Change allowed hosts to include server ip\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .base import *\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = False\n\nALLOWED_HOSTS = ['YOUR_DOMAIN(S)_GO_HERE']\n\nCORS_ORIGIN...
python
chosen
[ { "from": "system", "value": "Add tone generation arguments to gen_tone\n" }, { "from": "human", "value": "import cProfile\nfrom demodulate.cfg import *\nfrom demodulate.detect_tone import *\nfrom demodulate.element_resolve import *\nfrom gen_test import *\n\n\n\nif __name__ == \"__main__\":\n\t...
python
chosen
[ { "from": "system", "value": "Fix bug in module selection.\n" }, { "from": "human", "value": "import lib.collect.config as config\n\nif config.BACKEND == 'dynamodb':\n import lib.collect.backends.dymamodb as api\nelse:\n import lib.collect.backends.localfs as api\n" }, { "from": "g...
python
chosen
[ { "from": "system", "value": "Disable REST Upload by default\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# thumbor imaging service\n# https://github.com/globocom/thumbor/wiki\n\n# Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-licen...
python
chosen
[ { "from": "system", "value": "Fix eightball method response grammar\n\n" }, { "from": "human", "value": "\nimport random\n\ndef eightball():\n\treturn random.choice((\"It is certain\", \"It is decidedly so\", \"Without a doubt\", \"Yes, definitely\", \n\t\t\t\t\t\t\t\"You may rely on it\", \"As ...
python
chosen
[ { "from": "system", "value": "Fix event teams parser for new format\n" }, { "from": "human", "value": "import re\n\nfrom BeautifulSoup import BeautifulSoup\n\nfrom datafeeds.parser_base import ParserBase\n\n\nclass UsfirstEventTeamsParser(ParserBase):\n @classmethod\n def parse(self, html)...
python
chosen
[ { "from": "system", "value": "[fix] Use production settings in Heroku\n" }, { "from": "human", "value": "import os\n\nif os.getenv('OPENSHIFT_REPO_DIR'):\n from .staging import *\nelif os.getenv('TRAVIS_CI'):\n from .testing import *\nelse:\n from .development import *" }, { "fr...
python
chosen
[ { "from": "system", "value": "Add hr_security.xml file entry in update_xml section\n\nbzr revid: mga@tinyerp.com-d69c221f3647e67487af7bd1c349e27cdbbbe857" }, { "from": "human", "value": "{\n\t\"name\" : \"Human Resources\",\n\t\"version\" : \"1.0\",\n\t\"author\" : \"Tiny\",\n\t\"category\" : \"...
python
chosen
[ { "from": "system", "value": "Increase timeout of clean_duplicate_nodes job\n" }, { "from": "human", "value": "import datetime\nimport sys\n\nimport django_rq\nfrom django.apps import AppConfig\n\n\nclass TheFederationConfig(AppConfig):\n name = \"thefederation\"\n verbose_name = \"The Fed...
python
chosen
[ { "from": "system", "value": "Fix attribute from model_class to model issue.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.contrib.auth.decorators import login_required\n\nfrom django_auto_filter.views_django_auto_filter_new import DjangoAutoFilterNew...
python
chosen
[ { "from": "system", "value": "Allow the `conf-log` role to link to the logging documentation.\n" }, { "from": "human", "value": "def setup(app):\n \"\"\"Additions and customizations to Sphinx that are useful for documenting\n the Salt project.\n\n \"\"\"\n app.add_crossref_type(direc...
python
chosen
[ { "from": "system", "value": "Add layers object attribute to TraceView.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nTraceView API library\n\n:copyright: (c) 2014 by Daniel Riti.\n:license: MIT, see LICENSE for more details.\n\n\"\"\"\n\n__title__ = 'traceview'\n__versio...
python
chosen
[ { "from": "system", "value": "Stop grabbing gif versions of gifv's posted.\n" }, { "from": "human", "value": "import plugintypes\nimport tgl\n\nclass MediaPlugin(plugintypes.TelegramPlugin):\n \"\"\"\n Upload media files to chat when linked.\n \"\"\"\n patterns = [\n \"(https?...
python
chosen
[ { "from": "system", "value": "Add docstrings to Automaton base class\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport abc\n\n\nclass Automaton(metaclass=abc.ABCMeta):\n\n def __init__(self, states, symbols, transitions, initial_state,\n final_states):\n ...
python
chosen
[ { "from": "system", "value": "Store the basename of the generated files, to allow the unittests to\nclean up in the tearDown method.\n\n\ngit-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@52710 6015fed2-1504-0410-9fe1-9d1591cc4771\n" }, { "from": "human", "value": "import os\nfrom ctypeslib.d...
python
chosen
[ { "from": "system", "value": "Make CLI params a bit clearer\n" }, { "from": "human", "value": "import click\nimport logging\n\nfrom dotenv import load_dotenv, find_dotenv\nfrom grazer.config import Config\nfrom grazer.core import crawler\n\nlogger = logging.getLogger(\"Verata\")\n\n\n@click.comm...
python
chosen
[ { "from": "system", "value": "Change connect command to 439\n" }, { "from": "human", "value": "from motobot import hook\nfrom time import sleep\n\n\n@hook('PING')\ndef handle_ping(bot, message):\n \"\"\" Handle the server's pings. \"\"\"\n bot.send('PONG :' + message.params[-1])\n\n\n@hook...
python
chosen
[ { "from": "system", "value": "Update new version following semver\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nsetup(name='wmtsproxy',\n version='0.1.2',\n description='WMTSProxy makes WMS/WMTS layers available as WMTS',\n ...
python
chosen
[ { "from": "system", "value": "Add StackOverFlowData, not completed yet\n" }, { "from": "human", "value": "\"\"\" Helper classes \"\"\"\n\nimport facebook\nimport requests as r\n\n\nclass FacebookData:\n def __init__(self, token):\n \"\"\"\n :param token: Facebook Page token\n ...
python
chosen
[ { "from": "system", "value": "Handle multiple sites in single request.\n" }, { "from": "human", "value": "import argparse\nimport json\nimport os\n\nimport requests\n\nBASE_URL = \"https://api.majestic.com/api/json\"\nBASE_PARAMS = {'app_api_key': os.environ.get('THEAPIKEY')}\n\n\ndef get(cmd, p...
python
chosen
[ { "from": "system", "value": "setup.py: Fix the creation of parser cache directory\n" }, { "from": "human", "value": "import os.path\n\nfrom distutils.command import build\n\n\nclass build(build.build):\n def _compile_parsers(self):\n import parsing\n\n import edgedb\n im...
python
chosen