conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "[TDF] Replace tabs with spaces in the unit tests.\n" }, { "from": "human", "value": "import unittest\nimport ROOT\n\nclass HistogramsFromTDF(unittest.TestCase):\n @classmethod\n def setUp(cls):\n ROOT.gRandom.SetSeed(1)\n\n def test_histo1D(self):\n ...
python
chosen
[ { "from": "system", "value": "Use partial for duplicated partial string\n" }, { "from": "human", "value": "\"\"\"Leetcode 131. Palindrome Partitioning\nMedium\n\nURL: https://leetcode.com/problems/palindrome-partitioning/\n\nGiven a string s, partition s such that every substring of the partitio...
python
chosen
[ { "from": "system", "value": "[FIX] account_banking_payment_export: Check if column exists before creating it\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# This module copyright (C) 2015 Therp B...
python
chosen
[ { "from": "system", "value": "Drop loading jquery by django-debug-toolbar - it is integrated now\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nLocal Configurations\n\n- Runs in Debug mode\n- Uses console backend for emails\n- Use Django Debug Toolbar\n'''\nfrom configurations ...
python
chosen
[ { "from": "system", "value": "Fix Python 2-to-3 bug in in-app messages\n\n…so that the permission check for `PATCH`ing `interactions` does not\nalways fail. Fixes #2762\n" }, { "from": "human", "value": "# coding: utf-8\nfrom rest_framework import permissions\n\n\nclass InAppMessagePermissions(p...
python
chosen
[ { "from": "system", "value": "Remove arg create because it will use closest_photodb.\n" }, { "from": "human", "value": "'''\nThis file is the WSGI entrypoint for remote / production use.\n\nIf you are using Gunicorn, for example:\ngunicorn etiquette_flask_prod:site --bind \"0.0.0.0:PORT\" --acce...
python
chosen
[ { "from": "system", "value": "Remove cert requirements from hopefully last spot\n" }, { "from": "human", "value": "\"\"\"Heroku web worker.\"\"\"\nlisten = [\"high\", \"default\", \"low\"]\n\n\ndef main():\n import gevent.monkey\n\n gevent.monkey.patch_all()\n from gevent.queue import L...
python
chosen
[ { "from": "system", "value": "Fix citation formatting in docstring\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Processor for the `Chemical Roles Graph (CRoG)\n<https://github.com/chemical-roles/chemical-roles>`_.\n\nContains axiomization of ChEBI roles, their targets, and...
python
chosen
[ { "from": "system", "value": "Add test for alternate version of cast credit\n" }, { "from": "human", "value": "import wikiquote\nimport unittest\n\nclass QuotesTest(unittest.TestCase):\n \"\"\"\n Test wikiquote.quotes()\n \"\"\"\n\n def test_disambiguation(self):\n self.assert...
python
chosen
[ { "from": "system", "value": "Fix: Test missing checking for InvalidOrderException raised\n" }, { "from": "human", "value": "# coding: utf-8\nimport pytest\nfrom mmvdApp.utils import objective_function\nfrom mmvdApp.utils import valid_solution\n\n\n@pytest.mark.utils\n@pytest.mark.linprog\ndef t...
python
chosen
[ { "from": "system", "value": "Support the new google play motion activity format\n\nAs part of the change to slim down the apk for android,\nhttps://github.com/e-mission/e-mission-phone/pull/46,\nhttps://github.com/e-mission/e-mission-data-collection/pull/116\nwe switched from google play version from 8.1.0...
python
chosen
[ { "from": "system", "value": "Remove old criuft. FIx. Partially fix export issue.\n" }, { "from": "human", "value": "\"\"\"\nExports tutorial materials written in Jupyter notebooks in the ../notebooks/tutorial folder to RST pages and their\nsupport files in the ../docs/tutorial folder.\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Change to use app factory\n" }, { "from": "human", "value": "from dasem.app import app\n\n# WSGIServer server better than werkzeug\n# http://stackoverflow.com/questions/37962925/\nfrom gevent.wsgi import WSGIServer\nhttp_server = WSGIServer(('', 5000), app)\nhttp_se...
python
chosen
[ { "from": "system", "value": "Add plotting to the default imports of cmssw.\n" }, { "from": "human", "value": "from job import JobProvider\nfrom publish import publish\nfrom jobit import JobitStore\nfrom merge import MergeProvider\n" }, { "from": "gpt", "value": "from job import JobP...
python
chosen
[ { "from": "system", "value": "Allow POST requests on server side\n" }, { "from": "human", "value": "\"\"\"Web app that serves proselint's API.\"\"\"\n\nfrom flask import Flask, request\nimport subprocess\nfrom flask_cors import CORS, cross_origin\nimport uuid\nimport os\nimport re\nimport urllib...
python
chosen
[ { "from": "system", "value": "Create logic to post DM to user on slack when user id is provided\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_restful import Resource, Api\nfrom slackclient import SlackClient\n\napp = Flask(__name__)\napi = Api(app)\n\n\nclass RealName(Re...
python
chosen
[ { "from": "system", "value": "Add recognition of )OFF to mean exit gracefully\n" }, { "from": "human", "value": "\"\"\"\n The top level of the APL Read-Evaluate-Print loop\n\n UNDER DEVELOPMENT\n\n This version adds trivial apl_quit() and apl_exit() routines to the read-evaluate-print l...
python
chosen
[ { "from": "system", "value": "Add missing space for exception message.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nFile: run.py\nAuthor: huxuan <i(at)huxuan.org>\nDescription: Run script for app.\n\"\"\"\nimport os.path\n\nif not os.path.isfile('con...
python
chosen
[ { "from": "system", "value": "Update flask app to be compatible with the emulator script\n" }, { "from": "human", "value": "from flask import Flask, request, redirect\nimport twilio.twiml\n\napp = Flask(__name__)\n\n@app.route(\"/\", methods=['GET', 'POST'])\ndef hello():\n #resp = twilio.twi...
python
chosen
[ { "from": "system", "value": "Convert license detail to pytest\n" }, { "from": "human", "value": "from nose.tools import * # flake8: noqa\nimport functools\n\nfrom tests.base import ApiTestCase\nfrom osf.models.licenses import NodeLicense\nfrom api.base.settings.defaults import API_BASE\n\n\ncl...
python
chosen
[ { "from": "system", "value": "Change python code to only listen on localhost\n" }, { "from": "human", "value": "import serial.tools.list_ports\nimport serial\nimport socket\n\n\nports = list(serial.tools.list_ports.comports())\narduino_port = next((port for port in ports if \"Arduino\" in port.d...
python
chosen
[ { "from": "system", "value": "Fix import order in tests.\n" }, { "from": "human", "value": "import imp\nimport os\nimport sys\n\nfrom django.test import TestCase\n\nfrom kolibri import dist as kolibri_dist\n\ndist_dir = os.path.realpath(os.path.dirname(kolibri_dist.__file__))\n\n\nclass FutureAn...
python
chosen
[ { "from": "system", "value": "Modify AnalogInput initialization, add exception handling.\n" }, { "from": "human", "value": "\"\"\"\nThis module provides classes for interfacing with analog plugins.\n\"\"\"\nimport json\nfrom myDevices.plugins.manager import PluginManager\nfrom myDevices.utils.lo...
python
chosen
[ { "from": "system", "value": "Fix URL fragment management on Firefox\n\nClose Bug: 13\n\nChange-Id: If3e3182e670b4c498043a58f2b5a82cb87560722\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\n\nfrom string import Template\n\nprint \"Content-Type: text/html\"\nprint\n\ntmpl = Tem...
python
chosen
[ { "from": "system", "value": "TEST use same amount of noise for frank wolfe test as for other test. Works now that C is scaled correctly :)\n" }, { "from": "human", "value": "\nfrom numpy.testing import assert_array_equal\n\nfrom pystruct.models import GridCRF\n\nfrom pystruct.datasets import ge...
python
chosen
[ { "from": "system", "value": "Use OptionParser instead of simple sys.argv.\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport string\n\nif __name__ == \"__main__\":\n import sys\n\n template_file = sys.argv[1]\n\n with open(template_file) as f:\n data = f.read()\n\n ...
python
chosen
[ { "from": "system", "value": "Fix the python-windows installer generator by making it include the .dll\nfiles in the installer. That list originally consisted only of \"*.dll\".\nWhen the build system was modified to generate .pyd files for the binary\nmodules, it was changed to \"*.pyd\". The Subversion li...
python
chosen
[ { "from": "system", "value": "Allow blank entries for title and description for flatpages\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 title ...
python
chosen
[ { "from": "system", "value": "Fix make_fun_curry_spec for functions with no defaults\n" }, { "from": "human", "value": "from inspect import getargspec\nfrom .curry_spec import CurrySpec\nfrom ..accepts_varargs import accepts_varargs\n\n\nclass CurrySpecVarargError(ValueError):\n def __init__(...
python
chosen
[ { "from": "system", "value": "1.0.0: Change URL to point to trac-hacks.org\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2009-2010 Sebastian Krysmanski\n# Copyright (C) 2012 Greg Lavallee\n# All rights reserved.\n#\n# This software is licensed as described in the...
python
chosen
[ { "from": "system", "value": "Install the nanomsg.h file, we need it.\n" }, { "from": "human", "value": "from setuptools import setup\nimport generate\n\ngenerate.run()\n\nsetup(\n name='nnpy',\n version='0.1',\n url='https://github.com/djc/jasinja',\n license='MIT',\n author='Dir...
python
chosen
[ { "from": "system", "value": "Remove numpy as it's a dependency of Pandas already\n" }, { "from": "human", "value": "from setuptools import setup\n\nREPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'\n\n\nsetup(\n author='Serenata de Amor',\n classifiers=[\n 'Development ...
python
chosen
[ { "from": "system", "value": "Bump the version to 0.1.5.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nversion = '0.1.4'\n\nsetup(\n name='docxgen',\n version=version,\n packages=find_packages(),\n install_requires=['lxml',...
python
chosen
[ { "from": "system", "value": "Add official OSI name in the license metadata\n\nThis makes it easier for automatic license checkers to verify the license of this package." }, { "from": "human", "value": "import os\n\nfrom setuptools import setup # type: ignore\n\nVERSION = '4.4.1'\n\nsetup(\n ...
python
chosen
[ { "from": "system", "value": "Update deps because of CVE-2019-10906 in Jinja2 < 2.10.1\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom pypandoc import convert\n\n\ndef convert_markdown_to_rst(file):\n return convert(file, 'rst')\n\n\nsetup(name='gitlabfo...
python
chosen
[ { "from": "system", "value": "Add requests package as dependency\n\nThe package depends on the requests package, which is not explicitly mentioned in the setup file. Path adds this as requirement to the setup file." }, { "from": "human", "value": "'''\n\tPython wrapper for the OpenAQ API\n\tWri...
python
chosen
[ { "from": "system", "value": "Add ES search example, similar to Mongo related FTS\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport pprint\n\nfrom elasticsearch import Elasticsearch\n\n'''Inside ipython:\n[(r['_score'], r['_source']['Header']['En'], r['_source']['UnitTypeDesc'])...
python
chosen
[ { "from": "system", "value": "Remove duplicate mock deps from coi-services\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup\n\nimport os\nimport sys\n\n# Add /usr/local/inc...
python
chosen
[ { "from": "system", "value": "Remove MIN_DELAY bc a default setting is guaranteed\n" }, { "from": "human", "value": "from . import persist\n\nimport time\nimport threading\n\n\n# Map from view_id to threading.Timer objects\ntimers = {}\n\n\n# For compatibility this is a class with unchanged API ...
python
chosen
[ { "from": "system", "value": "FIX: Use the correct Event loop.\n" }, { "from": "human", "value": "import epics\nimport asyncio\n\n\nclass PVSuspender:\n \"\"\"\n A class to manage the callback interface between asyincio and\n pyepics.\n\n This will probably be a base class eventually...
python
chosen
[ { "from": "system", "value": "Add log level and destination arguments\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport logging\nimport argparse\nfrom matador.core.commands import commands\n\n\ndef setup_logging(logging_destination='console', verbosity='DEBUG'):\n l...
python
chosen
[ { "from": "system", "value": "Include required echo service in package\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nVERSION = '3.0.1'\n\nsetup(\n name='django-node',\n version=VERSION,\n packages=find_packages(exclude=('tests', 'example',)),\n pac...
python
chosen
[ { "from": "system", "value": "Add license notice and update description.\n" }, { "from": "human", "value": "# coding=utf-8\n\n# Make sure setup tools is installed, if not install it.\nfrom ez_setup import use_setuptools\nuse_setuptools()\n\nfrom setuptools import setup\n\nimport sys, os\nsys.pat...
python
chosen
[ { "from": "system", "value": "Add pygments as dependency. Lets see if this works...\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport re\nfrom setuptools import setup\n\nversion = re.search(\n '^__version__\\s*=\\s*\"([^\"]*)\"',\n open(\"suplemon/main.py\").read(),\n re....
python
chosen
[ { "from": "system", "value": "Update download url to newer version.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# setup.py\n\n\"\"\"pyftpdlib installer.\n\nTo install pyftpdlib just open a command shell and run:\n> python setup.py install\n\"\"\"\n\nfrom distutils.core import setup...
python
chosen
[ { "from": "system", "value": "Update to use scm for versioning\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='LightMatchingEngine',\n version='0.1.2',\n author='Gavin Chan',\n author_email='gavincyi@gmail.com',\n packages=['lightmatchingengin...
python
chosen
[ { "from": "system", "value": "Fix struc break named tuple name\n" }, { "from": "human", "value": "from collections import namedtuple\n\nimport pandas as pd\nimport xarray as xr\n\npandas_like = (pd.DataFrame, pd.Series, xr.DataArray)\n\n_fields = ['method', 'index', 'score', 'process', 'pvalue',...
python
chosen
[ { "from": "system", "value": "Update version number and supported Python versions\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:\n readme = readme.read()\n\nwith open(...
python
chosen
[ { "from": "system", "value": "Make compatible with Bleach v2.0 and html5lib v1.0\n" }, { "from": "human", "value": "import bleach\n\nfrom html5lib.sanitizer import HTMLSanitizer\n\nfrom markdown.postprocessors import Postprocessor\nfrom markdown import Extension\n\n\nclass MyTokenizer(HTMLSaniti...
python
chosen
[ { "from": "system", "value": "Set version number to 0.7.0.\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='slacker',\n version='0.6.8',\n packages=['slacker'],\n description='Slack API client',\n author='Oktay Sancak',\n author_email='oktaysa...
python
chosen
[ { "from": "system", "value": "Use find_packages to ensure management command is included in installs\n" }, { "from": "human", "value": "import os\nimport codecs\nfrom setuptools import setup\n\n\nPROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))\n\ndef read(*path):\n full_path = os.pa...
python
chosen
[ { "from": "system", "value": "Fix SyntaxError in the Travis scripts\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\"\"\"\nDecide whether we should re-build tests for a project on master.\n\nExits with code 1 if there are changes that require a rebuild, 0 if...
python
chosen
[ { "from": "system", "value": "Mark as stable and bump to 1.0\n" }, { "from": "human", "value": "from setuptools import setup\n\nVERSION = '0.3'\n\n\nsetup(\n name='jinja2_standalone_compiler',\n packages=['jinja2_standalone_compiler', ],\n version=VERSION,\n author='Filipe Waitman',\...
python
chosen
[ { "from": "system", "value": "Add pandas as requirement for the project\n" }, { "from": "human", "value": "from setuptools import setup\n\nREPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'\n\n\nsetup(\n author='Serenata de Amor',\n classifiers=[\n 'Development Status :: ...
python
chosen
[ { "from": "system", "value": "Add Python 3 requests install\n" }, { "from": "human", "value": "#!/usr/local/bin/python -u\n__author__ = 'Oliver Ratzesberger <https://github.com/fxstein>'\n__copyright__ = 'Copyright (C) 2015 Oliver Ratzesberger'\n__license__ = 'Apache License, Version 2.0'\n...
python
chosen
[ { "from": "system", "value": "Change the project name to glue, add the new public download_url\n" }, { "from": "human", "value": "\"\"\"\nGlue\n-----\n\nGlue is a simple command line tool to generate CSS sprites.\n\n\"\"\"\n\ntry:\n from setuptools import setup\n kw = {'entry_points':\n ...
python
chosen
[ { "from": "system", "value": "Make long description import path agnostic.\n" }, { "from": "human", "value": "from distutils.core import setup\nimport os\n\nf = open(\"README.rst\")\ntry:\n try:\n readme_text = f.read()\n except:\n readme_text = \"\"\nfinally:\n f.close()\n...
python
chosen
[ { "from": "system", "value": "Add uuid to identifier in test script\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport datetime\nimport os\nimport sys\nfrom io import BytesIO\nfrom pprint import pprint\n\nimport requests\n\nimport voxjar\n\nif __name__ == \"__main...
python
chosen
[ { "from": "system", "value": "Comment out python3 classifier for now.\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup, find_packages\n\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\n\nsetup(name='slugger',\n versio...
python
chosen
[ { "from": "system", "value": "Add check for Python 3 and increment version\n\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom setuptools import setup\n\nsetup(\n name=\"cistern\",\n version=\"0.1.3\",\n license=\"MIT\",\n url=\"https://github.com/archangelic/cistern\",...
python
chosen
[ { "from": "system", "value": "Update google-cloud-bigquery version to incorporate PollingFuture retry changes.\n\nSpecifically: https://github.com/googleapis/google-cloud-python/commit/f576d148f802666dbd11cf7c50a0629a77f81665\n\nChange-Id: Id3244786ffa73cbe3a166cfe35cb7f2219140a31\n" }, { "from": "h...
python
chosen
[ { "from": "system", "value": "Add paramiko req >= 2.3.1\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport platform\n\nwith open('README.rst') as f:\n readme = f.read()\n\nexecfile('substance/_version.py')\n\ninstall_requires = ['setuptools>=1.1.3', 'PyYAML...
python
chosen
[ { "from": "system", "value": "Add test_connection unit test. This single test seems to cover it.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport pytest\nimport echo_server\nimport echo_client\n\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport pytest\nim...
python
chosen
[ { "from": "system", "value": "Add pep8 to build deps\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2009-2014 Eucalyptus Systems, Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licens...
python
chosen
[ { "from": "system", "value": "Fix CAP so it takes any no. of args\n" }, { "from": "human", "value": "from ..plugin import BasePlugin\nfrom ..commands import BaseCommands\n\n\nclass Commands(BaseCommands):\n\n def cap(self, sock, source):\n pass\n\n\nclass Capability(BasePlugin):\n\n ...
python
chosen
[ { "from": "system", "value": "Remove unused code from IndexView.\n" }, { "from": "human", "value": "import os\nfrom errno import ENOENT\nfrom stat import S_IFDIR\nfrom gitfs import FuseMethodNotImplemented, FuseOSError\n\nfrom .view import View\nfrom log import log\n\n\nclass IndexView(View):\n...
python
chosen
[ { "from": "system", "value": "Fix paths to json files\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport ConfigParser\nimport requests\n\ncp = ConfigParser.SafeConfigParser()\ncp.read('/etc/keystone/keystone.conf')\ntoken = cp.get('DEFAULT', 'admin_token')\n\nbaseurl = 'http://loca...
python
chosen
[ { "from": "system", "value": "Add missing import statement for igor translator\n\n" }, { "from": "human", "value": "from . import be_odf\nfrom . import be_odf_relaxation\nfrom . import beps_ndf\nfrom . import general_dynamic_mode\nfrom . import gmode_iv\nfrom . import gmode_line\nfrom . import i...
python
chosen
[ { "from": "system", "value": "Fix an issue that tables not be removed in end of each test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport json\nimport os\n\nimport pytest\n\nfrom pyroonga.odm.table import tablebase, TableBase\n\nfrom pyroonga.tests import utils\n\nFIXTURE_DI...
python
chosen
[ { "from": "system", "value": "Delete unnecessary file in 'media' folder\n" }, { "from": "human", "value": "from io import BytesIO\nfrom PIL import Image\nfrom django.core.files.base import ContentFile\nfrom django.db import transaction\nfrom django.db.utils import IntegrityError\nfrom django.tes...
python
chosen
[ { "from": "system", "value": "Fix highlighting when multiple matches\n" }, { "from": "human", "value": "import re\nfrom pyqode.core.qt import QtGui\n\n\nclass MatchHighlighter(QtGui.QSyntaxHighlighter):\n def __init__(self, document):\n super().__init__(document)\n self.prog = N...
python
chosen
[ { "from": "system", "value": "Raise a 404 when for FREE profile badge requests\n" }, { "from": "human", "value": "from django.core.files.storage import default_storage\nfrom django.shortcuts import get_object_or_404\nfrom django.contrib.auth.models import User\nfrom django.http import HttpRespon...
python
chosen
[ { "from": "human", "value": "Add a basic database model\n" }, { "from": "gpt", "value": "from flask_ui import db\n\n\n\nclass Group(db.Model):\n\t__tablename__ = 'Groups'\n\tid = db.Column(db.Integer, primary_key=True)\n\tname = db.Column(db.String(30))\n\n\nclass User(db.Model):\n\t__tablename_...
python
chosen
[ { "from": "system", "value": "Prepend script prefix when replacing lang code\n" }, { "from": "human", "value": "import re\n\nfrom django.conf import settings\nfrom django.http import HttpResponseRedirect\n\n\n# Matches things like\n# /en\n# /en/\n# /en/foo/bar (can be anything after the fi...
python
chosen
[ { "from": "system", "value": "Remove unneded API serializer field that was breaking nested comments\n" }, { "from": "human", "value": "# Third party apps\nfrom rest_framework import serializers\n\n# Other AstroBin apps\nfrom common.api_fields import PKRelatedFieldAcceptNull\n\n# This app\nfrom ....
python
chosen
[ { "from": "system", "value": "Switch to just using `select` directly\n\nThis is less efficient, but does let use get the \"exceptional\" cases\nand handle them more pleasantly.\n" }, { "from": "human", "value": "\"\"\"Communication link driver.\"\"\"\n\nimport sys\nimport selectors\n\n\nCLIENT_T...
python
chosen
[ { "from": "system", "value": "Make sure package does not import itself during setup\n" }, { "from": "human", "value": "\"\"\"\nSunPy\n=====\n\nAn open-source Python library for Solar Physics data analysis.\n\nWeb Links\n---------\nHomepage: http://sunpy.org\nDocumentation: http://docs.sunpy.org/...
python
chosen
[ { "from": "system", "value": "Add more tests for addPiece method.\n" }, { "from": "human", "value": "from board import Board\n\ndef test_constructor():\n board = Board(0,0)\n assert board.boardMatrix.size == 0\n assert board.columns == 0\n assert board.rows == 0\n\n board = Board(...
python
chosen
[ { "from": "system", "value": "Remove logic for iterating directories to search for config file\n" }, { "from": "human", "value": "\"\"\"Helper functions to search files.\"\"\"\n\nfrom __future__ import division, print_function, unicode_literals\n\nimport os\nimport re\n\n\ndef find_all(path, fil...
python
chosen
[ { "from": "system", "value": "Add test for downloading and parsing biogrid tsv file\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nfrom indra.databases import biogrid_client\nfrom indra.util import unic...
python
chosen
[ { "from": "system", "value": "Change dependant allowance amounts to match policy change\n" }, { "from": "human", "value": "LIMIT = 73300\n\nPARTNER_ALLOWANCE = 18191\nCHILD_ALLOWANCE = 29149\nCHILDLESS_HOUSING_CAP = 54500\nEMPLOYMENT_COSTS_ALLOWANCE = 4500\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Support file globbing for log processor since names could be dynamic (based on hostname, etc.).\n" }, { "from": "human", "value": "import re\nimport snmpy\n\nclass log_processor(snmpy.plugin):\n def create(self):\n for k, v in sorted(self.conf['objects'].i...
python
chosen
[ { "from": "system", "value": "Add test when variable with annotation start with a keyword" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom typing import ClassVar, List\n\n\n# Annotated function (Issue #29)\ndef foo(x: int) -> int:\n return x + 1\n\n\n# Annotated variables #575\nC...
python
chosen
[ { "from": "system", "value": "Install the demos directory in /usr/local/share/ as well.\n\n(imported from commit 7516e5318f9e30544f53703ead4bca60f2dd7828)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport humbug\n\nimport glob\nimport os.path\nfrom distu...
python
chosen
[ { "from": "system", "value": "Add fits file to package build\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import absolute_import\n\nimport os\n\n\n# setup paths to the test data\n# can specify a single file or a list of files...
python
chosen
[ { "from": "system", "value": "Add patient data from the create form to the database.\n" }, { "from": "human", "value": "from flask import Flask, render_template, session, redirect, url_for, flash\nfrom app import app, forms, models\n\n@app.route('/', methods=['GET', 'POST'])\ndef index():\n l...
python
chosen
[ { "from": "system", "value": "Add docstring to program drive provider\n" }, { "from": "human", "value": "import os\nfrom functools import lru_cache\n\nfrom .. import logger\n# use absolute path because of re-occuraing imports '.' could not work\nfrom .program_path_provider import get_cached_prog...
python
chosen
[ { "from": "system", "value": "Use the correct redis connection in tests\n" }, { "from": "human", "value": "import logging\nfrom unittest import TestCase\nimport datetime\nfrom redash import settings\nsettings.DATABASE_CONFIG = {\n 'name': 'circle_test',\n 'threadlocals': True\n}\n\nsetting...
python
chosen
[ { "from": "system", "value": "Use BSA's API to get URL of latest prescribing data\n" }, { "from": "human", "value": "import os\n\nimport requests\nfrom bs4 import BeautifulSoup\n\nfrom django.conf import settings\nfrom django.core.management import BaseCommand\n\nfrom openprescribing.utils impor...
python
chosen
[ { "from": "system", "value": "Add top-level module path before tubular import.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport logging\nimport click\nimport tubular.asgard as asgard\n\nlogging.basicConfig(stream=sys.stdout, level=logging.INFO)\n\n@click.command()\n@c...
python
chosen
[ { "from": "system", "value": "Implement a test for the extensions default datetime format\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom jinja2 import Environment\n\n\n@pytest.fixture(scope='session')\ndef environment():\n return Environment(extensions=['j...
python
chosen
[ { "from": "system", "value": "Make the request context available in the template.\n" }, { "from": "human", "value": "from django import template\nfrom django.template.loader import render_to_string\n\nfrom us_ignite.sections.models import Sponsor\n\n\nregister = template.Library()\n\n\nclass Ren...
python
chosen
[ { "from": "system", "value": "Adjust settings to use specific db url\n" }, { "from": "human", "value": "from .base import *\nimport dj_database_url\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES['default'] = dj_database_url.config()\n\nSECRET_KEY = get_env_variable(\"SECRET_KEY\")\n\nALLO...
python
chosen
[ { "from": "system", "value": "Use relative import and update docstring\n" }, { "from": "human", "value": "\"\"\"\nManagement command to cleanup deleted private message database entries.\n\"\"\"\n\nfrom django.core.management.base import NoArgsCommand\n\nfrom apps.privatemsg.models import Private...
python
chosen
[ { "from": "system", "value": "Fix for copyright not showing up in RSS feed\n\nCode coverage showed I was missing a line, because I'd used\nthe wrong function name. Once I fixed that, I discovered a\nbug in the way I was getting the date for the copyright.\n" }, { "from": "human", "value": "from ...
python
chosen
[ { "from": "system", "value": "Increment total_requests key in redis after each request\n" }, { "from": "human", "value": "from redis import Redis\nfrom flask import Flask, g\n\napp = Flask(__name__)\napp.config.from_pyfile('config.py')\n\n_redis = Redis(\n host=app.config['REDIS_HOST'],\n ...
python
chosen
[ { "from": "system", "value": "Set requestion organization to none\n" }, { "from": "human", "value": "from django.http import Http404\nfrom django.shortcuts import get_object_or_404\n\nfrom .models import Organization\n\n\nclass OrganizationMiddleware(object):\n\n def process_request(self, req...
python
chosen
[ { "from": "system", "value": "Switch from the deprecated validators.required() to validators.DataRequired()\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom udata.forms import ModelForm, fields, validators\nfrom udata.i18n import lazy_ge...
python
chosen
[ { "from": "system", "value": "Generalize to allow editing other configuration\n" }, { "from": "human", "value": "import owebunit\nimport urlparse\nfrom wolis_test_case import WolisTestCase\n\nclass AcpLoginTestCase(WolisTestCase):\n def test_disable_captcha(self):\n self.login('morpheu...
python
chosen
[ { "from": "system", "value": "Make sure we can add activities to initiatives in admin\n" }, { "from": "human", "value": "from django.utils.timezone import now\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom bluebottle.fsm.effects import Effect\nfrom bluebottle.activities.model...
python
chosen