conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix install deps\nThings will work only in test where cis_fake_well_known is installed\notherwise, but \"prod\" deploys would be missing deps that it would pull\n(even thus `make install` otherwise works)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -...
python
chosen
[ { "from": "system", "value": "refactor: Change 'is False' to 'not'\n" }, { "from": "human", "value": "import pyrebase\n\n\ndef store_url(is_yes, url, FB_API_KEY, FB_USER, FB_PASS):\n # do nothing if it's unnecessary\n if is_yes is False:\n return is_yes\n\n # connect to firebase\...
python
chosen
[ { "from": "system", "value": "Remove unused import from cloudtrail public bucket alert\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file,...
python
chosen
[ { "from": "system", "value": "Fix architecture for future releases\n" }, { "from": "human", "value": "import sys\n\nfullversion = sys.argv[1]\npath = f\"btsoot_{fullversion}/DEBIAN/control\"\nversion = fullversion[1:]\ncontrol_content = f\"\"\"Package: btsoot\nVersion: {version}\nSection: base\n...
python
chosen
[ { "from": "system", "value": "Add random_challenge method to choose a challenge to answer\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nfrom heartbeat import Challenge\n\nimport requests\n\nfrom .utils import urlify\nfrom .exc import DownstreamErro...
python
chosen
[ { "from": "system", "value": "Clean up spaces (a little)" }, { "from": "human", "value": "\"\"\"usage: git-xblob add <path> [...]\"\"\"\n\nimport os\n\nfrom ..utils import git\n\n\ndef bail(code=1):\n print __doc__.strip()\n exit(code)\n\n\ndef run_add(paths):\n\n if not paths:\n ...
python
chosen
[ { "from": "system", "value": "Add documentation of the new functions\n" }, { "from": "human", "value": "\n\"\"\"Example of reversible reaction.\"\"\"\n\nimport os\n\nfrom chemkinlib.utils import Parser\nfrom chemkinlib.reactions import ReactionSystems\nfrom chemkinlib.config import DATA_DIRECTOR...
python
chosen
[ { "from": "system", "value": "Comment out generic db functions as not used yet\n" }, { "from": "human", "value": "from app import db\nfrom app.dao.decorators import transactional\n\n\n@transactional\ndef dao_create_record(record):\n db.session.add(record)\n\n\n@transactional\ndef dao_update_r...
python
chosen
[ { "from": "system", "value": "Increase the time delta from 120 to 240 milli secs to\ndecide the failure.\n\nChange-Id: Ic51da36d79d4cd4ccac342d7242e56a23e21c07f\n" }, { "from": "human", "value": "from fabfile.config import *\n\n@task\n@roles('all')\ndef get_all_time():\n date = run(\"DATE=$( ...
python
chosen
[ { "from": "system", "value": "fix: Remove payment order from bank dashboard\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom frappe import _\n\n\ndef get_data():\n\treturn {\n\t\t'fieldname': 'bank',\n\t\t'non_standard_fieldnames': {\n\t\t\t'Paymnet Order': 'com...
python
chosen
[ { "from": "system", "value": "Fix typo in isolate server.\n\nDid I say we need more integration tests?\n\nTBR=vadimsh@chromium.org\nBUG=\n\nReview URL: https://codereview.appspot.com/220370043\n" }, { "from": "human", "value": "# Copyright 2014 The Swarming Authors. All rights reserved.\n# Use o...
python
chosen
[ { "from": "system", "value": "Fix pickle import in Python 3.\n" }, { "from": "human", "value": "import RMF\nimport cPickle\n\nb = RMF.BufferHandle()\nf = RMF.create_rmf_buffer(b)\n\nf.get_root_node().add_child(\"hi\", RMF.ORGANIZATIONAL)\n\ndel f\n\npicklestring = cPickle.dumps(b)\nbb = cPickle....
python
chosen
[ { "from": "system", "value": "Add a column for count field" }, { "from": "human", "value": "from django.contrib import admin \nfrom django.utils.translation import ugettext_lazy as _\nfrom open_municipio.locations.models import Location\n\n\nclass LocationAdmin(admin.ModelAdmin):\n pass\n\nad...
python
chosen
[ { "from": "system", "value": "Add tests to verify that we handle TZ properly\n" }, { "from": "human", "value": "from todoman.model import Database\n\n\ndef test_querying(create, tmpdir):\n for list in 'abc':\n for i, location in enumerate('abc'):\n create(\n '...
python
chosen
[ { "from": "system", "value": "Remove received after successful diff.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom pywidl.pywidl import App\n\nimport unittest\n\nfrom difflib import context_diff\nimport os.path\nimport sys\n\n\n\nclass TestPyWIdl(unittest.TestCase):\n def _match(...
python
chosen
[ { "from": "system", "value": "Add Gzip compression to geojson layer view\n" }, { "from": "human", "value": "from http import HttpJSONResponse\nfrom serializers import Serializer as GeoJSONSerializer\nfrom django.views.generic import ListView\n\n\nclass GeoJSONResponseMixin(object):\n \"\"\"\n...
python
chosen
[ { "from": "system", "value": "Tidy up layout and remove redundant code\n" }, { "from": "human", "value": "from typing import NamedTuple, Callable, List, Dict, Sequence\nimport pulp\nfrom .resources import ScheduledItem\n\n\ndef variables(events: Sequence, rooms: Sequence, slots: Sequence):\n ...
python
chosen
[ { "from": "system", "value": "Update example for Python 3" }, { "from": "human", "value": "import rumps\n\nwindow = rumps.Window('Nothing...', 'ALERTZ')\nwindow.title = 'WINDOWS jk'\nwindow.message = 'Something.'\nwindow.default_text = 'eh'\n\nresponse = window.run()\nprint response\n\nwindow.ad...
python
chosen
[ { "from": "system", "value": "INDY-1199: Make interface of NetworkI3PCWatcher more clear\n\nSigned-off-by: Sergey Khoroshavin <b770466c7a06c5fe47531d5f0e31684f1131354d@dsr-corporation.com>\n" }, { "from": "human", "value": "from typing import Callable, Iterable\nfrom plenum.server.quorums import...
python
chosen
[ { "from": "system", "value": "Add the appstats recording middleware\n" }, { "from": "human", "value": "import os\nimport site\nimport sys\n\napproot = os.path.dirname(__file__)\nsys.path.append(os.path.join(approot, 'lib'))\nsite.addsitedir(os.path.join(approot, 'site-packages'))\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add utility method for converting all elements in list to string.\n" }, { "from": "human", "value": "def without_spaces(the_str):\r\n return \"\".join(the_str.split())" }, { "from": "gpt", "value": "def without_spaces(the_str):\r\n return \"\".join...
python
chosen
[ { "from": "system", "value": "Change cookie name for mobile setting" }, { "from": "human", "value": "from settings import *\nimport settings\n\nTEMPLATE_DIRS_BASE = TEMPLATE_DIRS\n\nTEMPLATE_DIRS = (\n '%s/library/templates/mobile/auth' % ROOT_PATH, \n '%s/library/templates/mobile' % RO...
python
chosen
[ { "from": "system", "value": "Check for content to highlight" }, { "from": "human", "value": "import logging\nfrom pprint import pformat\n\nfrom rest_framework import serializers\n\nlog = logging.getLogger(__name__)\n\n\nclass PageSearchSerializer(serializers.Serializer):\n project = serializ...
python
chosen
[ { "from": "system", "value": "BUG: Fix test which appeared to not be run\n" }, { "from": "human", "value": "# This file is part of h5py, a Python interface to the HDF5 library.\n#\n# http://www.h5py.org\n#\n# Copyright 2008-2018 Andrew Collette and contributors\n#\n# License: Standard 3-clause ...
python
chosen
[ { "from": "system", "value": "tools: Fix Python 3 incompatibility for building with Eclipse on Windows\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Wrapper to run make and preprocess any paths in the output from MSYS Unix-style paths\n# to Windows paths, for Eclipse\nfrom __fut...
python
chosen
[ { "from": "system", "value": "Use supernet interface for building the appropriate network.\n" }, { "from": "human", "value": "from .. import INETOID, CIDROID, MACADDROID\nfrom . import lib\ntry:\n\timport ipaddress\nexcept ImportError:\n\timport ipaddr as ipaddress\n\noid_to_type = {\n\tMACADDRO...
python
chosen
[ { "from": "system", "value": "Remove multi-az env from CI pipeline.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom jinja2 import Template\n\nclusters = ['1-12', '2-0', '2-1', '2-2', 'multi-az']\ntiles = [d for d in os.listdir('../examples') if os.path.isdir(os.path.j...
python
chosen
[ { "from": "system", "value": "Refactor url_to_class_builder so that the view is only built once\n" }, { "from": "human", "value": "django = __import__(\"django.conf.urls.defaults\", {})\n\nfrom zuice import Injector\n\ndef _view_builder(bindings):\n def view(request, view_class, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Allow subsystems to not map a sqlachemy entity\n" }, { "from": "human", "value": "import flask\n\nfrom infosystem.common.subsystem.controller import *\nfrom infosystem.common.subsystem.driver import *\nfrom infosystem.common.subsystem.manager import *\nfrom infosyst...
python
chosen
[ { "from": "system", "value": "Configure database for testing environment\n" }, { "from": "human", "value": "\"\"\"Django configuration for local development environment.\"\"\"\nfrom .testing import *\n\nDEBUG = True\n" }, { "from": "gpt", "value": "\"\"\"Django configuration for loca...
python
chosen
[ { "from": "system", "value": "Remove spurious no cover pragma\n" }, { "from": "human", "value": "\nimport numpy as np\n\nfrom fastats.core.decorator import fs\n\n\ndef value(x): # pragma: no cover\n return x\n\n\n@fs\ndef single_pass(x):\n \"\"\"\n Performs a single iteration over the ...
python
chosen
[ { "from": "system", "value": "Return 404 in case page is not found\n" }, { "from": "human", "value": "from django.views.generic import DetailView\n\nfrom .models import Page\n\n\nclass PageView(DetailView):\n\n model = Page\n\n def get_object(self, queryset=None):\n\n slug = self.kw...
python
chosen
[ { "from": "system", "value": "Fix versioning from git after `setup.py install`\n\nWhen following the `README`, __init__.py raised an\n\"IOError: [Errno 2] No such file or directory:\" about `setup.py`.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# ############# version ##########...
python
chosen
[ { "from": "system", "value": "Fix getting the sitename, we are down to 2 failing FTs\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom fabric.api import env, run\n\ndef _get_base_folder(host):\n return '/var/www/sites/{}'.format(host)\n\ndef _get_manage_py(host):\n command...
python
chosen
[ { "from": "human", "value": "Fix the callable check to not emit exception when method not found\n" }, { "from": "gpt", "value": "import json\n\nVERSION=\"0.1\"\n\nclass Handler:\n def __init__(self):\n self.log = []\n self.result = False\n self.ttl = 300\n self.par...
python
chosen
[ { "from": "system", "value": "Use _annfab instead of annfab._annfab in an import test.\n" }, { "from": "human", "value": "# flake8: noqa\nimport pytest\nannfab._annfab = pytest.importorskip(\"annfab._annfab\")\n\n\ndef test_import():\n assert True\n" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Update setup to include new scripts\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2015 University of Chicago\n# Available under Apache 2.0 License\n# setup for fsurfer-libs\nfrom distutils.core import setup\n\nsetup(name='fsurfer-libs',\n ...
python
chosen
[ { "from": "system", "value": "Prepend '-S rubocop' to version args\n\nFixes #17\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Aparajita Fishman\n# Copyright (c) 2013 Aparajita Fishman\n#\n# License: M...
python
chosen
[ { "from": "system", "value": "Drop the UUID; just use urandom\n" }, { "from": "human", "value": "# Sample untracked-keys file\n# If you get errors trying to 'import apikeys', do the following:\n# 1) Copy this file to apikeys.py (keeping it in the package directory)\n# 2) Replace all of the examp...
python
chosen
[ { "from": "system", "value": "Update Heart actors helper class to handle args\n" }, { "from": "human", "value": "#! -*- coding:utf-8 -*-\n\nimport time\nimport threading\n\n\nclass Heart(threading.Thread):\n \"\"\"Implementation of an heart beating routine\n\n To be used by actors to send ...
python
chosen
[ { "from": "system", "value": "Check for greened package - consistency\n" }, { "from": "human", "value": "import sys\n\nfrom utils import module_exists\n\nfrom gevent import monkey\n\n\ndef make_django_green():\n monkey.patch_all()\n\n if module_exists('psycogreen'):\n from psycogree...
python
chosen
[ { "from": "system", "value": "[FIX] Rename save method for database to a more descriptive name\n" }, { "from": "human", "value": "import logging\nfrom app import db\n\nlogger = logging.getLogger(__name__)\n\n\ndef save_data(data):\n try:\n db.session.add(data)\n db.session.commi...
python
chosen
[ { "from": "system", "value": "Use trial unittest instead of python unittest\n" }, { "from": "human", "value": "import os\nimport unittest\nfrom ooni.utils import pushFilenameStack\nclass TestUtils(unittest.TestCase):\n def test_pushFilenameStack(self):\n basefilename = os.path.join(os....
python
chosen
[ { "from": "system", "value": "Add collapse to star import\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"This module contains functions that mutate or make transformations on a network.\"\"\"\n\nfrom . import deletion, expansion, induction, inference, metadata, transfer\nfro...
python
chosen
[ { "from": "system", "value": "Fix bug in 'multiply' support\n" }, { "from": "human", "value": "import sys\n\ndef add_all(nums):\n\treturn sum(nums)\n\ndef multiply_all(nums):\n\treturn reduce(lambda a, b: a * b, nums)\n\nif __name__== '__main__':\n\tcommand = sys.argv[1]\n\tnums = map(float, sys...
python
chosen
[ { "from": "system", "value": "Add request to return value.\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response\nfrom categories.models import Category\n\ndef index(request):\n category_list = Category.tree.all()\n return render_to_response(\"home.html\",\n ...
python
chosen
[ { "from": "system", "value": "Fix path where the images are saved.\n" }, { "from": "human", "value": "from django.db import models\nfrom tinymce import models as tinymce_models\n\nphotos_path = \"/simple-faq/\"\n\n\nclass Topic(models.Model):\n text = models.CharField(max_length=200)\n num...
python
chosen
[ { "from": "system", "value": "Add custom exception logic to the Directory class\n\nIf an empty string was passed to the Directory class, then an exception\nneeds to be raised as all of its methods assume a value for the path.\n" }, { "from": "human", "value": "\"\"\"Contains a Directory class to...
python
chosen
[ { "from": "system", "value": "Add version information and header" }, { "from": "human", "value": "from .unittest import UnitTestPlugin as PLUGIN_CLASS\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\n# --------------------------------------------------------------------------...
python
chosen
[ { "from": "system", "value": "Add a failing unit test of unicode parsing\n" }, { "from": "human", "value": "import unittest, urllib\nfrom rest_framework.compat import BytesIO\n\n\nclass TestParser(unittest.TestCase):\n\n def setUp(self):\n from drf_to_s3.parsers import NestedFormParser...
python
chosen
[ { "from": "system", "value": "Allow for some missing silica bond parameters\n" }, { "from": "human", "value": "import mbuild as mb\nimport parmed as pmd\nimport pytest\n\nfrom foyer import Forcefield\nfrom foyer.tests.utils import get_fn\n\n\n@pytest.mark.timeout(1)\ndef test_fullerene():\n f...
python
chosen
[ { "from": "system", "value": "Fix numpy API name retrieval\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 ._library import array, ...
python
chosen
[ { "from": "system", "value": "Remove pygame.display.init() call on import, not needed\n" }, { "from": "human", "value": "import sys, signal\nimport pygame\n\ndef fixup_sigterm_behaviour():\n '''\n SDL registers its own signal handler for SIGTERM, which pushes a SDL_QUIT event to the event\...
python
chosen
[ { "from": "system", "value": "Put validateSettings() after girder decorator\n\nThis was mistakenly put inside the class body. It\nneeds to be after the girder decorator instead.\n\nSigned-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com>\n" }, { "from": "human", "value...
python
chosen
[ { "from": "system", "value": "Work with custom user models in django >= 1.5 \n\nsettings only provide module strs, not real implementations" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.conf import settings\n\nfrom django.contrib.auth.models import Group\nfrom dj...
python
chosen
[ { "from": "system", "value": "Fix for titles containing cr\n" }, { "from": "human", "value": "import sys\nimport plugin\nimport re\nimport urllib2\nfrom utils import url_parser\n\nfrom twisted.python import log\n\ntitle_re = re.compile(r'<title>(.*?)</title>', re.IGNORECASE)\n\nclass Titlegiver(...
python
chosen
[ { "from": "system", "value": "Add purge and warn scripts\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2015 University of Chicago\n# Available under Apache 2.0 License\n# setup for fsurf on OSG Connect login\nfrom distutils.core import setup\nimport fsurfer\n\nsetup(nam...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.12-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=11\nbranch=\"master\"\ntimestamp=1376505745.87" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=12\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Add integration test for starting the API\n" }, { "from": "human", "value": "from piper.cli import cmd_piperd\nfrom piper.api import api\n\nimport mock\n\n\nclass TestEntry(object):\n @mock.patch('piper.cli.cmd_piperd.CLIBase')\n def test_calls(self, clibase):...
python
chosen
[ { "from": "system", "value": "Complete output of load_balancer_status @debugtask\n" }, { "from": "human", "value": "\"\"\"module concerns itself with tasks involving branch deployments of projects.\"\"\"\n\nfrom fabric.api import task\nfrom decorators import requires_aws_stack, debugtask\nfrom b...
python
chosen
[ { "from": "system", "value": "Remove long description as causing pip error\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nwith open('README.rst') as f:\n readme = f.read()\n\nsetup(\n name = \"django-disposable-email-checker\",\n version = \"0.1.1\",\n...
python
chosen
[ { "from": "system", "value": "Document how output generators work\n" }, { "from": "human", "value": "\nfrom abc import ABCMeta, abstractmethod\n\nfrom sslyze.cli import CompletedServerScan\nfrom sslyze.cli import FailedServerScan\nfrom sslyze.server_connectivity import ServerConnectivityInfo\n\n...
python
chosen
[ { "from": "system", "value": "Fix bug: trying to call .replace on NoneType\n" }, { "from": "human", "value": "import re\n\nimport xml.etree.ElementTree as ET\nfrom os import path\n\nfrom tmc.exercise_tests.basetest import BaseTest, TestResult\n\n\nclass CheckTest(BaseTest):\n\n def __init__(s...
python
chosen
[ { "from": "system", "value": "Use jsonpointer instead of my own terrible Reference class.\n" }, { "from": "human", "value": "import json\n\nclass Schema(dict):\n \"\"\"\n Lightweight encapsulation of a JSON Schema.\n \"\"\"\n\n @classmethod\n def from_file(cls, path_or_stream):\n ...
python
chosen
[ { "from": "system", "value": "Use periodic queue to increase priority\n" }, { "from": "human", "value": "from celery.schedules import crontab\nfrom celery.task.base import periodic_task\n\nfrom corehq.preindex.accessors import index_design_doc, get_preindex_designs\nfrom corehq.util.decorators i...
python
chosen
[ { "from": "system", "value": "Add a prefix to the statsd key\n\nWe have loads of stats at the top leve of our statsd stats in graphite.\nIt makes looking for things that aren't created by backdrop really\nhard.\n" }, { "from": "human", "value": "import os\nimport statsd as _statsd\n\n\n__all__ =...
python
chosen
[ { "from": "system", "value": "Add containers to workgroup detail view\n" }, { "from": "human", "value": "import json\n\nfrom django.shortcuts import get_object_or_404\nfrom django.http import HttpResponse, Http404\n\nfrom cyder.base.utils import make_megafilter\nfrom cyder.base.views import cy_d...
python
chosen
[ { "from": "system", "value": "Adjust tests to run migrate when necessary\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport django\nfrom django.test import TestCase\nfrom django.core.management import call_command\n\nif django.VERSION >= (1, 7):\n from django.test import o...
python
chosen
[ { "from": "system", "value": "Add event_type to the event constructor\n" }, { "from": "human", "value": "from simple_es.identifier.identifies import Identifies\n\n\nclass DomainEvent():\n \"\"\"\n Base class for all domain driven events\n\n TODO: Split logic around saving to a data stor...
python
chosen
[ { "from": "system", "value": "Add __all__ to rank filter package\n" }, { "from": "human", "value": "from .rank import *\nfrom .percentile_rank import *\nfrom .bilateral_rank import *\n" }, { "from": "gpt", "value": "from .rank import (autolevel, bottomhat, equalize, gradient, maximum...
python
chosen
[ { "from": "human", "value": "Add vowels and consonants constants\n" }, { "from": "gpt", "value": "class Pattern(object):\n\n def __init__(self):\n self.consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n self.vowels = ['a','e','i'...
python
chosen
[ { "from": "system", "value": "Expand IRC numerics to name list\n" }, { "from": "human", "value": "CTCP_DELIMITER = chr(1)\nMAX_MESSAGE_LENGTH = 450 #Officially 512 including the newline characters, but let's be on the safe side\nCHANNEL_PREFIXES = \"#&!+.~\" #All the characters that could poss...
python
chosen
[ { "from": "system", "value": "Fix small bug in Scaler class\n" }, { "from": "human", "value": "# Author: Mainak Jas <mainak@neuro.hut.fi>\n#\n# License: BSD (3-clause)\n\nfrom sklearn.base import TransformerMixin\nfrom mne.fiff import pick_types\n\n\nclass RtClassifier:\n\n \"\"\"\n TODO: ...
python
chosen
[ { "from": "system", "value": "Implement prettier method names in PreconditionErrors as per spec; not yet full branch coverage.\n" }, { "from": "human", "value": "class PreconditionError (TypeError):\n def __init__(self, callee, *args):\n TypeError.__init__(self, '{0.__name__}{1!r}'.for...
python
chosen
[ { "from": "system", "value": "Exit if SPOTIFY_{USERNAME,PASSWORD} is not set\n" }, { "from": "human", "value": "import spytify\n\nfrom mopidy import settings\nfrom mopidy.backends.base import BaseBackend\n\nclass SpotifyBackend(BaseBackend):\n def __init__(self, *args, **kwargs):\n sup...
python
chosen
[ { "from": "system", "value": "DOC: Disable searching for PortAudio when building docs\n" }, { "from": "human", "value": "\"\"\"Mock module for Sphinx autodoc.\"\"\"\n\n\nclass ffi(object):\n\n NULL = NotImplemented\n I_AM_FAKE = True # This is used for the documentation of \"default\"\n\n...
python
chosen
[ { "from": "system", "value": "Use as_array() instead of _data in io.ascii compressed tests\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport os\nimport numpy as np\n\nfrom ....tests.helper import pytest\nfrom .. import read\n\nROOT = os.pa...
python
chosen
[ { "from": "system", "value": "Add timeout config parameter with a default of 20 seconds\n" }, { "from": "human", "value": "import logging\nimport requests\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass APIError(Exception):\n pass\n\n\nclass BaseService(object):\n\n def __init__(self,...
python
chosen
[ { "from": "system", "value": "Write note for test that triggers get request\n" }, { "from": "human", "value": "import unittest\nimport django.test\nfrom django.core.exceptions import ValidationError\n\nfrom core.tests.setups import RobrechtSocialUserFactory\nfrom ..validators import RepoExistanc...
python
chosen
[ { "from": "system", "value": "Remove bad torrents assumes torrent_to_search_string already ran.\n" }, { "from": "human", "value": "from providers.popularity.provider import PopularityProvider\nfrom utils.torrent_util import torrent_to_search_string, remove_bad_torrent_matches\n\nIDENTIFIER = \"T...
python
chosen
[ { "from": "system", "value": "Add optional pretty printing to test runner\n" }, { "from": "human", "value": "import os\nimport json\n\nimport saulify.sitespec as sitespec\n\nSPEC_DIRECTORY = \"sitespecs\"\n\n\nif __name__ == \"__main__\":\n for fname in os.listdir(SPEC_DIRECTORY):\n fp...
python
chosen
[ { "from": "system", "value": "Add '(default)' to sample app\n" }, { "from": "human", "value": "# test.py\r\ndef application(env, start_response):\r\n start_response('200 OK', [('Content-Type', 'text/html')])\r\n #return [b\"Hello World\"] # python3\r\n return [\"Hello World from uwsgi-n...
python
chosen
[ { "from": "system", "value": "Allow subclasses to customise the worker class\n" }, { "from": "human", "value": "from django.core.management import BaseCommand, CommandError\n\nfrom channels import DEFAULT_CHANNEL_LAYER\nfrom channels.layers import get_channel_layer\nfrom channels.log import setu...
python
chosen
[ { "from": "system", "value": "Use padding on the index\n" }, { "from": "human", "value": "from typing import Iterable, Tuple\n\n\ndef gallery(samples: Iterable[Tuple[str, str]], *, refresh: bool = False) -> str:\n lines = []\n\n for url, template in samples:\n if refresh:\n ...
python
chosen
[ { "from": "system", "value": "Use shortcut listen() for starting the HTTPServer.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport threading\nimport tornado.httpserver\nimport tornado.ioloop\nimport tornado.web\n\nfrom astral.conf import settings\nfrom urls import url_patterns\n...
python
chosen
[ { "from": "system", "value": "Use program_name instead of script file name in macOS menu\n" }, { "from": "human", "value": "'''\r\nMain runner entry point for Gooey.\r\n'''\r\n\r\nimport wx\r\n# wx.html and wx.xml imports required here to make packaging with\r\n# pyinstaller on OSX possible with...
python
chosen
[ { "from": "human", "value": "Add a test runner that will execute all the tests in /tests/\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Gathers all tests in the /tests/ subdirectory and runs them.\"\"\"\nimport os\nimport unittest\n\n\ndef main():\n test_loader = unittest.Test...
python
chosen
[ { "from": "system", "value": "Add an __all__ variable to hoomd.upate module\n" }, { "from": "human", "value": "from hoomd.update.box_resize import BoxResize\n\n\n# TODO remove when no longer necessary\nclass _updater:\n pass\n" }, { "from": "gpt", "value": "from hoomd.update.box_r...
python
chosen
[ { "from": "system", "value": "Change version from error to info\n" }, { "from": "human", "value": "import logging\n\nfrom django.utils.version import get_version\nfrom subprocess import check_output, CalledProcessError\n\nlogger = logging.getLogger(__name__)\n\n\nVERSION = (0, 0, 3, 'beta', 1)\n...
python
chosen
[ { "from": "system", "value": "Make pubmed hash accessible to API\n" }, { "from": "human", "value": "\nfrom pubrunner.command_line import *\nfrom pubrunner.upload import *\nfrom pubrunner.FTPClient import *\nfrom pubrunner.getresource import *\nfrom pubrunner.pubrun import pubrun,cleanWorkingDire...
python
chosen
[ { "from": "system", "value": "Implement minimum and maximum values\n" }, { "from": "human", "value": "#!/bin/python3\n\nimport os\nimport sys\n\n# n: the integer number of sticks to buy\n# k: the integer number of box sizes the store carries\n# b: the integer number of boxes to buy\ndef bonetrou...
python
chosen
[ { "from": "system", "value": "Update anime searcher implementation to use super class methods\n\n" }, { "from": "human", "value": "from itertools import chain\nfrom typing import Iterable\n\nfrom minoshiro import Medium, Minoshiro, Site\nfrom minoshiro.helpers import get_synonyms\n\n\nclass Anim...
python
chosen
[ { "from": "system", "value": "Add OCA in authors list\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2016 Onestein (<http://www.onestein.eu>)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\n{\n \"name\": \"Project Task Add Very High\",\n \"...
python
chosen
[ { "from": "system", "value": "Add message on profile form save" }, { "from": "human", "value": "from django.views.generic import DetailView, UpdateView\nfrom django.core.urlresolvers import reverse_lazy\n\nfrom braces.views import LoginRequiredMixin\n\nfrom .models import User\nfrom .forms impor...
python
chosen
[ { "from": "system", "value": "Support Sort Order For TEXT Index\n" }, { "from": "human", "value": "#!/bin/env python\n# \n# Copyright 2010 bit.ly\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may ob...
python
chosen
[ { "from": "system", "value": "Remove ‘<‘ from REDIRECTION_CHARS, it’s no longer used.\n" }, { "from": "human", "value": "#\n# coding=utf-8\n\"\"\"Constants and definitions\"\"\"\n\nimport re\n\n# Used for command parsing, tab completion and word breaks. Do not change.\nQUOTES = ['\"', \"'\"]\nRE...
python
chosen
[ { "from": "system", "value": "Add API key to context\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.utils.crypto import constant_time_compare\nfrom rest_framework.authentication import BasicAuthentica...
python
chosen
[ { "from": "system", "value": "Return its argument in validators\n" }, { "from": "human", "value": "\"\"\":mod:`nirum.validate`\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n\"\"\"\n__all__ = 'validate_boxed_type', 'validate_record_type'\n\n\ndef validate_boxed_type(boxed, type_hint):\n if not isinstance(boxed...
python
chosen
[ { "from": "system", "value": "Add blank space in email message\n" }, { "from": "human", "value": "\"\"\"\nGlue some events together \n\"\"\"\n\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.conf import settings\nfrom django.utils.translation import u...
python
chosen
[ { "from": "system", "value": "pw_docgen: Set Pillow version to 8.2.0\n\nVersion 8.3.0 has yet to be resolved DLL problems on windows.\n\nNo-Docs-Update-Reason: Pip dep fix.\nChange-Id: I50deecd7c5d3a7f5eb01898e13e5ccb5bedfabf2\nReviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/52041\n...
python
chosen