conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix version clasifier to one of the pypi allowed ones.\n" }, { "from": "human", "value": "import os\nfrom setuptools import find_packages, setup\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:\n README = readme.read()\n\n# allow setu...
python
chosen
[ { "from": "system", "value": "Add pypandoc to create RST for pypi\n" }, { "from": "human", "value": "import os\nfrom distutils.core import setup\n\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\n\npackages = []\npackage_dir = \"dbbackup\"\nfor dirpa...
python
chosen
[ { "from": "system", "value": "Remove pytest-runner and bump version to 3.0.2\n" }, { "from": "human", "value": "from setuptools import setup\n\nDESCRIPTION = open('README.md').read()\n\nsetup(\n name=\"ordered-set\",\n version='3.0.1',\n maintainer='Luminoso Technologies, Inc.',\n ma...
python
chosen
[ { "from": "system", "value": "Use standard 3-part version number.\n" }, { "from": "human", "value": "\nimport os\nfrom setuptools import setup, find_packages\n\nsetup(\n name = 'projd',\n version = '0.1',\n license = 'MIT',\n description = 'Utilities for working with projects and app...
python
chosen
[ { "from": "system", "value": "Update classifier tags, email and url.\n" }, { "from": "human", "value": "import re\nimport ast\nfrom setuptools import setup, find_packages\n\n_version_re = re.compile(r'__version__\\s+=\\s+(.*)')\n\nwith open('pgspecial/__init__.py', 'rb') as f:\n version = str...
python
chosen
[ { "from": "system", "value": "Cut new release for vault-token\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\n\npy_files = [\n \"ansible/module_utils/hashivault\",\n \"ansible/plugins/lookup/hashivault\",\n]\nfiles = [\n \"ansible/modules/hashivau...
python
chosen
[ { "from": "system", "value": "JLF-6: Set requirements to match output of pip freeze to see if that fixed Travis 2.7 build\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name = \"JIRA lean forward\",\n version = \"0.1.1dev\",\n description = \"Get Lean Stats ...
python
chosen
[ { "from": "system", "value": "Fix error `AttributeError: 'module' object has no attribute 'PY2'`" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='django-cacheops',\n version='1.2',\n author='Alexander Schepanovski',\n author_email='suor.web@gmail.com',\...
python
chosen
[ { "from": "system", "value": "Use version from git tags\n" }, { "from": "human", "value": "#!/usr/bin/python3\nfrom setuptools import setup, find_packages\n\nsetup(name='grafcli',\n version='0.5.2',\n description='Grafana CLI management tool',\n author='Milosz Smolka',\n auth...
python
chosen
[ { "from": "system", "value": "Update openfisca-core requirement from <33.0,>=27.0 to >=27.0,<35.0\n\nUpdates the requirements on [openfisca-core](https://github.com/openfisca/openfisca-core) to permit the latest version.\n- [Release notes](https://github.com/openfisca/openfisca-core/releases)\n- [Changelog]...
python
chosen
[ { "from": "system", "value": "Remove mechanize from dependencies list\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom splinter import __version__\n\nREADME = open('README.rst').read()\n\nsetup(name='splinter',\n version=__version__,\n description='b...
python
chosen
[ { "from": "system", "value": "Fix URL to point to a valid repo" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nsetup(name='Coffin',\n version=\".\".join(map(str, __import__(\"coffin\").__version__)),\n description='Jinja2 adapter for Django',\n ...
python
chosen
[ { "from": "system", "value": "Remove the default dependency on cvc4-solver.\n" }, { "from": "human", "value": "try:\n from setuptools import setup\n from setuptools import find_packages\n packages = find_packages()\nexcept ImportError:\n from distutils.core import setup\n import o...
python
chosen
[ { "from": "system", "value": "Use new Flask 2.0 .get() decorator function\n" }, { "from": "human", "value": "from flask import Blueprint, render_template\n\nfrom snakeeyes.extensions import redis\n\n\npage = Blueprint('page', __name__, template_folder='templates')\n\n\n@page.route('/')\ndef home...
python
chosen
[ { "from": "system", "value": "Disable country minimum share limit.\n" }, { "from": "human", "value": "from os import getenv\n\nGEOIP_DB_FILE = '/usr/local/share/GeoIP/GeoIP2-City.mmdb'\n\nSTATSD_HOST = 'graphite1.private.phx1.mozilla.com'\nSTATSD_PORT = 8125\nSTATSD_PREFIX = 'glow-workers-{}'.fo...
python
chosen
[ { "from": "system", "value": "Enable MQ publish confirmations for scheduler\n" }, { "from": "human", "value": "from kombu import Connection\nfrom tapiriik.settings import RABBITMQ_BROKER_URL\nmq = Connection(RABBITMQ_BROKER_URL)\nmq.connect()" }, { "from": "gpt", "value": "from kombu...
python
chosen
[ { "from": "system", "value": "Remove top level imports to avoid cyclical import\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\npyEDGAR SEC data library.\n=====================================\n\npyEDGAR is a general purpose library for all sorts of interactions with the SE...
python
chosen
[ { "from": "system", "value": "Use almostEqual for comparing geo coordinates\n\nAn upgrade in one of the underlying libraries has shifted the numbers\nvery slightly.\n" }, { "from": "human", "value": "from django.core.management import call_command\nfrom django.test import TestCase\nfrom frontend...
python
chosen
[ { "from": "system", "value": "Add tests for the time stamping facility\n" }, { "from": "human", "value": "\"\"\"Tests for user utility functions.\"\"\"\n\nfrom drudge import Vec, sum_, prod_\nfrom drudge.term import parse_terms\n\n\ndef test_sum_prod_utility():\n \"\"\"Test the summation and ...
python
chosen
[ { "from": "system", "value": "Add base ``ValidationError`` exception class.\n" }, { "from": "human", "value": "\"\"\"\n=================\nrororo.exceptions\n=================\n\nAll exceptions from WebOb, routr and rororo in one place.\n\n\"\"\"\n\nfrom string import Template\n\nfrom routr impor...
python
chosen
[ { "from": "system", "value": "Use a constant time comparison in the API auth" }, { "from": "human", "value": "from django.contrib.auth.models import AnonymousUser\nfrom rest_framework.authentication import BasicAuthentication\nfrom rest_framework.exceptions import AuthenticationFailed\n\nfrom se...
python
chosen
[ { "from": "system", "value": "Fix for rename of README.md\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='resync',\n version='0.1',\n packages=['resync'],\n classifiers=[\"Development Status :: 3 - Alpha\",\n \"Programming Languag...
python
chosen
[ { "from": "system", "value": "Make MNIST example py3 compatible.\n" }, { "from": "human", "value": "import os\nimport gzip\nimport pickle\nimport urllib\nimport sys\n'''Adapted from theano tutorial'''\n\n\ndef load_mnist(data_file = './mnist.pkl.gz'):\n\n if not os.path.exists(data_file):\n ...
python
chosen
[ { "from": "system", "value": "Update the CVS unit tests to use build_client().\n\nThis updates the CVS unit tests to build a `CVSClient` in each test\nwhere it's needed, rather than in `setUp()`. This is in prepration for\nnew tests that will need to handle client construction differently.\n\nTesting Done:\...
python
chosen
[ { "from": "system", "value": "Add a state not to call the task continuously.\n" }, { "from": "human", "value": "import sys\nsys.path.append('../py')\n\nfrom iroha import *\nfrom iroha.iroha import *\n\nd = IDesign()\nmod = IModule(d, \"mod\")\n\ncallee_tab = ITable(mod)\ntask = design_tool.Creat...
python
chosen
[ { "from": "system", "value": "Fix typo where wrong column name was checked for being null\n" }, { "from": "human", "value": "\"\"\"\n\nRevision ID: 0313_email_access_validated_at\nRevises: 0312_populate_returned_letters\nCreate Date: 2020-01-28 18:03:22.237386\n\n\"\"\"\nfrom alembic import op\n...
python
chosen
[ { "from": "system", "value": "Drop old django version support (1.10)\n" }, { "from": "human", "value": "import django\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': 'django_summernote.db',\n }\n}\n\n__MIDDLEWARE__ = (\n 'django.middlewa...
python
chosen
[ { "from": "system", "value": "Correct the filename we use.\n" }, { "from": "human", "value": "import pyopencl as cl\n\nTASKS = 64\n\nif __name__ == '__main__':\n\n print('create context')\n ctx = cl.create_some_context()\n\n print('create command queue')\n queue = cl.CommandQueue(ctx...
python
chosen
[ { "from": "system", "value": "Use the full commit hash so that we can download from github.com.\n" }, { "from": "human", "value": "\nclass FsharpPackage(GitHubTarballPackage):\n\tdef __init__(self):\n\t\tGitHubTarballPackage.__init__(self,\n\t\t\t'fsharp', 'fsharp',\n\t\t\t'3.0.13',\n\t\t\t'3.0....
python
chosen
[ { "from": "system", "value": "Change settings for normal light.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Test Raspberry Pi camera!\"\"\"\n\n# http://picamera.readthedocs.org/en/release-1.10/index.html\n\nimport picamera\nimport sys\nfrom fractions import Fraction\nfrom t...
python
chosen
[ { "from": "system", "value": "Disable front end tests on Travis for now.\n" }, { "from": "human", "value": "# TODO: not sure why but we need to include the SECRET_KEY here - importing from the test_runner file doesn't work\nSECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='\...
python
chosen
[ { "from": "system", "value": "Fix a bug that caused the \"facebook_authorization_required\" decorator to be incompatible\nwith Django libraries that modify the order of arguments given to views.\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom django.http import HttpRespons...
python
chosen
[ { "from": "system", "value": "Fix pep8 violation in 29e3a0c.\n" }, { "from": "human", "value": "from django.db import connections\nfrom django.db.migrations.executor import MigrationExecutor\nfrom prometheus_client import Gauge\n\nunapplied_migrations = Gauge(\n 'django_migrations_unapplied_t...
python
chosen
[ { "from": "system", "value": "Add a simple test function\n" }, { "from": "human", "value": "'''\nModule for shelling out commands, inclusion of this module should be\nconfigurable for security reasons\n'''\n" }, { "from": "gpt", "value": "'''\nModule for shelling out commands, inclus...
python
chosen
[ { "from": "system", "value": "Update Stylus filter with include paths\n\nSince the Stylus filter works with stdin, the compiler doesn't know the\r\nsource directory, and thus can't resolve any imports. This adds the\r\nsource directory to the include path using the `--include` option, and\r\nalso adds the `...
python
chosen
[ { "from": "system", "value": "Add Apache 2.0 license to source file\n\nAs per OpenStack licensing guide lines [1]:\n[H102 H103] Newly contributed Source Code should be licensed under\nthe Apache 2.0 license.\n[H104] Files with no code shouldn't contain any license header nor\ncomments, and must be left comp...
python
chosen
[ { "from": "system", "value": "DOC: Update PIL error install URL\n\nUpdate URL for PIL import error\nto point to Pillow installation\ninstead of PIL, for the latter\nis somewhat out of date and\ndoes not even Python 3 at the\nmoment unlike Pillow.\n\nCloses gh-5779.\n" }, { "from": "human", "valu...
python
chosen
[ { "from": "system", "value": "Fix warning about default value for boolean field\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils import timezone\n\n\nclass SecretFile(models.Model):\n filename = models.CharField(max_length=255, blank=True, null=True)\n ord...
python
chosen
[ { "from": "system", "value": "Update to v1.4.0 for release\n\nChangelog:\n - #261 Add OAuthTokenResponse.by_scopes\n - #257, #260 Make `cryptography` a strict requirement,\n `globus-sdk[jwt]` is no longer neecessary\n - #255 Simplify OAuthTokenResponse.decode_id_token to not require the\n client as an a...
python
chosen
[ { "from": "system", "value": "Put more bits into the settings for the PopIt API\n" }, { "from": "human", "value": "\"\"\"Settings that need to be set in order to run the tests.\"\"\"\n\nimport os\n\nDEBUG = True\nUSE_TZ = True\nSITE_ID = 1\n\nSECRET_KEY = '...something secure here...'\n\nDATABAS...
python
chosen
[ { "from": "system", "value": "Fix exception - batch is not required field of AR\n" }, { "from": "human", "value": "from bika.lims.browser.sample import SamplesView as _SV\nfrom bika.lims.permissions import *\nfrom Products.CMFCore.utils import getToolByName\nfrom zope.interface import implements...
python
chosen
[ { "from": "system", "value": "Modify test worker unit test\n\nSigned-off-by: Brandon Myers <9cda508be11a1ae7ceef912b85c196946f0ec5f3@mozilla.com>\n" }, { "from": "human", "value": "import sys\nimport os\nsys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../scoring_engi...
python
chosen
[ { "from": "human", "value": "Update init file to start celery\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\n# This will make sure the app is always imported when\n# Django starts so that shared_task will use this app.\nfrom .celery import app as celery_app # noqa" ...
python
chosen
[ { "from": "system", "value": "Add Optional Server Response Parameter To Error Classes\n" }, { "from": "human", "value": "class CitrinationClientError(Exception):\n pass\n\nclass APIVersionMismatchException(CitrinationClientError):\n\n def __init__(self, message=\"Version mismatch with Citr...
python
chosen
[ { "from": "system", "value": "Add identifier list to identifier views for use with embeds in registrations\n\n[#OSF-6628]\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom api.identifiers import views\n\nurlpatterns = [\n url(r'^(?P<identifier_id>\\w+)/$', views.Iden...
python
chosen
[ { "from": "system", "value": "Use built-in Flask server when debugging - websockets won't work.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom gevent.pywsgi import WSGIServer\nfrom flask import Flask\n\nimport views\nfrom handler import PatchedWebSocketHandler\nfrom util import g...
python
chosen
[ { "from": "system", "value": "Add package meta-data (author, email, etc.).\n" }, { "from": "human", "value": "#/usr/bin/env python\n\n\"\"\"\nA set of classes used to dynamically wrap FAUST DSP programs in Python.\n\nThis package defines three types:\n- PythonUI is an implementation of the UIGlu...
python
chosen
[ { "from": "system", "value": "Comment about number of tests\n" }, { "from": "human", "value": "import pytest\n\nfrom ...model.corpus import Corpus\n\nfrom ..fixtures import tiny_corpus, sample_corpus, whole_corpus\n\n\nslow = pytest.mark.skipif(\n not pytest.config.getoption(\"--runslow\"),\n...
python
chosen
[ { "from": "system", "value": "Change to V2 spec of param meta data\n\nHad to switch to ElementTree to get attribute support\n" }, { "from": "human", "value": "from xml.dom.minidom import getDOMImplementation\nimport codecs\n\nclass XMLOutput():\n def __init__(self, groups):\n impl = ge...
python
chosen
[ { "from": "system", "value": "Add api_token from environment, if it's present.\n" }, { "from": "human", "value": "from .labapp import LabApp\n\ntry:\n from jupyterhub.singleuser import SingleUserNotebookApp\nexcept ImportError:\n SingleUserLabApp = None\n raise ImportError('You must hav...
python
chosen
[ { "from": "system", "value": "Put the transform box in the overlay render for better interaction.\n" }, { "from": "human", "value": "\"\"\"\nTransformBox\n\n:Authors:\n\tBerend Klein Haneveld\n\"\"\"\nfrom ui.Interactor import Interactor\nfrom PySide.QtCore import QObject\nfrom vtk import vtkBox...
python
chosen
[ { "from": "system", "value": "Connect to Postgres over TCP.\n" }, { "from": "human", "value": "import os\n\nfrom lcp.settings.base import * # noqa\n\n# FIXME: The wildcard is only here while testing on Vagrant.\n# Host header checking fails without it.\nALLOWED_HOSTS = ['*']\n\nDATABASES = {\n ...
python
chosen
[ { "from": "system", "value": "[upd] Return facts in JSON format.\n" }, { "from": "human", "value": "#! python3\n\"\"\"random_fact_scraper.py - Scrape the http://randomfactgenerator.net website.\"\"\"\n\nimport os\nimport requests\nfrom flask import Flask\nfrom lxml import html\n\napp = Flask(__n...
python
chosen
[ { "from": "system", "value": "Create url config for accounts\n" }, { "from": "human", "value": "\"\"\"\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.11/users/http/urls/\nExamples:\nFunction views\n 1. Add an import: fr...
python
chosen
[ { "from": "system", "value": "Fix direct glyph selection with select method\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport unittest\n\nfrom mock import patch\n\nfrom bokeh.models.renderers import GlyphRenderer\nfrom bokeh.plotting import ColumnDataSource, fig...
python
chosen
[ { "from": "system", "value": "Update Map integration test so that Map is fed a PNG from a local image.png file rather than from the internet.\n" }, { "from": "human", "value": "from mock import patch\nfrom mock import Mock\nfrom greengraph import Map\nimport requests\nfrom matplotlib import imag...
python
chosen
[ { "from": "system", "value": "Add fsbase and gsbase commands\n" }, { "from": "human", "value": "from __future__ import print_function\nimport gdb\nimport pwndbg.regs\n\nclass segment(gdb.Function):\n \"\"\"Get the flat address of memory based off of the named segment register.\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Remove list filter based on event category\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\nfrom django.contrib import admin\nfrom mezzanine.core.admin import StackedDynamicInlineAdmin, DisplayableAdmin\n\nfrom fullcalendar...
python
chosen
[ { "from": "system", "value": "Change to positional argument for generate-token\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n# Copyright 2016 Steven Oud. All rights reserved.\n# Use of this source code is governed by a MIT-style license that can be found\n#...
python
chosen
[ { "from": "system", "value": "Reset debug flag to False.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# error.py\n# csvdiff\n#\n\nfrom __future__ import absolute_import, print_function, division\n\nimport sys\n\nDEBUG = True\n\n\nclass FatalError(Exception):\n pass\n\n\nde...
python
chosen
[ { "from": "system", "value": "Fix buglet in the destroy path.\n" }, { "from": "human", "value": "# (C) Michael DeHaan, 2015, michael.dehaan@gmail.copy_from\n# LICENSE: APACHE 2\n\nimport argparse\n\nclass Strider(object):\n\n __SLOTS__ = [ 'provisioner']\n\n def __init__(self, provisioner)...
python
chosen
[ { "from": "system", "value": "caos: Add support for data URI scheme\n\nIt is now possible to use `data:' backend URIs:\n\n meta_backend_uri = 'data:application/x-yaml,<YAML DOCUMENT DATA>'\n" }, { "from": "human", "value": "##\n# Copyright (c) 2008-2010 Sprymix Inc.\n# All rights reserved.\n#...
python
chosen
[ { "from": "system", "value": "Add trailing newline in file\n" }, { "from": "human", "value": "import urllib\nimport logging\n\nfrom jenkinsapi.jenkinsbase import JenkinsBase\nfrom jenkinsapi.plugin import Plugin\n\n\nlog = logging.getLogger(__name__)\n\n\nclass Plugins(JenkinsBase):\n def __i...
python
chosen
[ { "from": "system", "value": "Update FileStreamReader for new python 3.5 async\n" }, { "from": "human", "value": "import os\nimport asyncio\n\nfrom waterbutler.core.streams import BaseStream\n\n\nclass FileStreamReader(BaseStream):\n\n def __init__(self, file_pointer):\n super().__init...
python
chosen
[ { "from": "system", "value": "Send json content-type to Jenkins\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\nimport hashlib\n\n# Add the lib directory to the path for Lambda to load our libs\nsys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))\nimp...
python
chosen
[ { "from": "system", "value": "Fix typo in class name.\n\nIt was preventing import to work properly.\n\nFrom: Fabian Pedregosa <fabian.pedregosa@inria.fr>\n\ngit-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@342 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8\n" }, { "from": "human", "value": "\n# Matthi...
python
chosen
[ { "from": "system", "value": "Fix extra code sending after loop in rf transmitter\n" }, { "from": "human", "value": "import asyncio\n\nfrom alarme import Action\nfrom alarme.extras.common import SingleRFDevice\n\n\nclass RfTransmitterAction(Action):\n\n def __init__(self, app, id_, gpio, code...
python
chosen
[ { "from": "system", "value": "Add comment about how bad this is\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.4 on 2017-06-12 09:04\nfrom __future__ import unicode_literals\n\nfrom django.core.management import call_command\nfrom django.db import migratio...
python
chosen
[ { "from": "system", "value": "Undo underperformaing change to code\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup as bs\nfrom get_root_domain import get_root_domain\n\ndef html_has_same_domain(url, resp):\n mod = 'html_has_same_domain'\n cnt = 0\n root = get_root_domai...
python
chosen
[ { "from": "system", "value": "Adjust FIJI script for applying CLAHE to a directory\n" }, { "from": "human", "value": "#!/usr/bin/env jython\n\nfrom ij import IJ\nimport os\n\nfrom mpicbg.ij.clahe import Flat\nfrom ij.process import ImageConverter\n\n# http://fiji.sc/wiki/index.php/Enhance_Local_...
python
chosen
[ { "from": "system", "value": "Add tests for the library methods. All except 2 pass right now.\n\nThe two that don't pass, fail because I have changed what their output\nshould be. In the docs, it is shown that the output of\n`generate_minor_scale`, given 'C4', is:\n\n ['C4', 'D4', 'E4', 'F4', 'G4', 'A4'...
python
chosen
[ { "from": "system", "value": "Add basic element pickle cycle test\n" }, { "from": "human", "value": "import mdtraj as md\nimport pytest\nfrom mdtraj import element\nfrom mdtraj.testing import eq\n\n\ndef test_immutable():\n def f():\n element.hydrogen.mass = 1\n\n def g():\n ...
python
chosen
[ { "from": "system", "value": "Fix return code for failing tests\n\nPrevious the even if tests failed the return code would not indicate\nthis to the caller of 'flask test' in this case.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom app import create_app\n\napp = create_app('...
python
chosen
[ { "from": "system", "value": "Order revisions by their creation date.\n" }, { "from": "human", "value": "from django.db import models\nimport django.contrib.auth.models as auth\n\nclass User(auth.User):\n \"\"\"Model for representing users.\n\n It has few fields that aren't in the standard...
python
chosen
[ { "from": "system", "value": "Add the loggers submodule to __all__\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"Logging package for specific and general needs.\n\nThis exposes all the defined loggers, and a generic ready-to-use Logger\nfor general needs, which can be used r...
python
chosen
[ { "from": "system", "value": "Add reference to comment edited in urlconf\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom django.contrib.comments.urls import urlpatterns\n\nurlpatterns += patterns('',\n (r'^edit/$', 'osl_comments.views.edit_comment'),\n url(...
python
chosen
[ { "from": "system", "value": "[rllib] Fix bad sample count assert\n\n" }, { "from": "human", "value": "import logging\n\nimport ray\nfrom ray.rllib.policy.sample_batch import SampleBatch\nfrom ray.rllib.utils.memory import ray_get_and_free\n\nlogger = logging.getLogger(__name__)\n\n\ndef collect...
python
chosen
[ { "from": "system", "value": "Make safe_makedirs resilient to race conditions.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport os.path\nimport shutil\nimport sys\nimport fnmatch\nimport glob\n\nfrom nimp.utilities.logging import *\n\n#-----------------------------...
python
chosen
[ { "from": "system", "value": "Add documenation link to config file\n" }, { "from": "human", "value": "\nimport logging\n\nfrom tornado.options import options\nfrom datetime import datetime\n\n\ndef save_config():\n logging.info(\"Saving current config to: %s\" % options.config)\n with open...
python
chosen
[ { "from": "system", "value": "Fix typo in jsbox URLs.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url, include\n\nurlpatterns = patterns('',\n url(r'^survey/',\n include('go.apps.surveys.urls', namespace='survey')),\n url(r'^multi_survey/',\n ...
python
chosen
[ { "from": "system", "value": "Set framerate to 60 fps\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom rgbmatrix import RGBMatrix\nimport sys, time\nfrom ball import Ball\n\nrows = 16\nchains = 1\nparallel = 1\nledMatrix = RGBMatrix(rows, chains, parallel)\n\nnumRows = 16\nheight =...
python
chosen
[ { "from": "system", "value": "Use the proper entrypoint name.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\nimport uuid\n\nfrom {{cookiecutter.app_name}} import __version__ as version_string\n\n\nrequirements_path = os.path.join(\n os.path.dirname(...
python
chosen
[ { "from": "system", "value": "Load API_KEY from django settings.py file as an alternative\n" }, { "from": "human", "value": "import os\nimport tmdbsimple\n\ntmdbsimple.API_KEY = os.environ['MM2_TMDB_API_KEY']\n" }, { "from": "gpt", "value": "import os\nimport tmdbsimple\nfrom django....
python
chosen
[ { "from": "system", "value": "Implement update_distance(), init setup for Bellman-Ford alg\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\n\ndef bellman_ford(w_graph_d, start_vertex):\n \"\"\"...
python
chosen
[ { "from": "system", "value": "Handle sleeping in main loop\n" }, { "from": "human", "value": "import time\nimport subprocess\nfrom local_settings import *\nimport redis\n\nredis_instance = redis.StrictRedis()\n\ndef iterate_all_destinations():\n\n times = []\n\n for dest in DESTINATIONS:\n...
python
chosen
[ { "from": "system", "value": "Add config for different env\n" }, { "from": "human", "value": "import logging\n\nfrom flask import Flask\n\nlog = logging.getLogger(__name__)\n\napp = Flask(__name__)\n\nimport mangacork.views\n" }, { "from": "gpt", "value": "import os\nimport logging\n...
python
chosen
[ { "from": "system", "value": "Add stress test for wrapping stdout\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\n\nlog = logging.getLogger(__name__)\n\n# test cases\ndef test_test():\n for i in range(200):\n print \"Mu! {0}\".format(i)\n assert False\nde...
python
chosen
[ { "from": "system", "value": "Fix help messages for commands\n" }, { "from": "human", "value": "import sys\nimport pathlib\nimport argparse\nimport pkg_resources\n\nfrom jacquard.config import load_config\n\n\ndef argument_parser():\n parser = argparse.ArgumentParser(description=\"Split testi...
python
chosen
[ { "from": "system", "value": "Add the query to get the near stations\n\nThis query takes four parameters that define a coordinates bounding\nbox. This allows to get the stations that fir into the area defined\nby the box." }, { "from": "human", "value": "from django.db import models\n\nclass Com...
python
chosen
[ { "from": "system", "value": "Add haystack connections simples engine om opps\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.conf import settings\n\n\ntrans_app_label = _('Core')\n\nsettings.INSTALLED_APPS += (\n ...
python
chosen
[ { "from": "system", "value": "pgroonga: Remove long-running update query in initial migration.\n\nThis query doesn't add any value, because it'll be overwritten in\nmigration 0002 anyway. And because it isn't batched, it can take\nseveral minutes to run on servers with hundreds of thousands to\nmillions of...
python
chosen
[ { "from": "system", "value": "Add a test case for settings discovery\n" }, { "from": "human", "value": "import xdg\nfrom click.testing import CliRunner\n\nfrom todoman.cli import cli\n\n\ndef test_explicit_nonexistant(runner):\n result = CliRunner().invoke(\n cli,\n env={\n ...
python
chosen
[ { "from": "system", "value": "Remove test for parent class\n" }, { "from": "human", "value": "from models.people import Person, Fellow, Staff\nfrom unittest import TestCase\n\n\nclass PersonTestCases(TestCase):\n \"\"\"Tests the functionality of the person parent class\n \"\"\"\n def se...
python
chosen
[ { "from": "system", "value": "Add writeboard specific fields to model " }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom tagging.models import Tag\nfrom tagging.fields import T...
python
chosen
[ { "from": "system", "value": "Change print statement about config\n" }, { "from": "human", "value": "from __future__ import division\nimport urllib.request as request, json, os.path\nimport json, time\n\n\nif os.path.exists('config/config.json'):\n config_file = open('config/config.json')\n ...
python
chosen
[ { "from": "system", "value": "Add support for PATCH http method\n" }, { "from": "human", "value": "import json\n\nfrom werkzeug.exceptions import MethodNotAllowed\n\n\nhttp_methods = ('get', 'post', 'head', 'options', 'put', 'delete')\n\n\nclass RequestHandler(object):\n\n def __init__(self, ...
python
chosen
[ { "from": "system", "value": "Speed up the broadcast frequency\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Common configuration elements for networkzero\n\"\"\"\nENCODING = \"UTF-8\"\nclass _Forever(object):\n def __repr__(self): return \"<Forever>\"\nFOREVER = _Forever(...
python
chosen
[ { "from": "system", "value": "Fix Readme Name In Setup\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='SimonSpeckCiphers',\n version='0.9.9',\n description=\"Implementations of the NSA's Simon and Speck Block Ciphers\",\n long_descript...
python
chosen
[ { "from": "system", "value": "Clean-up: Use `raise SystemExit` intead of `sys.exit`.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\nfrom lib2to3.main import main\n\ntry:\n import pep8ify.fixes\nexcept ImportError:\n # if importing pep8ify fails, try to load from ...
python
chosen
[ { "from": "system", "value": "Set the default namespace to lowercase \"default\"\n" }, { "from": "human", "value": "from temporal.workflow import WorkflowClient\n\nfrom mediawords.util.network import wait_for_tcp_port_to_open\n\n\ndef workflow_client(namespace: str = 'DEFAULT') -> WorkflowClient...
python
chosen