conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use url instead of home_page\n" }, { "from": "human", "value": "#!/usr/bin/env python2.6\n\nimport os\nimport setuptools\n\n\ndef find_files(path):\n return [os.path.join(path, f) for f in os.listdir(path)]\n\n\nsetuptools.setup(\n name='workspace-tools',\n versi...
python
chosen
[ { "from": "system", "value": "Use README.rst and CHANGES.rst for description\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='django-simple-history',\n version='1.1.3.post1',\n description='Store model history and view/revert changes fro...
python
chosen
[ { "from": "system", "value": "Include metadata tables in package.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding=utf-8\n\nimport os\n\nfrom setuptools import setup, find_packages\nfrom eodatasets import __version__ as version\n\n# Append TeamCity build number if it gives us o...
python
chosen
[ { "from": "system", "value": "Add django app and tests to source distribution\n" }, { "from": "human", "value": "import versioneer\n\nfrom setuptools import setup\n\nsetup(\n name='domain_events',\n version=versioneer.get_version(),\n cmdclass=versioneer.get_cmdclass(),\n description...
python
chosen
[ { "from": "system", "value": "Add maintainer and long description.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\n\ndef getPackages(base):\n packages = []\n\n def visit(arg, directory, files):\n if '__init__.py' in files:\n packages.append(d...
python
chosen
[ { "from": "system", "value": "Reduce dev version number resolution\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport time\nfrom datetime import date\nfrom setuptools import setup\nfrom pagekite.common import APPVER\nimport os\n\ntry:\n # This borks sdist.\n os.remove('.SELF')\nexcep...
python
chosen
[ { "from": "system", "value": "Add Python 3 trove classifiers.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# setup.py\n# anytop\n#\n\nfrom setuptools import setup\n\nsetup(\n name='anytop',\n version='0.2.1',\n description='Streaming frequency distribution viewer.',\...
python
chosen
[ { "from": "system", "value": "Update version to pick up plurals fix\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='tower',\n version='0.3.2',\n description='Pull strings from a variety of sources, collapse whitespace, '\n 'support contex...
python
chosen
[ { "from": "system", "value": "Build wheel excluding local backports\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nsetup(\n name='caar',\n version='5.0.0-beta.5',\n url='http://github.com/nickpowersys/CaaR/',\n license='BSD 3-Clause License',\n ...
python
chosen
[ { "from": "system", "value": "Update django to use latest security release\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\n\nsetup(\n name='django-oscar-fancypages',\n version=\":versiontools:fancypages:\",\n url='https://github.com...
python
chosen
[ { "from": "system", "value": "mattdrayer/WL-525: Handle for missing product attribute\n" }, { "from": "human", "value": "import hashlib\n\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom edx_rest_api_client.client import EdxRestApiClient\n\nfrom ecommerce.core.url_uti...
python
chosen
[ { "from": "system", "value": "Update question about computer access\n" }, { "from": "human", "value": "from django import forms\nfrom studygroups.models import Application\nfrom studygroups.models import Reminder\nfrom localflavor.us.forms import USPhoneNumberField\n\n\nclass ApplicationForm(for...
python
chosen
[ { "from": "system", "value": "Change file logHandler to use configured path for log files\n" }, { "from": "human", "value": "import logging\nimport logging.handlers\n\n\n# ######### Set up logging ##########\n# log.basicConfig(format=\"%(asctime)s - %(levelname)s: %(message)s\", level=log.DEBUG)...
python
chosen
[ { "from": "system", "value": "Add support for appending /\n" }, { "from": "human", "value": "from flask import Flask, render_template, make_response\nfrom image_helpers import create_image\napp = Flask(__name__)\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@a...
python
chosen
[ { "from": "system", "value": "Add debugging print statment for jenkins\n" }, { "from": "human", "value": "import sys\n\n# This is imported as the DJANGO_SETTINGS_MODULE. It imports local.py\n# which imports base.py which imports funfactory.settings_base.\n#\n# Thus:\n#\n# 1. base.py overrides fu...
python
chosen
[ { "from": "system", "value": "Functional: Fix mesos baymodel creation case\n\nMesos expects a docker network driver type.\n\nPartially implements: blueprint mesos-functional-testing\nChange-Id: I74946b51c9cb852f016c6e265d1700ae8bc3aa17\n" }, { "from": "human", "value": "# Licensed under the Apac...
python
chosen
[ { "from": "system", "value": "[wrt] Update pyunit TIZEN_USER for default value\n\n- Setting default value 'app' for TIZEN_USER in manifest\n\nImpacted tests(approved): new 0, update 264, delete 0\nUnit test platform: [Tizen]\nUnit test result summary: pass 264, fail 0, block 0\n" }, { "from": "human...
python
chosen
[ { "from": "system", "value": "Update link in the comment and change saved image format to .png\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom libavg import app, avg\nfrom PIL import Image\n\n# Demonstrates interoperability with pillow (https://pillow.re...
python
chosen
[ { "from": "system", "value": "Add comments in bootstrap script\n" }, { "from": "human", "value": "# TODO: Implement!\n" }, { "from": "gpt", "value": "# TODO: Implement!\n\n'''\nWe want a folder structure something like this:\n\n|-bin\n|-conf\n|-doc\n| \\-paper\n|-experiments\n| \\-20...
python
chosen
[ { "from": "system", "value": "Make pause dependant on annotation text length\n" }, { "from": "human", "value": "from moviepy.editor import *\n\ndef bake_annotations(video_file, end_point, annotations):\n clip = VideoFileClip(video_file)\n composite_clips = [clip]\n #for annotation in a...
python
chosen
[ { "from": "system", "value": "Add sleep step and logging to bot integration\n" }, { "from": "human", "value": "import logging\nimport os\n\nfrom slackclient import SlackClient\n\nimport logging\nlogger = logging.getLogger(__name__)\n\ndef get_message_info(event, bot_name):\n return event['cha...
python
chosen
[ { "from": "system", "value": "Make the logic more readable\n" }, { "from": "human", "value": "import sys\n\nfrom .magic import SelfWrapper\n\n\ndef register_module(name):\n self = sys.modules['zipa']\n sys.modules[name] = SelfWrapper(self)\n\n\nclass ModuleImporter(object):\n def __init...
python
chosen
[ { "from": "system", "value": "Make the string translator return the actual right values!\n\n* zvm/zstring.py:\n (ZStringStream._get_block): Remove debug printing.\n (ZStringStream.get): Make the offset calculations work on the\n correct bits of the data chunk. Remove debug printing.\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Update file name in error message\n" }, { "from": "human", "value": "import sys\n\ntry:\n from django.conf import settings\n from django.test.utils import get_runner\n\n settings.configure(\n DEBUG=True,\n USE_TZ=True,\n DATABASES={\n ...
python
chosen
[ { "from": "system", "value": "Fix Bot Errors with Selecting Wrong Users\n\nAlso fix validation in case the zeroth user isn't correct, which is happening a bunch.\r\nCompare the names casefolded incase of mismatch in capitalization." }, { "from": "human", "value": "from twitch import TwitchClient...
python
chosen
[ { "from": "system", "value": "Update public schema to include class_of_title and tenure\n" }, { "from": "human", "value": "import collections\nimport logging\n\nfrom datatypes.core import DictionaryValidator\nfrom datatypes.validators import geo_json_validator, entry_validator\nfrom voluptuous i...
python
chosen
[ { "from": "system", "value": "Add EmployeeSimpleSerializer in order to avoid publish sensitive user data such passwords and other related fields\n" }, { "from": "human", "value": "from .models import Star\nfrom rest_framework import serializers\n\n\nclass StarSerializer(serializers.ModelSerializ...
python
chosen
[ { "from": "system", "value": "Change \":\" in titles to \"-\" for better SEO\n" }, { "from": "human", "value": "import re\nfrom unicodedata import normalize\n\n_punct_re = re.compile(r'[\\t !\"#$%&\\'()*\\-/<=>?@\\[\\\\\\]^_`{|},.]+')\n\n\n# From http://flask.pocoo.org/snippets/5/\ndef slugify(t...
python
chosen
[ { "from": "system", "value": "Add a silly failing test.\n" }, { "from": "human", "value": "import pytest\n\nfrom components.accounts.factories import EditorFactory\nfrom components.accounts.models import Editor\n\npytestmark = pytest.mark.django_db\n\n\nclass TestEditors:\n def test_factory(s...
python
chosen
[ { "from": "system", "value": "Update the app with all supplied config arguments\n" }, { "from": "human", "value": "\n\nimport logging\nlog = logging.getLogger(__name__)\n\nfrom .request import Request\n\nclass App(object):\n '''\n Base Application class.\n\n Create an instance of this, ...
python
chosen
[ { "from": "system", "value": "Add some more tests for tasks\n" }, { "from": "human", "value": "import unittest\n\nfrom mo.runner import Variable\n\n\nclass TestVariable(unittest.TestCase):\n def test_default(self):\n v = Variable('name', {'default': 'default'})\n self.assertEqua...
python
chosen
[ { "from": "system", "value": "Correct key for revision in tool playbook parser\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nimport os\nimport argparse\nimport re\nimport yaml\n\ndef get_revision_number(yaml_content, tool_name):\n for tool in...
python
chosen
[ { "from": "system", "value": "Remove redundant view_name variable in serializer\n\n- WAL-109\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom . import models\n\n\nclass OpenStackItemSerializer(serializers.HyperlinkedModelSerializer):\n class Meta(object):\n ...
python
chosen
[ { "from": "system", "value": "Remove sys.path hacking from test\n" }, { "from": "human", "value": "import sys\nimport os\nd = os.path.dirname(__file__)\nsys.path.append(os.path.join(d, '../'))\n\nimport jtrace\n# para = jtrace.Paraboloid(0.0, 0.0)\n# print(para.A)\n# print(para.B)\n# vec = jtrac...
python
chosen
[ { "from": "system", "value": "Use var named \"rpc\" and not \"a\"\n" }, { "from": "human", "value": "#!/srv/python/venv/bin/ipython -i\nimport bqueryd\nimport os\nimport sys\nimport logging\nimport ConfigParser\n\nconfig = ConfigParser.RawConfigParser()\nconfig.read(['/etc/bqueryd.cfg', os.path....
python
chosen
[ { "from": "system", "value": "Fix latex compilation (needed for pdf on read the docs)\n" }, { "from": "human", "value": "from docutils import nodes\n\nfrom sphinx.util.compat import Directive, make_admonition\n\n\nDANGER_MESSAGE = \"\"\"\nThis is a \"Hazardous Materials\" module. You should **ON...
python
chosen
[ { "from": "system", "value": "Support for multiple methods, and leave the config file to hooker\n" }, { "from": "human", "value": "import json\n\ndef check_labels(api):\n with open('config.json', 'r') as fd:\n config = json.load(fd)\n\n if not config['active']:\n return\n\n ...
python
chosen
[ { "from": "system", "value": "Prepare release 1.11.0. Note that this release deprecates the validator.\n" }, { "from": "human", "value": "__version__ = '1.10.76'\n\n\nclass ValidationTimeout(Exception):\n \"\"\"Validation has timed out.\n\n May be replaced by the exception type raised by a...
python
chosen
[ { "from": "system", "value": "Update ID of device in load script\n" }, { "from": "human", "value": "import argparse\nimport requests\nimport time\n\nDEFAULT_DEVICE = 0\nDEFAULT_FILE = '../data/ECG_data.csv'\n\ndef main(device=0, filename=DEFAULT_FILE):\n print(\"Loading firebase for device #%...
python
chosen
[ { "from": "system", "value": "Change XOR to flip second last bit\n\nMaking change to cause merge conflict as an example.\n" }, { "from": "human", "value": "from matasano.util.byte_xor import byte_list_xor\nimport sys\n\nif __name__ == \"__main__\":\n if len(sys.argv) != 2:\n print(\"Us...
python
chosen
[ { "from": "system", "value": "Add email address to registration script output\n" }, { "from": "human", "value": "from competition.models import (Competition, RegistrationQuestion,\n RegistrationQuestionResponse)\n\nimport csv\nimport StringIO\n\n\ndef run():\n s...
python
chosen
[ { "from": "system", "value": "Make basic test a bit more thorough\n" }, { "from": "human", "value": "import mmstats\n\ndef test_uint():\n class MyStats(mmstats.MmStats):\n apples = mmstats.UIntStat()\n oranges = mmstats.UIntStat()\n\n mmst = MyStats()\n\n # Basic format\n ...
python
chosen
[ { "from": "system", "value": "Reduce redundancy in corrected command-line; replace dispatcher name with xia2 from xia2.small molecule for print out\n" }, { "from": "human", "value": "import sys\nfrom xia2_main import run\n\nif __name__ == '__main__':\n if 'small_molecule=true' not in sys.argv:\...
python
chosen
[ { "from": "system", "value": "Fix viewing live TLD definitions on GAE\n" }, { "from": "human", "value": "from cStringIO import StringIO\nimport tldextract\nimport web\n\ntry:\n import json\nexcept ImportError:\n from django.utils import simplejson as json\n\nurls = (\n '/api/extract', '...
python
chosen
[ { "from": "system", "value": "Set develop version to 1.3-dev\n" }, { "from": "human", "value": "__version_info__ = (1, 2, 0, None)\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version_info__[:-1]])\nif __version_info__[-1] is...
python
chosen
[ { "from": "system", "value": "admin_programme: Add active field to form.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder\nfrom Instanssi.ext_...
python
chosen
[ { "from": "system", "value": "Fix test that checks queues\n" }, { "from": "human", "value": "import yaml\n\nfrom app.config import QueueNames\n\n\ndef test_queue_names_set_in_manifest_delivery_base_correctly():\n with open(\"manifest-delivery-base.yml\", 'r') as stream:\n search = ' -Q...
python
chosen
[ { "from": "system", "value": "Add return statement to strip_punct\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Generate random story using trigrams.\"\"\"\nimport io\nimport string\n\n\ndef read_file():\n \"\"\"Open and read file input.\"\"\"\n f = io.open('sherlock_sm...
python
chosen
[ { "from": "system", "value": "Make the PASS command take advantage of processParams and handle the data dict correctly\n" }, { "from": "human", "value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Command, Module\n\nclass PassCommand(Command, Module):\n\tdef onUse(self, ...
python
chosen
[ { "from": "system", "value": "Fix test for anonymity in documentation\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask import Blueprint, render_template, url_for as base_url_for\nfrom flask.ext.security import current_user\nfrom ..extensions import user_datastore\nfrom ..mo...
python
chosen
[ { "from": "system", "value": "Add indicator example to simple test." }, { "from": "human", "value": "import wb_scintilla\nimport sys\n\nfrom PyQt5 import QtWidgets\nfrom PyQt5 import QtGui\nfrom PyQt5 import QtCore\n\napp =QtWidgets.QApplication( sys.argv )\n\nscintilla = wb_scintilla.WbScintill...
python
chosen
[ { "from": "system", "value": "Fix BillingOrder factory to properly set billing_id property\n" }, { "from": "human", "value": "import factory\nimport random\nfrom billing.models import Billing, OrderBilling\nfrom member.factories import ClientFactory\nfrom order.factories import OrderFactory\n\n\...
python
chosen
[ { "from": "system", "value": "Remove redundant index declaration from Event\n\nThe updated at index is already declared in ChangeTracked mixin which is\nincluded in the Base mixin.\n" }, { "from": "human", "value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/license...
python
chosen
[ { "from": "system", "value": "Add slug to the db and allow querying it\n" }, { "from": "human", "value": "import json\nfrom flaskext.mongoalchemy import BaseQuery\nimport requests\n\nfrom api import app\nfrom api import db\n\n\nENDPOINT = 'http://data.nasa.gov/api/'\n\n\nclass DatasetQuery(BaseQ...
python
chosen
[ { "from": "system", "value": "Fix newline not processed problem\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport re\n\nfrom jinja2 import evalcontextfilter, Markup, escape\n\nRE_NL2BR = re.compile(r'(\\\\r)?\\\\n', re.UNICODE | re.MULTILINE)\n\n@evalcon...
python
chosen
[ { "from": "system", "value": "Change assertGet body check from StringType to str\n" }, { "from": "human", "value": "import types\nimport unittest\n\nimport requests\n\n\nclass TestCase(object):\n \"\"\"\n Add assetion methods for HTTP Requests to TestCase\n \"\"\"\n hosts = []\n\n ...
python
chosen
[ { "from": "system", "value": "Test mismatched array lengths error in utils\n\nAdds a test for `_bool_cmp_mtx_cnt` to make sure that if two arrays are\nprovided with two different lengths that it will raise a `ValueError`.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: ut...
python
chosen
[ { "from": "system", "value": "Add test for client connect/disconnect methods\n" }, { "from": "human", "value": "import pytest\n\nfrom aiohttp_json_rpc.client import JsonRpcClient\n\n\npytestmark = pytest.mark.asyncio(reason='Depends on asyncio')\n\n\nasync def test_client_autoconnect(rpc_context...
python
chosen
[ { "from": "system", "value": "Revert \"flake8: Ignore geoid.py issues\"\n\nThis reverts commit a70cea27c37c1ced21d51b950f49d4987f501385.\n" }, { "from": "human", "value": "from subprocess import CalledProcessError, check_output as run\n\nFLAKE8_COMMAND = 'flake8'\n\nFLAKE8_INPUTS = [\n 'skyli...
python
chosen
[ { "from": "system", "value": "Test search for more than one distribution.\n" }, { "from": "human", "value": "import re\nimport pkg_resources\nfrom pip import __version__\nfrom pip.commands.status import search_packages_info\nfrom tests.test_pip import reset_env, run_pip\n\ndef test_status():\n ...
python
chosen
[ { "from": "system", "value": "Add debug logs to keepalive thread\n" }, { "from": "human", "value": "import threading\nimport logbook\n\n_logger = logbook.Logger(__name__)\n\n\nclass KeepaliveThread(threading.Thread):\n\n def __init__(self, client, session, interval):\n super(KeepaliveT...
python
chosen
[ { "from": "system", "value": "Use created for ordering and date_hierarchy in ReactionAdmin.\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.utils.translation import ugettext_lazy as _\nfrom .models import Reaction\n\n\nclass ReactionAdmin(admin.ModelAdmin):\n ...
python
chosen
[ { "from": "system", "value": "MNT: Fix getting version for development install\n\nPath wasn't updated when we moved source code to 'src/'.\n" }, { "from": "human", "value": "# Copyright (c) 2019 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identif...
python
chosen
[ { "from": "system", "value": "Fix error on flat trace with cahe test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom openfisca_web_api.handlers import get_flat_trace\n\n\ndef test_flat_trace():\n tree = {\n 'name': 'a',\n 'period': 2019,\n 'children': [...
python
chosen
[ { "from": "system", "value": "Use kwargs when calling User.__init__\n" }, { "from": "human", "value": "from faker import Faker\nimport click\n\nfrom app.database import db\nfrom app.user.models import User\n\n\n@click.option('--num_users', default=5, help='Number of users.')\ndef populate_db(num...
python
chosen
[ { "from": "system", "value": "Add mixin for evaluating characterIDs\n" }, { "from": "human", "value": "from rest_framework import permissions, viewsets, serializers\nimport json\n\nclass CapsulerPermission(permissions.IsAuthenticated):\n \"\"\"\n Standard capsuler access permission. If the...
python
chosen
[ { "from": "system", "value": "Fix formatting of pypi docs\n" }, { "from": "human", "value": "\"\"\"A simple facade for boto3.\"\"\"\n\nimport os\nimport inspect\n\n\n__version__ = \"0.5.2\"\n__dir__ = os.path.dirname(inspect.getfile(inspect.currentframe()))\n" }, { "from": "gpt", "va...
python
chosen
[ { "from": "system", "value": "Add docstrings so that hubot can say what went wrong\n" }, { "from": "human", "value": "import unittest\n\nfrom celery import Celery\nfrom django.conf import settings\nfrom django.db import connection\n\n\nclass SmokeTests(unittest.TestCase):\n\n def setUp(self):...
python
chosen
[ { "from": "system", "value": "Change default back to in-memory.\n\n--HG--\nbranch : local-db\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nDEBUG = True\n# If you think this is my actual secret key, I have a bridge to sell you.\nSECRET_KEY = '\\x1a\\x16\\xd5U\\xdc\\x0fL\\x91\\x1f\\x...
python
chosen
[ { "from": "system", "value": "Rewrite the script in a package fasshion.\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport urllib2\nimport json\nimport re\n\n# album_url = 'http://www.ximalaya.com/7712455/album/6333174'\nalbum_url = 'http://www.ximalaya.com/7712455/album/4474664'\nheade...
python
chosen
[ { "from": "system", "value": "Use getattr in case setting doesn't exist\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport sys\n\nfrom django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.views.generic import TemplateView\n\nfrom d...
python
chosen
[ { "from": "system", "value": "Remove unused import 'Signal' (F401)\n" }, { "from": "human", "value": "\"\"\"Multi-consumer multi-producer dispatching mechanism\n\nOriginally based on pydispatch (BSD)\nhttp://pypi.python.org/pypi/PyDispatcher/2.0.1\nSee license.txt for original license.\n\nHeavil...
python
chosen
[ { "from": "system", "value": "Fix incorrect windows subsystem in CMake backend\n" }, { "from": "human", "value": "import string\n\nTEMPL = \"\"\"\\\n# $WARNING\n# Only Windows builds supported with CMake\ncmake_minimum_required(VERSION 2.8 FATAL_ERROR)\nproject($PROJNAME)\nif(NOT DEFINED WIN32)\...
python
chosen
[ { "from": "system", "value": "Rename model field class_path to custom_method\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django_services import admin\nfrom ..service.parameter import ParameterService\nfrom ..forms.par...
python
chosen
[ { "from": "system", "value": "Fix syntax in spatial layer\n" }, { "from": "human", "value": "import lasagne\nimport numpy as np\n\nWIDTH_INDEX = 3\nHEIGHT_INDEX = 2\nLAYER_INDEX = 1\n\n\nclass SpatialPoolingLayer(lasagne.layers.Layer):\n # I assume that all bins has square shape for simplicit...
python
chosen
[ { "from": "system", "value": "fab: Add lint/autolint tasks for running flake8 on everything\n" }, { "from": "human", "value": "from fabric.api import execute, local, settings, task\n\n\n@task\ndef docs():\n local('make -C docs/ html')\n\n\n@task\ndef autodocs():\n auto(docs)\n\n\n@task\nde...
python
chosen
[ { "from": "system", "value": "Add a test for the new multi-year feature\n" }, { "from": "human", "value": "import kpub\n\n\ndef test_annual_count():\n # Does the cumulative count match the annual count?\n db = kpub.PublicationDB()\n annual = db.get_annual_publication_count()\n cumul ...
python
chosen
[ { "from": "system", "value": ":rocket: Verify if it's a testing app for permissioning\n" }, { "from": "human", "value": "from functools import wraps\nfrom flask import abort\nfrom flask_login import current_user\nfrom labsys.auth.models import Permission\n\n\ndef permission_required(permission):...
python
chosen
[ { "from": "system", "value": "Change osl_flatpage model to separate meta data from content\n" }, { "from": "human", "value": "from django.db import models\nimport markdown\n\nclass Flatpage(models.Model):\n page_name = models.CharField(max_length=100, primary_key=True, unique=True)\n markd...
python
chosen
[ { "from": "system", "value": "Replace usage of url with re_path.\n" }, { "from": "human", "value": "from django.urls import path\n\nfrom invite import views\n\napp_name = 'invite'\nurlpatterns = [\n path('$', views.index, name='index'),\n path('invite/$', views.invite, name='invite'),\n ...
python
chosen
[ { "from": "system", "value": "Change constant variables to fit new template\n" }, { "from": "human", "value": "import string\n\nROWS = 12\nCOLUMNS = 14\nTMPL_OPTIONS = {\n 'page-size': 'Letter'\n}\n\nPERCENTAGE_TO_CROP_SCAN_IMG = 0.005\nPERCENTAGE_TO_CROP_CHAR_IMG = 0.1\n\nCROPPED_IMG_NAME = ...
python
chosen
[ { "from": "system", "value": "Use a constant to specify the number of child threads to create.\n\nInstead of assuming that the number process ids of the threads is the\nsame as the process id of the controlling process, use a copy of the\ndictionary and check for changes in the process ids of the threads\nf...
python
chosen
[ { "from": "system", "value": "Handle messages posted to the TriggerInstance work Q.\n" }, { "from": "human", "value": "from st2common.transport.reactor import get_trigger_queue\n\n\ndef work():\n # TODO Listen on this queue and dispatch message to the rules engine\n queue = get_trigger_que...
python
chosen
[ { "from": "system", "value": "Add urlconf entry for VendOutlet detail\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.OutletList.as_view(),\n name='vend_outlet_list'),\n]\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Change import order in memories\n" }, { "from": "human", "value": "# Copyright 2017 reinforce.io. 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 ...
python
chosen
[ { "from": "system", "value": "Add supressions for array casting functions that don't seem to be callable.\n" }, { "from": "human", "value": "suppressions = [\n # This one cannot be covered by any Python language test because there is\n # no code pathway to it. But it is part of the C API,...
python
chosen
[ { "from": "system", "value": "Use an OrderedDict to ensure the first option is the default option\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n#\n# This file is part of ckanext-nhm\n# Created by the Natural History Museum in London, UK\n\n\nCOLLECTION_CONTACTS = {...
python
chosen
[ { "from": "system", "value": "Remove debug toolbar due to 'TypeError: process() takes exactly 3 arguments (2 given)'\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom os.path import join, normpath\n\nfrom .base import *\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nE...
python
chosen
[ { "from": "system", "value": "Rename column altitude to longitude ...\n" }, { "from": "human", "value": "from django.db import models\n\nclass Position(models.Model):\n\tfirst_name = models.CharField(max_length=50, blank=True, null=True)\n\tlast_name = models.CharField(max_length=50, blank=True,...
python
chosen
[ { "from": "system", "value": "Remove leftover relic from supporting CPython 2.6.\n" }, { "from": "human", "value": "# cf. https://github.com/pypa/manylinux/issues/53\n\nGOOD_SSL = \"https://google.com\"\nBAD_SSL = \"https://self-signed.badssl.com\"\n\nimport sys\n\nprint(\"Testing SSL certificat...
python
chosen
[ { "from": "system", "value": "Add self before eaten on isEaten for Food\n" }, { "from": "human", "value": "# Food Class\n\nclass Food:\n\n\tdef __init__(self, x, y):\n\t\tself.location = (x, y)\n\t\tself.eaten = False\n\n\tdef getX(self):\n\t\treturn self.location[0]\n\n\tdef getY(self):\n\t\tre...
python
chosen
[ { "from": "system", "value": "Remove the compiled translations for testing\n" }, { "from": "human", "value": "import subprocess\nimport os\nfrom flask import current_app\nfrom babel.support import Translations, NullTranslations\nfrom flaskbb.utils.translations import FlaskBBDomain\nfrom flaskbb....
python
chosen
[ { "from": "human", "value": "Add generation of spectral output file" }, { "from": "gpt", "value": "import os\nimport pandas as pd\nimport astropy.units as units\n\n\nclass CodeComparisonOutputFile(object):\n first_column_name = 'VEL'\n\n def __init__(self, times, data_table, model_name, da...
python
chosen
[ { "from": "system", "value": "Test zip data for path()\n" }, { "from": "human", "value": "import io\nimport os.path\nimport pathlib\nimport sys\nimport unittest\n\nimport importlib_resources as resources\nfrom . import data\nfrom . import util\n\n\nclass CommonTests(util.CommonTests, unittest.Te...
python
chosen
[ { "from": "system", "value": "Use list comprehensions and consolidate error formatting where error details are either a list or a string.\n" }, { "from": "human", "value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException, ParseError\n\n\ndef json_api_excep...
python
chosen
[ { "from": "system", "value": "Remove the `get_original_attribute` shortcut from the root module.\n" }, { "from": "human", "value": "# __ __ __\n# .-----.-----.----|__| | .---.-.\n# | _ | _ | _| | | | _ |\n# |___ |_____|__| |__|__|__|___._|\n# |_____|\n#\...
python
chosen
[ { "from": "system", "value": "Increment release version to 0.9.3\n" }, { "from": "human", "value": "SOURCE_URL = 'https://github.com/mozilla/http-observatory'\nVERSION = '0.9.2'\n" }, { "from": "gpt", "value": "SOURCE_URL = 'https://github.com/mozilla/http-observatory'\nVERSION = '0....
python
chosen
[ { "from": "system", "value": "Refactor slash-unpickiness as a function and redecorate\n" }, { "from": "human", "value": "import projects\nfrom flask import Flask, render_template, abort\napp = Flask(__name__)\n\n\n@app.errorhandler(404)\ndef page_not_found(e):\n return render_template('404.ht...
python
chosen
[ { "from": "system", "value": "Add wrapper for event data elem\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport boto3\nimport json\nimport os\nimport btr3baseball\n\njobTable = os.environ['JOB_TABLE']\njobQueue = os.environ['JOB_QUEUE']\nqueue = boto3.resource('s...
python
chosen
[ { "from": "system", "value": "Remove debug app exit on / access (web sensor)\n" }, { "from": "human", "value": "from aiohttp.web import HTTPFound\n\nfrom .core import CoreView\nfrom ..util import login_required, handle_exception\n\n\nclass Home(CoreView):\n\n @login_required\n async def re...
python
chosen