conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Bump up version to 0.1.1\n" }, { "from": "human", "value": "from distutils.core import setup\n\nwith open('requirements.txt') as req_file:\n requirements = req_file.read().splitlines()\n\nsetup(\n name='fleet-py',\n install_requires=requirements,\n versi...
python
chosen
[ { "from": "system", "value": "Add simplejson as a required module\n\n\ngit-svn-id: 9a050473c2aca1e14f53d73349e19b938c2cf203@11666 6a7f98fc-eeb0-4dc1-a6e2-c2c589a08aa6\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"installer script for pywikibot 2.0 framework\"\"\"\n#\n# (C) P...
python
chosen
[ { "from": "system", "value": "Add 3.6 to trove classifiers [skipci]\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\nfrom virtualenvapi import __version__\n\nsetup(\n name='virtualenv-api',\n version=__version__,\n license='BSD',\n author='Sam Kingsto...
python
chosen
[ { "from": "system", "value": "Bump version number for release\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nwith open(\"README.rst\") as f:\n readme = f.read()\n\nsetup(\n name=\"rply\",\n description=\"A pure Python Lex/Yacc that works with RPython\",\n long_d...
python
chosen
[ { "from": "system", "value": "DOC: Update content type for description\n\nPyPI rejects uploads that fail to render.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom os.path import exists\nfrom setuptools import setup\n\n\n\nsetup(name='cachey',\n version='0.2.0',\n desc...
python
chosen
[ { "from": "system", "value": "Use django rest framework > 3.1\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\n__version__ = \"0.0.13\"\n\n\nsetup(\n # package name in pypi\n name='django-oscar-api',\n # extract version from module.\n version=__vers...
python
chosen
[ { "from": "system", "value": "DOC: Set default syntax highlighting language to 'none'\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Use sphinx-quickstart to create your own conf.py file!\n# After that, you have to edit a few things. See below.\n\n# Sele...
python
chosen
[ { "from": "system", "value": "Drop alpha tag from package\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nRaven\n======\n\nRaven is a Python client for `Sentry <http://aboutsentry.com/>`_. It provides\nfull out-of-the-box support for many of the popular frameworks, including\nD...
python
chosen
[ { "from": "system", "value": "Add pyzmq. Note: this package doesn't need it but IPython notebook does\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.co...
python
chosen
[ { "from": "system", "value": "Install the data files correctly too.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom setuptools import setup\nimport glob\nfrom spec_cleaner import __version__\n\ntest_requires = [\n 'mock',\n 'nose',\n]\n\nsetup(\n ...
python
chosen
[ { "from": "system", "value": "Use HTTPS in download URL\n\nIt appears that PyPI is now HTTPS-only." }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='trac-github',\n version='2.1.5',\n author='Aymeric Augustin',\n author_email='aymeric.augustin@m4x.org',\...
python
chosen
[ { "from": "system", "value": "Add custom psiTurk as dependency link\n" }, { "from": "human", "value": "\"\"\"Install Wallace as a command line utility.\"\"\"\n\nfrom setuptools import setup\n\nsetup_args = dict(\n name='wallace-platform',\n packages=['wallace'],\n version=\"0.11.2\",\n ...
python
chosen
[ { "from": "system", "value": "Add entry point to run mailroom from command line.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup\n\nsetup(\n name=\"mailroom\",\n description=\"The mailroom implementation tracks donations and send thank you letters.\...
python
chosen
[ { "from": "system", "value": "Add requests as a requirement.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport io\nfrom os import path\nfrom setuptools import setup, find_packages\n\nfrom pywind import __version__\n\n# Get the long description from the relevant file\nhere = path.a...
python
chosen
[ { "from": "system", "value": "Add zeep library as requirement\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='primestg',\n version='1.1.0',\n packages=find_packages(),\n url='https://github.com/gisce/primestg',\n license='GNU Affe...
python
chosen
[ { "from": "system", "value": "Allow the test to be run without 'schema=' parameter in the DB URI.\n\n\ngit-svn-id: 07e5abd2c6e244bc465bf007dc23a4c6bc1bee58@3524 95a46c32-92d2-0310-94a5-8d71aeb3d4b3\n" }, { "from": "human", "value": "from sqlobject import *\nfrom sqlobject.tests.dbtest import *\n...
python
chosen
[ { "from": "system", "value": "chore(pins): Update dictionaryutils pins to get latest\n\n- Update dictionaryutils pins to get version with data release\nchanges\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='gdcdatamodel',\n packages=find_pa...
python
chosen
[ { "from": "system", "value": "Include show_upgraded_packages task from ARCTasks\n" }, { "from": "human", "value": "from arctasks import lint # noqa\nfrom arctasks.release import * # noqa\n" }, { "from": "gpt", "value": "from arctasks import lint # noqa\nfrom arctasks.python import...
python
chosen
[ { "from": "system", "value": "Load extensions given in IV_LIBS variable.\n" }, { "from": "human", "value": "\"\"\"\nHelper classes for creating 3D applications with PySide.\n\nPySide is a binding to the Qt cross-platform application framework. This\npackage contains helper classes that integrate...
python
chosen
[ { "from": "system", "value": "Fix string encoding when the argument is already a str().\n\n\nFormer-commit-id: 812fd79675590659b3dc4251ed998f84c4bf2395" }, { "from": "human", "value": "import os\nimport sys\nimport hashlib\n\ndef e(s):\n if type(s) == str:\n return str\n return s.en...
python
chosen
[ { "from": "system", "value": "Clear samplesheet parser from header\n" }, { "from": "human", "value": "import os\nimport re\nimport csv\nimport glob\nimport shutil\nimport gzip\nimport operator\nimport subprocess\nfrom datetime import datetime\nfrom taca.utils.filesystem import chdir, control_fas...
python
chosen
[ { "from": "system", "value": "Correct identation error in sample.\n" }, { "from": "human", "value": "import sys\nimport json\nfrom textblob import TextBlob\n\n# set default encoding to UTF-8 to eliminate decoding errors\nreload(sys)\nsys.setdefaultencoding('utf8')\n\ndef get_stdin():\n buf = ...
python
chosen
[ { "from": "system", "value": "Create dir before data downloading\n" }, { "from": "human", "value": "import bz2\r\nimport urllib.request\r\n\r\nOPEN_CORPORA_URL = 'http://opencorpora.org/files/export/annot/annot.opcorpora.no_ambig.xml.bz2'\r\nOPEN_CORPORA_DEST_FILE = 'data/annot.opcorpora.no_ambi...
python
chosen
[ { "from": "system", "value": "Remove test of deprecated method\n" }, { "from": "human", "value": "from neomodel import StructuredNode, StringProperty, CypherException\n\n\nclass User2(StructuredNode):\n email = StringProperty()\n\n\ndef test_start_cypher():\n jim = User2(email='jim@test.co...
python
chosen
[ { "from": "system", "value": "Fix migration file that didn't work correctly\n\n" }, { "from": "human", "value": "\"\"\"industry index remove date\n\nRevision ID: 88d46e8e73ef\nRevises: 6543398f0773\nCreate Date: 2016-03-08 19:51:18.026000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nre...
python
chosen
[ { "from": "system", "value": "Fix mock statement for new API\n" }, { "from": "human", "value": "from io import BytesIO\nfrom unittest.mock import MagicMock, patch\n\nfrom isort import hooks\n\n\ndef test_git_hook():\n \"\"\"Simple smoke level testing of git hooks\"\"\"\n\n # Ensure correct...
python
chosen
[ { "from": "system", "value": "Print task SID in output" }, { "from": "human", "value": "# Download the helper library from https://www.twilio.com/docs/python/install\nfrom twilio.rest import Client\n\n# Your Account Sid and Auth Token from twilio.com/console\naccount_sid = 'ACXXXXXXXXXXXXXXXXXXX...
python
chosen
[ { "from": "system", "value": "Add docs for add transform_data helper method.\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom providers.provider import BaseProvider\n\n# Subclasses implement a way to get movie data for from a search string\n#\n# To implement a Movie...
python
chosen
[ { "from": "system", "value": "Test stochstic graph with ints\n" }, { "from": "human", "value": "from nose.tools import assert_true, assert_equal,assert_raises\nimport networkx as nx\n\ndef test_stochastic():\n G=nx.DiGraph()\n G.add_edge(0,1)\n G.add_edge(0,2)\n S=nx.stochastic_graph...
python
chosen
[ { "from": "system", "value": "Update the tests for query_pricing\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n# vim:fenc=utf-8\n#\n# Copyright © 2016 <>\n#\n# Distributed under terms of the MIT license.\n\n# Python modules\nfrom __future__ import unicode_l...
python
chosen
[ { "from": "system", "value": "Correct and simplify calculation of miliseconds\n\nSigned-off-by: TeaPackCZ <a78d8486eff6e2cb08b2d9907449b92187b8e215@gmail.com>\n" }, { "from": "human", "value": "import time\n\nclass Logger():\n def __init__(self, name = \"defaultLogFile\"):\n timestamp ...
python
chosen
[ { "from": "system", "value": "Apply revert to the draft page.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom cms.management.commands.subcommands.base import SubcommandsCommand\nfrom cms.models import CMSPlugin\nfrom cms.models.pagemodel import Page\nfrom django.core.management....
python
chosen
[ { "from": "system", "value": "Remove image name dependency on object ID\n" }, { "from": "human", "value": "import os\n\nfrom django.db import models\n\n# ------------------------------------------------------------------------------\n# General utilities\n# ---------------------------------------...
python
chosen
[ { "from": "system", "value": "Test commit to see if commit signing on Windows works.\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\n\n\ndef main():\n\tpass\n\nif __name__ == '__main__':\n\tmain()" }, { "from": "gpt", "value": "#! /usr/bin/env python3\n\n\n\ndef main():...
python
chosen
[ { "from": "system", "value": "Make the timestamp more sane.\nAdd the ability to run once and exit for use with cron.\n" }, { "from": "human", "value": "\"\"\"\nLogs key data from a Fronius inverter to a CSV file for later analysis.\npeter.marks@pobox.com\n\"\"\"\n\nimport requests\nimport json\n...
python
chosen
[ { "from": "system", "value": "Add some docs to GabbiFixture\n" }, { "from": "human", "value": "\"\"\"Manage fixtures for gabbi at the test file level.\"\"\"\n\n\ndef start_fixture(fixture_class):\n \"\"\"Create the fixture class and start it.\"\"\"\n fixture = fixture_class()\n fixture....
python
chosen
[ { "from": "system", "value": "Add recv_keys and add_repo to apt" }, { "from": "human", "value": "import os\nfrom subprocess import call\nfrom functools import partial\n\n\n#TODO: stop using sudo or ensure it exists\n#TODOE: specify user to run as\n#TODO: utilize functools partial to handle some ...
python
chosen
[ { "from": "system", "value": "Add default_logging function to package namespace\n" }, { "from": "human", "value": "from base import (GrabError, DataNotFound, GrabNetworkError,\n GrabMisuseError, UploadContent, UploadFile,\n GrabTimeoutError)\nfrom transport.curl...
python
chosen
[ { "from": "system", "value": "Fix reference to `md_data` in sample data\n" }, { "from": "human", "value": "'''\nThis module provides U.S. marriage and divorce statistics between 1867 and 2014\n\nData from the CDC's National Center for Health Statistics (http://www.cdc.gov/nchs/) (NCHS) database\...
python
chosen
[ { "from": "system", "value": "Handle lists of URLs like in r-ada\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport yaml\n\nlinux = yaml.load(open('data_linux-64.yml'))\nres = yaml.load(open('data_osx-.yml'))\nres.extend(linux)\n\n# Remove duplicates\nunique_packages = {}\nfor pa...
python
chosen
[ { "from": "system", "value": "Add /api endpoint and basic HTML\n" }, { "from": "human", "value": "from flask import Flask\napplication = Flask(__name__)\n\n@application.route('/')\ndef hello_world():\n return 'Hello, World!'\n\n\nif __name__ == \"__main__\":\n application.debug = True\n ...
python
chosen
[ { "from": "system", "value": "Load BNC into memory and time process.\n" }, { "from": "human", "value": "import nltk.corpus.reader.bnc\n" }, { "from": "gpt", "value": "import nltk.corpus.reader.bnc\nimport time\n\n\nstart_time = time.perf_counter()\nBNC_data = nltk.corpus.reader.bnc.B...
python
chosen
[ { "from": "system", "value": "Use constant resource to be replaced on reconnect\n\nNetwork failures may leave the \"ghost\" bot in the MUC, and unless\nit receives a MUC stanza while a replacement is offline, it may\nhang in the room forever. Messages are sent to the new resource in\nthat case.\n\nhttps://x...
python
chosen
[ { "from": "system", "value": "Fix java VM starting when there is not classpath set\n" }, { "from": "human", "value": "\"\"\"Handles all imports from jnius to prevent conflicts resulting from attempts\nto set JVM options while the VM is already running.\"\"\"\n\nimport os\nimport warnings\nimport...
python
chosen
[ { "from": "system", "value": "Add the location of the ql library.\n" }, { "from": "human", "value": "import setuptools\n\nqu_ext = setuptools.Extension(\n 'quantuccia',\n sources=['src/pyQuantuccia.cpp']\n)\n\nsetuptools.setup(\n name='pyQuantuccia',\n version='0.1.0',\n packages=...
python
chosen
[ { "from": "system", "value": "Add extra validation for Google Play signature\n" }, { "from": "human", "value": "from pyinapp.errors import InAppValidationError\nfrom pyinapp.purchase import Purchase\nimport base64\nimport json\nimport rsa\n\n\npurchase_state_ok = 0\n\n\ndef make_pem(public_key):...
python
chosen
[ { "from": "system", "value": "Fix LoggerMixin test\nBranch: feature/bulk-messaging-api\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim: ai ts=4 sts=4 et sw=4\n\n\nfrom nose.tools import assert_equals, assert_raises\nfrom ..log.mixin import LoggerMixin\n\n\nclass LoggableStub(obje...
python
chosen
[ { "from": "system", "value": "Update active templatetag to accept more complex strings\n" }, { "from": "human", "value": "import re\nfrom django import template\nfrom django.conf import settings\n\n\nregister = template.Library()\n\n@register.simple_tag(takes_context=True)\ndef active(context, p...
python
chosen
[ { "from": "system", "value": "Switch the default config to use in memory sqlite\n" }, { "from": "human", "value": "SECRET_KEY = '%^!@@*!&$8xdfdirunb52438#(&^874@#^&*($@*(@&^@)(&*)Y_)((+'\nAUTHY_KEY = 'your_authy_key'\n\nTWILIO_ACCOUNT_SID = 'your_twilio_account_sid'\nTWILIO_AUTH_TOKEN = 'your_t...
python
chosen
[ { "from": "system", "value": "Save word counts to file.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport requests\nimport ipdb\nimport time\nimport csv\nimport sys\nimport pysolr\n\ndef fetch_all( solr, query ) :\n documents = []\n num_matching_documents = solr.search( query ...
python
chosen
[ { "from": "system", "value": "Support apostrophe and period in dictation (and minus, just in case).\n\nExample: \"phrase don't like x. rays\".\n" }, { "from": "human", "value": "import os\n\nclass Automator:\n def __init__(self, real = True):\n self.xdo_list = []\n self.real = r...
python
chosen
[ { "from": "system", "value": "Remove unneeded default Listener implementation\n" }, { "from": "human", "value": "from guv.hubs.abc import AbstractListener\n\n\nclass FdListener(AbstractListener):\n \"\"\"Default implementation of :cls:`AbstractListener`\n \"\"\"\n pass\n\n\nclass PollFd...
python
chosen
[ { "from": "system", "value": "Simplify the notification tag.\nNo longer can store the value in a variable.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.template import Library\nfrom django.template.base import TemplateSyntaxError\nfrom notifications.models import Notif...
python
chosen
[ { "from": "system", "value": "Transformations: Add to_float function and add num keyword\n" }, { "from": "human", "value": "def to_int(value):\n return int(value)\n\ndef identity(value):\n return value" }, { "from": "gpt", "value": "def to_int(value, num=None):\n return int(...
python
chosen
[ { "from": "system", "value": "Add extra tests to query string query model\n" }, { "from": "human", "value": "from positive_test_suite import PositiveTestSuite\nfrom negative_test_suite import NegativeTestSuite\n\nimport os\nimport sys\nsys.path.append(os.path.join(os.path.dirname(__file__), \".....
python
chosen
[ { "from": "system", "value": "Make sure files and FS are properly closed in open_archive\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport contextlib\n\n@contextlib.contextmanager\ndef open_archive(fs_url...
python
chosen
[ { "from": "system", "value": "Add approved set to gmu\n" }, { "from": "human", "value": "\"\"\"\nHarvester for Mason Archival Repository Service for the SHARE NS\n\"\"\"\n\nfrom __future__ import unicode_literals\nfrom scrapi.base import OAIHarvester\n\n\nclass MasonArchival(OAIHarvester):\n ...
python
chosen
[ { "from": "system", "value": "Use run_module_suite instead of deprecated NumpyTest.\n" }, { "from": "human", "value": "import numpy as np\nfrom numpy.testing import *\n\nimport scipy.ndimage as ndimage\n\ndef test_byte_order_median():\n \"\"\"Regression test for #413: median_filter does not h...
python
chosen
[ { "from": "system", "value": "Fix the 'www.' strip changing the lstrip method by the replace\n" }, { "from": "human", "value": "import re\nimport urllib2\nimport urlparse\n\nbucket_name_regex = re.compile(\"(.+).s3.amazonaws.com\")\n\n\ndef bucket_name_from_url(url):\n domain = urlparse.urlpa...
python
chosen
[ { "from": "system", "value": "Append trailing slash to detail URL\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom cms_genome_browser.views import BrowserListView, BrowserDetailView\n\nurlpatterns = patterns('',\n url(r'^$', BrowserListView.as_view(), name='...
python
chosen
[ { "from": "system", "value": "Add CAS 3.0 specific endpoints\n" }, { "from": "human", "value": "\"\"\"\nURLconf for CAS server URIs as described in the CAS protocol.\n\"\"\"\n\nfrom django.conf.urls import patterns\nfrom django.conf.urls import url\n\nfrom mama_cas.views import LoginView\nfrom m...
python
chosen
[ { "from": "system", "value": "Raise exception if faulty definition of classes inserted\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"common.py\n\nContains basic functions that are shared thoughout the module\n\"\"\"\n\n\ndef compute_totals(distribution, classes):\n \"Compu...
python
chosen
[ { "from": "system", "value": "Discard None values in projections in publishers\n" }, { "from": "human", "value": "from shared.base_component import BaseComponent\n\nclass BasePublisher(BaseComponent):\n def __init__(self, conf):\n BaseComponent.__init__(self, conf)\n\n def publish(s...
python
chosen
[ { "from": "system", "value": "Add regex password validation to register form\n\nChecks for password complexity on registartion\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, PasswordField, BooleanField\nfrom wtforms.validators import (DataReq...
python
chosen
[ { "from": "system", "value": "Remove debugging print statements\nchanged exit status from 1 to 0\n" }, { "from": "human", "value": "import urllib2\nimport json\n\n#response = urllib2.urlopen('http://rest.kegg.jp/list/pathway/ath')\n#html = response.read()\n#lines = html.split('\\n');\n#data = {}...
python
chosen
[ { "from": "system", "value": "Add test case for Item __str__ function\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom .models import Depot\n\nclass DepotTestCase(TestCase):\n\n def test_str(self):\n depot = Depot(1, \"My depot\")\n self.assertEqual(depo...
python
chosen
[ { "from": "system", "value": "Move around assertions as Ian talked about\n" }, { "from": "human", "value": "from datacats.cli.pull import _retry_func\nfrom datacats.error import DatacatsError\nfrom unittest import TestCase\n\n\ndef raise_an_error(_):\n raise DatacatsError('Hi')\n\n\nclass Tes...
python
chosen
[ { "from": "system", "value": "Stop grabbing password when there is no username\n" }, { "from": "human", "value": "\"\"\"Command line interface to the OSF\"\"\"\n\nimport os\n\nfrom .api import OSF\n\nCHUNK_SIZE = int(5e6)\n\n\ndef _setup_osf(args):\n # command line argument overrides environm...
python
chosen
[ { "from": "system", "value": "Use our own code, when possible.\n" }, { "from": "human", "value": "from django.shortcuts import get_object_or_404\nfrom django.utils.decorators import available_attrs\nfrom django.utils.http import urlquote\nfrom django.http import HttpResponse\nfrom django.templat...
python
chosen
[ { "from": "system", "value": "Add more details to py35 EoL changes\n" }, { "from": "human", "value": "import os\nimport sys\nfrom contextlib import contextmanager\n\n\ndef is_buffer(obj, mode):\n return (\"r\" in mode and hasattr(obj, \"read\")) or (\n \"w\" in mode and hasattr(obj, \"...
python
chosen
[ { "from": "system", "value": "Use parameter to pass Webdriver object to share execution\n" }, { "from": "human", "value": "#\n# HamperAuthenticator is the class to handle the authentication part of the provisioning portal.\n# Instantiate with the email and password you want, it'll pass back the ...
python
chosen
[ { "from": "system", "value": "Bump version to beta 3\n" }, { "from": "human", "value": "\"\"\"Current version string for NPC\"\"\"\n\n__version__ = \"1.3.1 beta 2\"\n" }, { "from": "gpt", "value": "\"\"\"Current version string for NPC\"\"\"\n\n__version__ = \"1.3.1 beta 3\"\n" } ]
python
chosen
[ { "from": "system", "value": "Rename ModulesCommand to be more appropriate\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass ModulesCommand(ModuleData):\n\timplements(...
python
chosen
[ { "from": "system", "value": "Make dashboard route become admin's default\n" }, { "from": "human", "value": "from openedoo_project import db\nfrom openedoo.core.libs import Blueprint\nfrom .controllers.employee import EmployeeLogin, EmployeeLogout, AddEmployee, \\\n AssignEmployeeAsTeacher, E...
python
chosen
[ { "from": "system", "value": "Add meta information to the nacl package\n" }, { "from": "human", "value": "from . import hash # pylint: disable=W0622\n" }, { "from": "gpt", "value": "from . import __about__\nfrom . import hash # pylint: disable=W0622\n\n\n__all__ = [\"hash\"] + __ab...
python
chosen
[ { "from": "system", "value": "Enable Django secure mode in WSGI module\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for oabutton project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It should expose a module-lev...
python
chosen
[ { "from": "system", "value": "Use the file's storage to determine whether the file exists or not.\nThe existing implementation that uses posixpath.exists only works if the storage backend is the default FileSystemStorage\n" }, { "from": "human", "value": "from posixpath import exists\n\nfrom cms...
python
chosen
[ { "from": "system", "value": "Reset personnel page back to ordering by creation date.\n" }, { "from": "human", "value": "'''This app contains the views for the personnel app.\n\n'''\n\nfrom django.views.generic.list import ListView\nfrom django.views.generic.detail import DetailView\n\nfrom pers...
python
chosen
[ { "from": "system", "value": "DOC: Add an explanation of how to set up a namespace package\n" }, { "from": "human", "value": "__path__ = __import__('pkgutil').extend_path(__path__, __name__)\n" }, { "from": "gpt", "value": "\"\"\"\nThe PyBIDS extension namespace package\n\n``bids.ext...
python
chosen
[ { "from": "system", "value": "Add jpg link for flickr downloads\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\"\"\"Zip builder module for pybossa-analyst.\"\"\"\n\nimport requests\nimport zipstream\n\n\ndef _download(url):\n \"\"\"Download data from a URL.\"\"\"\n yield reque...
python
chosen
[ { "from": "system", "value": "Add low and high options to AdditiveGaussian\n" }, { "from": "human", "value": "from __future__ import division\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import absolute_import\nfrom builtins import * # NOQA\nf...
python
chosen
[ { "from": "system", "value": "Enable external database (non dss) suport for KeyValueStorage" }, { "from": "human", "value": "\nimport pymongo\n\nfrom .config import config\nfrom .tools import show\n\nclient = pymongo.MongoClient()\nconf = config['database']\ndatabase_name = conf['name']\n_db = c...
python
chosen
[ { "from": "system", "value": "Fix unit tests for notes\n" }, { "from": "human", "value": "import unittest\n\nimport requests_mock\n\nfrom alertaclient.api import Client\n\n\nclass NotesTestCase(unittest.TestCase):\n\n def setUp(self):\n self.client = Client()\n\n self.note = \"\...
python
chosen
[ { "from": "system", "value": "Call super __init__ in GameMDP\n" }, { "from": "human", "value": "from .mdp import MDP\nfrom .game_mdp import GameMDP\nfrom ..utils import utility\n\n\nclass FixedGameMDP(GameMDP):\n\n def __init__(self, game, opp_player, opp_idx):\n '''\n opp_playe...
python
chosen
[ { "from": "system", "value": "Allow specifying fields for model_details\n" }, { "from": "human", "value": "from django import template\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\n\n\nregister = template.Library()\n\n\n@register.filter\ndef model_details(instance...
python
chosen
[ { "from": "system", "value": "Add warning about setup.py import\n" }, { "from": "human", "value": "__version__='0.01'\n" }, { "from": "gpt", "value": "# As setup.py imports this module to get the version, try not to do anything\n# with dependencies for the project here. If that hap...
python
chosen
[ { "from": "system", "value": "Add solution using format method for centering.\n" }, { "from": "human", "value": "\"\"\"Output a tree of stars like so:\n\n *\n ***\n *\n ***\n *****\n *\n ***\n *****\n *******\n\nInput argument is the number of levels to the tree (3 in this examp...
python
chosen
[ { "from": "system", "value": "Make it more obvious that values initialize at 0\n" }, { "from": "human", "value": "import os\nimport mmstats\nimport libgettid\n\nclass MyStats(mmstats.BaseMmStats):\n pid = mmstats.StaticUIntField(label=\"sys.pid\", value=os.getpid)\n tid = mmstats.StaticInt...
python
chosen
[ { "from": "system", "value": "Raise a ValueError from _get_archive_filelist instead of Exception\n\nRaising the Exception base class is considered bad style, as the more\nspecialized child classes carry more information about the kind of error that\noccurred. And often no-one actually tries to catch the Exc...
python
chosen
[ { "from": "system", "value": "Use legacy docstrings with numpy 1.14\n\nFor an explanation, see https://github.com/numpy/numpy/blob/master/doc/release/1.14.0-notes.rst#many-changes-to-array-printing-disableable-with-the-new-legacy-printing-mode.\n" }, { "from": "human", "value": "from ._version i...
python
chosen
[ { "from": "system", "value": "Add fab task to rebuild production database\n" }, { "from": "human", "value": "from fabric.api import env, cd, run, shell_env, sudo\n\nenv.hosts = ['134.213.147.235']\nenv.user = 'root'\nenv.key_filename = '~/.ssh/id_di'\nenv.forward_agent = True\n\n\ndef deploy():\...
python
chosen
[ { "from": "system", "value": "Connect search route to app\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'pysearch.views.home', name=...
python
chosen
[ { "from": "system", "value": "Fix issue with missing space after replacement\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\"\"\"Pandoc filter that replaces labels of format {#?:???}, where ? is a\nsingle lower case character defining the type and ??? is an alphanumeric\nlabel, wit...
python
chosen
[ { "from": "system", "value": "Set completions meta-text styling to match\n" }, { "from": "human", "value": "from pygments.token import Token\nfrom pygments.style import Style\nfrom pygments.util import ClassNotFound\nfrom prompt_toolkit.styles import default_style_extensions\nimport pygments.sty...
python
chosen
[ { "from": "system", "value": "Allow cleaning file cache in non default place\n" }, { "from": "human", "value": "import os\n\nfrom django.core.management.base import BaseCommand\n\nfrom cacheops.conf import settings\n\n\nclass Command(BaseCommand):\n help = 'Clean filebased cache'\n\n def h...
python
chosen
[ { "from": "system", "value": "Fix a bug that will lead to error when external_login() is called\n" }, { "from": "human", "value": "import requests\nfrom flask import abort, session\nfrom webViews.log import logger\n\n\nendpoint = \"http://0.0.0.0:9000\"\n\nclass dockletRequest():\n\n @classme...
python
chosen
[ { "from": "system", "value": "Update the use of now()" }, { "from": "human", "value": "import datetime\n\nfrom django.db import models\n\nfrom django.contrib.auth.models import User\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes import generic\n\n\n...
python
chosen
[ { "from": "system", "value": "Fix typo in constructor. Seems unnecessary anyway.\n" }, { "from": "human", "value": "from ckan.lib.base import BaseController\nfrom pylons import config\n\nclass QAController(BaseController):\n\n def __init__(self, *args, **kwargs):\n super(QAController, ...
python
chosen
[ { "from": "system", "value": "Add layer to module imports\n" }, { "from": "human", "value": "# flake8:noqa\nfrom deepchem.models.torch_models.torch_model import TorchModel\nfrom deepchem.models.torch_models.attentivefp import AttentiveFP, AttentiveFPModel\nfrom deepchem.models.torch_models.cgcnn...
python
chosen
[ { "from": "system", "value": "Use json (from stdlib) instead of simplejson from django utils\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n__author__ = 'sandlbn'\n\nfrom django.utils import simplejson\nfrom django.db.models.query import QuerySet\n\n\ndef event_serializer(events):\n...
python
chosen