conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Increment version number ahead of release" }, { "from": "human", "value": "\"\"\"Main initialization for the WeGovNow extension.\"\"\"\n\nVERSION = (3, 2, 0)\n__version__ = '.'.join(map(str, VERSION))\n\n\ntry:\n from geokey.extensions.base import register\n\n ...
python
chosen
[ { "from": "system", "value": "Revert GPIO setup to be optimized for GPIO3 (with internal pull up resistor)\n" }, { "from": "human", "value": "import time\nimport urllib\n\nimport RPi.GPIO as GPIO\n\n# GPIO input pin to use\nLPR_PIN = 3\n# URL to get image from\nSOURCE = 'http://192.168.0.13:8080...
python
chosen
[ { "from": "system", "value": "Modify to pick either randomly or sequentially\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport glob\nimport os.path\nimport random\n\n\ndef pick_random(directory, k=None):\n \"\"\"Pick randomly some files from a directory.\"\"\"\n all_files ...
python
chosen
[ { "from": "system", "value": "Add kwargs to this to make Jenkins shut up about it" }, { "from": "human", "value": "from utils.command_system import command\nfrom utils import confirm\nimport discord\n\n\nclass SuperUser:\n def __init__(self, amethyst):\n self.amethyst = amethyst\n\n ...
python
chosen
[ { "from": "system", "value": "Reduce print statement console clustering\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\"\"\"Command line runtime for Tea.\"\"\"\n\nimport runtime.lib\nfrom runtime import lexer, parser, env\n\nTEA_VERSION = \"0.0.5-dev\"\nTEA_TITLE = \"Tea @\" + TEA_VERSI...
python
chosen
[ { "from": "system", "value": "Use rpop/rpush instead of deprecated pop/push (conforming to redis 1.x)\n" }, { "from": "human", "value": "from redis import Redis as Redis\nfrom ghettoq.backends.base import BaseBackend\n\n\nclass RedisBackend(BaseBackend):\n\n def establish_connection(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove now obsolete ascii_tree function.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom legacy import draw_tree, _draw_tree\n\n\ndef ascii_tree(node,\n get_node_children=lambda t: t[1].items(),\n ...
python
chosen
[ { "from": "system", "value": "Make Diagnosis come before PMH\n\ncloses #5\n" }, { "from": "human", "value": "\"\"\"\nDefine acute schemas.\n\"\"\"\nfrom acute import models\n\nlist_columns = [\n models.Demographics,\n models.Location,\n models.PastMedicalHistory,\n models.Diagnosis,\...
python
chosen
[ { "from": "system", "value": "Validate TLS certificate for connections to Elastsearch\n\nBy default Python elasticsearch client 1.x sets verify_certs to\nFalse, which means it doesn't verify TLS certificates when connecting\nto Elasticsearch over HTTPS and urllib3 prints an InsecureRequestWarning\non each r...
python
chosen
[ { "from": "system", "value": "Exclude the proxy bio field.\n" }, { "from": "human", "value": "from django import forms\n\nfrom wagtail.wagtailimages.widgets import AdminImageChooser\n\nfrom .models import Author\n\n\nclass AuthorAdminForm(forms.ModelForm):\n class Meta:\n model = Autho...
python
chosen
[ { "from": "system", "value": "Add missing 'h' in https in Requestor doc.\n" }, { "from": "human", "value": "\"\"\"Provides the HTTP request handling interface.\"\"\"\nimport requests\nfrom . import const\n\n\nclass Requestor(object):\n \"\"\"Requestor provides an interface to HTTP requests.\"...
python
chosen
[ { "from": "system", "value": "Add test that checks if landing page contains the word Pizza.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nclass Test(TestCase):\n def test_landing_page_is_there(self):\n response = self.client.get('/')\n self.assertEqual(response.st...
python
chosen
[ { "from": "system", "value": "Install run_ilamb.sh to Python distro bin directory\n" }, { "from": "human", "value": "#! /usr/bin/env python\nfrom ez_setup import use_setuptools\nuse_setuptools()\nfrom setuptools import setup, find_packages\nfrom pylamb import __version__\n\n\nsetup(name='ILAMB',...
python
chosen
[ { "from": "system", "value": "Install luigi-wrapper and submit-experiment-from-gsheet scripts\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(name='rnaseq_pipeline',\n version='2.0.0',\n description='RNA-Seq pipeline for the Pavlidis Lab',\n ...
python
chosen
[ { "from": "system", "value": "Allow higher versions of Oscar\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\nsetup(\n name='django-oscar-stores',\n version=\"0.5-dev\",\n url='https://github.com/tangentlabs/django-oscar...
python
chosen
[ { "from": "system", "value": "Set cov-core dependency to 1.11\n" }, { "from": "human", "value": "import setuptools\n\nsetuptools.setup(name='pytest-cov',\n version='1.6',\n description='py.test plugin for coverage reporting with '\n 'support for bo...
python
chosen
[ { "from": "system", "value": "Clean up the description for PyPI\n" }, { "from": "human", "value": "import sys\n\nif sys.version < '3.4':\n print('Sorry, this is not a compatible version of Python. Use 3.4 or later.')\n exit(1)\n\nfrom setuptools import setup, find_packages\n\nwith open('RE...
python
chosen
[ { "from": "system", "value": "Add missing ghp-import requirement as an extra dev dependency.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\nfrom setuptools import setup, find_packages\n\nsetup(\n name=\"jawa\",\n packages=find_packages(),\n version=\"1...
python
chosen
[ { "from": "system", "value": "Add deprecation warning and use new method\n" }, { "from": "human", "value": "# Print Numerical Data\n\nimport json\nimport os\nfrom plantcv.plantcv import outputs\n\n\ndef print_results(filename):\n \"\"\"Print result table\n\n Inputs:\n filename = filenam...
python
chosen
[ { "from": "system", "value": "Use __version__ from fuzzywuzzy package" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2014 SeatGeek\n\n# This file is part of fuzzywuzzy.\n\nimport os\n\ntry:\n from setuptools import setup\nexcept ImportError:...
python
chosen
[ { "from": "system", "value": "Remove the obsolte comment, library is licensed under BSD.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\nimport os\nimport re\nfrom distutils.core import setup\n\nversion_re = re.compile(\n r'__version__ = (\\(.*?\\))')\n\ncwd...
python
chosen
[ { "from": "system", "value": "Add pytz as a dependency\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\nsetup(\n name='django-modelcluster',\n version='0.5',\n ...
python
chosen
[ { "from": "system", "value": "Add compatibility with Tornado 4.3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nVERSION = '2.4.1'\n\nsetup(\n name='tornadoes',\n version=VERSION,\n description=\"A tornado-powered python libra...
python
chosen
[ { "from": "system", "value": "Add mypy to the development dependencies.\n\nThe code type-checks clean and this will allow keeping it so.\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom setuptools import find_packages, setup\n\nsetup(\n packages=find_packages(),\n python_requires...
python
chosen
[ { "from": "system", "value": "Set the final version number\n" }, { "from": "human", "value": "\"\"\"Rachiopy setup script.\"\"\"\nfrom setuptools import find_packages, setup\nfrom datetime import datetime\n\nNOW = datetime.now().strftime(\"%m/%d/%Y%H%M%S\")\n\nVERSION = f\"1.0.0-dev{NOW}\"\n\nGI...
python
chosen
[ { "from": "system", "value": "Revert \"We shouldnt need to export calexicon.internal.\"\n\nThis reverts commit 4b63ae5469b5b1785ce4a6dbbcef4c4ff6505b0b.\nWe do need to export this package to call it internally.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='...
python
chosen
[ { "from": "system", "value": "Include JSON config files when installing\n" }, { "from": "human", "value": "from setuptools import setup\n\n\n#see http://pypi.python.org/pypi/stdeb for package building instructions\n#or else here: https://github.com/astraw/stdeb\n\nsetup(name='azulejo',\n ve...
python
chosen
[ { "from": "system", "value": "Use json library instead of eval.\n" }, { "from": "human", "value": "import sys\nimport caching\nimport urllib\nimport urllib2\nimport re\nfrom pyquery import PyQuery as p\n\n\ntry: cache = caching.get_cache('tnrs')\nexcept: cache = {}\n\n\ndef tnrs_lookup(name, TIM...
python
chosen
[ { "from": "system", "value": "Switch in/out degree for neighbor rank\n\nEdges point in the direction of time, or influence. That means we're\nconcerned with outdegree (amount of nodes influenced by the current\nnode), not indegree (amount of nodes that influence the current node).\n" }, { "from": "h...
python
chosen
[ { "from": "system", "value": "Remove Ted and add Wikiepdia\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\n\nLANGUAGE_CODE = 'en'\nIDEASCUBE_NAME = 'WHITE MOUNTAIN APACHE'\nHOME_CARDS = STAFF_HOME_CARDS + [\n {\n 'id': '...
python
chosen
[ { "from": "system", "value": "Use DjangoModelFactory subclass for images test\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom django.contrib.auth.models import User\nfrom django.test import TestCase\nimport factory\nfrom faker import Faker\n\nfrom imager_profile....
python
chosen
[ { "from": "system", "value": "Add sanity checks for temperature readings\n" }, { "from": "human", "value": "# coding=utf-8\n\nfrom utils import SensorConsumerBase\nimport sys\n\n\nclass Bathroom(SensorConsumerBase):\n\n def __init__(self):\n SensorConsumerBase.__init__(self, \"home\")\...
python
chosen
[ { "from": "system", "value": "Add further constrains to create_dataset\n\nTo clarify that it capped_size must be zero or a positive integer.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport json\nimport requests\n\nfrom django.conf import settings\n\n\nclass B...
python
chosen
[ { "from": "system", "value": "Update find text, walk through the directories with os.walk and print line length less than 100 characters.\n\nSigned-off-by: SJ Huang <55a36c562e010d4b156739b1c231e1aa17113c8e@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\nimport os\nimpo...
python
chosen
[ { "from": "system", "value": "Fix for case when file can't be opened due to IOError or similar\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nAlways ignore lines with '# noqa'\n\"\"\"\n__version__ = 0.1\n\nimport pep8\n\n\nclass RespectNoqaReport(pep8.StandardReport):\n\n ...
python
chosen
[ { "from": "system", "value": "Exclude fallback from coverage reporting\n" }, { "from": "human", "value": "\"\"\"\nCross-version compatibility module.\n\"\"\"\n\nfrom __future__ import absolute_import\ntry:\n from collections import OrderedDict\nexcept ImportError:\n from ordereddict import...
python
chosen
[ { "from": "system", "value": "Fix branch in caching logic\n" }, { "from": "human", "value": "from app.clients import factualClient\nfrom app.util import log\nfrom factual import APIException\n\nCROSSWALK_CACHE_VERSION = 1\n\ndef getVenueIdentifiers(yelpID):\n yelpURL = \"https://...
python
chosen
[ { "from": "system", "value": "Use the right package name for running the uploader.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport wx\nfrom GUI.iridaUploaderMain import MainFrame\n\nif __name__ == \"__main__\":\n app = wx.App(False)\n frame = MainFrame()\n frame.Show(...
python
chosen
[ { "from": "system", "value": "Add initial function definition and documentation for function to do conversion" }, { "from": "human", "value": "class NumberToWords(object):\n \"\"\"\n Class for converting positive integer values to a textual representation\n of the submitted number for v...
python
chosen
[ { "from": "system", "value": "Use an additional function to scope everything properly\n" }, { "from": "human", "value": "import os.path\nimport unittest\nimport munge_js\n\nclass TestCase(unittest.TestCase):\n pass\n\nTestCase.assert_false = TestCase.assertFalse\nTestCase.assert_equal = TestC...
python
chosen
[ { "from": "system", "value": "Remove timeout argument on update job\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nfrom redis import StrictRedis\nfrom rq import Queue\nfrom apscheduler.schedulers.blocking import BlockingSch...
python
chosen
[ { "from": "system", "value": "Implement common pattern from_json calls update_from_json\n" }, { "from": "human", "value": "\"\"\"Research Protocol module\"\"\"\nfrom datetime import datetime\n\nfrom ..database import db\nfrom ..date_tools import FHIR_datetime\n\n\nclass ResearchProtocol(db.Model...
python
chosen
[ { "from": "system", "value": "Use structured context instead of additional data\n\nAdditional Data is deprecated https://docs.sentry.io/platforms/python/enriching-events/context/#additional-data\n" }, { "from": "human", "value": "\"\"\"\nHelper functions for Sentry Logs\n\"\"\"\nfrom sentry_sdk ...
python
chosen
[ { "from": "system", "value": "Ch05: Tag Detail: create view skeleton.\n" }, { "from": "human", "value": "from django.http.response import HttpResponse\nfrom django.template import Context, loader\n\nfrom .models import Tag\n\n\ndef homepage(request):\n tag_list = Tag.objects.all()\n templa...
python
chosen
[ { "from": "system", "value": "Fix price calculator class names" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2017-02-16 07:39\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef update_price_calculator(apps, schema_edito...
python
chosen
[ { "from": "system", "value": "Fix plugin system loader and remove setup\n\n* We don't need a setup function, that's waht __init__ is for\n* There were copy pasta problems with classify. They're fixed.\n" }, { "from": "human", "value": "from pkg_resources import iter_entry_points\n\nfrom config i...
python
chosen
[ { "from": "system", "value": "[trunk] Add option to Python line ending conversion to specify a single filename on the command line\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\n\ndef convert_line_endings(file):\n if '\\r\\n' in open(file, 'rb').read():\n print '%s contai...
python
chosen
[ { "from": "system", "value": "Update tests to init flask and use test client\n" }, { "from": "human", "value": "from cryptography.hazmat.backends import default_backend\nfrom cryptography.hazmat.primitives import serialization\n\nimport base64\nimport unittest\nimport sys\nimport os\n\nsys.path....
python
chosen
[ { "from": "system", "value": "Clean up unused imports and add docstrings\n" }, { "from": "human", "value": "from app_factory.create_app import db\nfrom models import User\nfrom forms import RegistrationForm, LoginForm\n\n\ndef load_user(user_id):\n return User.query.filter_by(id=user_id).firs...
python
chosen
[ { "from": "system", "value": "Remove commented-out debug code :-(\n" }, { "from": "human", "value": "import json\nimport unittest\nfrom pathlib import Path\n\nfrom inselect.lib.document import InselectDocument\nfrom inselect.lib.segment import segment_document\n\n\nTESTDATA = Path(__file__).pare...
python
chosen
[ { "from": "system", "value": "Complete quick attempt at function.\n" }, { "from": "human", "value": "def balanceness(paren_series):\n indicator = 0\n for paren in paren_series:\n if paren == u'(':\n indicator += 1\n elif paren == u')':\n indicator -= 1\n...
python
chosen
[ { "from": "system", "value": "Use max representation for smaller space usage.\n" }, { "from": "human", "value": "import rot_standardise as rs_m\nimport trans_standardise as t_m\n\ndef standardise(orig_state): # Test code only\n possibilities = rs_m.rot_possibilities(orig_state)\n all_combi...
python
chosen
[ { "from": "system", "value": "Add error logging to nagios wrapper\n" }, { "from": "human", "value": "import subprocess\n\nnagiosPluginsCommandLines = [\n \"/usr/lib64/nagios/plugins/check_sensors\",\n \"/usr/lib64/nagios/plugins/check_mailq -w 10 -c 20 -M postfix\",\n]\n\n\nclass NagiosWra...
python
chosen
[ { "from": "system", "value": "Change Status filters to build from constant\n" }, { "from": "human", "value": "\"\"\"\nsentry.filters.base\n~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\nfro...
python
chosen
[ { "from": "system", "value": "Clean up namespace as mentioned.\n" }, { "from": "human", "value": "\"\"\"\ngithub3\n=======\n\nSee http://github3py.rtfd.org/ for documentation.\n\n:copyright: (c) 2012 by Ian Cordasco\n:license: Modified BSD, see LICENSE for more details\n\n\"\"\"\n\n__title__ = '...
python
chosen
[ { "from": "system", "value": "Add simple test to fail in case of duplicate migration ids.\n\nThe test fails by showing which migrations are duplicated.\n\n```python\nsrc/olympia/core/tests/test_db.py:29: in test_no_duplicate_migration_ids\n assert not duplicates\nE AssertionError: assert not {'99'}\n``...
python
chosen
[ { "from": "system", "value": "Add an all to init\n" }, { "from": "human", "value": "try:\n from tkinter import *\nexcept:\n from Tkinter import *\n\n# -----------------------------\n \nimport utilities as utils\nfrom alerts import *\n\nfrom App import App\nfrom Box import Box\nfrom Butto...
python
chosen
[ { "from": "system", "value": "Add fields to index so 'update_index' works\n" }, { "from": "human", "value": "from haystack import indexes\nfrom books.models import Book, Series\n\n\nclass BookIndex(indexes.SearchIndex, indexes.Indexable):\n\n text = indexes.CharField(document=True, use_templa...
python
chosen
[ { "from": "system", "value": "Revert changes to py-bindings script\n\n--HG--\nbranch : windows\n" }, { "from": "human", "value": "from os.path import abspath, dirname\nfrom sys import platform\nif platform != 'nt' and platform != 'win32':\n from ompl import dll_loader\n dll_loader('ompl', ...
python
chosen
[ { "from": "system", "value": "Add a Screen test for sequence of KCSAPI responses.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport pytest\n\nimport client\nfrom kcaa import screens\n\n\nclass TestScreen(object):\n\n def test_mission_result(self):\n screen = client.Scr...
python
chosen
[ { "from": "system", "value": "Set the new ImageAnalyzer executable for multi-processing.\n" }, { "from": "human", "value": "#!/usr/bin/python\nfrom joblib import Parallel, delayed\nimport multiprocessing\n\nimport os\nfrom subprocess import call\n\n# inputpath = '/data/amnh/darwin/images'\n# seg...
python
chosen
[ { "from": "system", "value": "Add a waffle flag for GraphQL.\n" }, { "from": "human", "value": "from django.views.decorators.csrf import csrf_exempt\n\nfrom graphene_django.views import GraphQLView\n\n\nclass MozilliansGraphQLView(GraphQLView):\n \"\"\"Class Based View to handle GraphQL reque...
python
chosen
[ { "from": "system", "value": "[IMP] Update dotfiles + switch to GH actions\n" }, { "from": "human", "value": "# Copyright 2019 Vicent Cubells <vicent.cubells@tecnativa.com>\n# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html\n\n{\n \"name\": \"Purchase Stock Picking Invoice Link...
python
chosen
[ { "from": "system", "value": "Fix buggy use of pytest.raises() in tests.\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\n\nimport os\n\nimport pytest\n\nimport _test_utilities\n\n\ndef test_fix_outsourcing_contrib_comments():\n\n if...
python
chosen
[ { "from": "system", "value": "Implement a test checking that options needs to be a non empty list\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport click\nimport pytest\n\nfrom cookiecutter.compat import read_user_choice\n\nOPTIONS = ['hello', 'world', 'foo', 'bar']\n\n\nEXPEC...
python
chosen
[ { "from": "system", "value": "Remove unused import from test short url\n" }, { "from": "human", "value": "import app\nfrom models import ShortURL\n\n\ndef test_encode_decode():\n base = ShortURL.base\n ids_to_test = (\n 0, 1, 2, 9, 10, 11, 15, 89, 1000, 999, 998, 8765431234567,\n ...
python
chosen
[ { "from": "system", "value": "Remove superfluous (and wrong!) product config declaration\n" }, { "from": "human", "value": "# Copyright (c) 2008-2011 gocept gmbh & co. kg\n# See also LICENSE.txt\n\nfrom zope.testing import doctest\nimport unittest\nimport zeit.cms.testing\nimport zeit.workflow.t...
python
chosen
[ { "from": "system", "value": "Test 2.11: Turn list into generator.\n" }, { "from": "human", "value": "import random\nimport string\nimport unittest\n\nfrom Crypto.Cipher import AES\n\nimport padlib\n\n\ndef encryption_oracle(input):\n key = ''.join(random.sample(string.printable, 16))\n mo...
python
chosen
[ { "from": "system", "value": "Add path to updated local settings file\n\nWhen pull request #34 was merged it broke manage.py because it didnt point to the DJANGO_SETTINGS_MODULE environment variable to new updated local settings file.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimp...
python
chosen
[ { "from": "system", "value": "Fix up template crap to not use same name locally hurr\n" }, { "from": "human", "value": "import types\n\nfrom fabric.api import env, run\nfrom fabric.contrib import files\n\n\nclass Integration(object):\n def setup(self):\n env.host_string = \"127.0.0.1\"...
python
chosen
[ { "from": "system", "value": "Update ALLOWED_HOSTS for new Heroku app name" }, { "from": "human", "value": "from service.settings.base import *\n\nSECRET_KEY = os.getenv('SECRET_KEY')\n\nDEBUG = False\n\nALLOWED_HOSTS = [\n 'blooming-cliffs-50597.herokuapp.com',\n]\n\nSTATIC_ROOT = os.path.jo...
python
chosen
[ { "from": "system", "value": "Fix bug where admin panel was redirected to semesterpage app\n" }, { "from": "human", "value": "\"\"\"kokekunster URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/htt...
python
chosen
[ { "from": "system", "value": "Add pythonic way to concatenate strings.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport urllib2\nimport json\nimport argparse\n\n\ndef get_metric(host, port, metric):\n response = urllib2.urlopen(\n 'htt...
python
chosen
[ { "from": "system", "value": "Add assertion for number of fields on person\n" }, { "from": "human", "value": "from test.utils.assertions import assert_header_value, assert_json_response\n\nfrom test.utils.helpers import get_json_from_response, get_identifier_for_created_person\n\n\n# noinspectio...
python
chosen
[ { "from": "system", "value": "Fix task email recipients list format\n" }, { "from": "human", "value": "from decimal import Decimal\n\nfrom django.conf import settings\nfrom django.core.mail import EmailMessage\n\nfrom celery.utils.log import get_task_logger\n\nfrom .csv_attach import CSVAttachme...
python
chosen
[ { "from": "system", "value": "[test] Test `/` as logged in user\n" }, { "from": "human", "value": "\ndef test_home(client):\n resp = client.get('/')\n assert resp.status_code == 200\n assert b\"Login\" in resp.content\n assert b\"Home\" in resp.content\n assert b\"Communities\" in...
python
chosen
[ { "from": "system", "value": "Use getenv built-in default selection" }, { "from": "human", "value": "import os\nimport urlparse\nfrom redis import Redis\nfrom rq import Worker, Queue, Connection\n\nlisten = ['high', 'default', 'low']\n\nredis_url = (os.getenv('REDISTOGO_URL') or 'http://localhos...
python
chosen
[ { "from": "system", "value": "Increase timeout for endpoint up\n" }, { "from": "human", "value": "# all the values are in seconds\nENDPOINT_UP_TIMEOUT = 60 * 10\nMADCORE_UP_TIMEOUT = 60 * 60\nDNS_RESOLVE_TIMEOUT = 60 * 30\nDNS_UPDATE_TIMEOUT = 60 * 10\nDOMAIN_HAS_SSL_CERTIFICATE_TIMEOUT = 60\n"...
python
chosen
[ { "from": "system", "value": "Correct for older Python3 version errors\n" }, { "from": "human", "value": "import numpy as np\nimport pandas as pd\nfrom transform import transform\n\n# Load the questions\nquestions = pd.read_csv('questions.csv')\n\n# Initialise the position of the user at the ori...
python
chosen
[ { "from": "system", "value": "Update yaml method to make CodeFactor happy\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# utility script to generate readme information based on CSV and datapackage\n#\n# pip install pandas\n# usage:\n# python readme_info.py datapackage\n\nimport y...
python
chosen
[ { "from": "system", "value": "Mark that audio has completed in dummy tts\n" }, { "from": "human", "value": "# Copyright 2020 Mycroft AI 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 License.\n# You may obta...
python
chosen
[ { "from": "system", "value": "Use os.system to initialise db in tests\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# re...
python
chosen
[ { "from": "system", "value": "Remove VERSION that prevented import *.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom mongorm.database import Database\nfrom mongorm.document import Field, Index\nfrom mongorm.utils import DotDict, JSONEncoder\n\n\nclass ValidationError(Exceptio...
python
chosen
[ { "from": "system", "value": "Fix funny things when rerunning code\n\nPrevent multiple \"Run\" buttons from appearing.\n\nRemove the canvas after pressing the Skulpt \"Run\" button.\n" }, { "from": "human", "value": "import document\nimport time\nevalstr = '''\nvar a=new XMLHttpRequest();a.open(...
python
chosen
[ { "from": "system", "value": "Add a function for questions to the survey resource\n" }, { "from": "human", "value": "from djangorestframework import views\nfrom djangorestframework import resources\nfrom . import models\n\nclass RatingResource (resources.ModelResource):\n model = models.Ratin...
python
chosen
[ { "from": "system", "value": "Make Steam api key optional\n" }, { "from": "human", "value": "from base import * # noqa\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME': 'lutris',\n 'USER': 'lutris',\n 'PASSWORD': 'admi...
python
chosen
[ { "from": "system", "value": "Implement some GML-to-GeoJSON logic in Python\n" }, { "from": "human", "value": "import json\n\nfrom lxml import etree\n\nGML_NS = 'http://www.opengis.net/gml'\n\ndef geojson_to_gml(gj):\n \"\"\"Given a dict deserialized from a GeoJSON object, returns an lxml Ele...
python
chosen
[ { "from": "system", "value": "mpi: Fix Grid pickling in YASK\n" }, { "from": "human", "value": "import devito.grid as grid\n\nfrom devito.yask.function import Constant\nfrom devito.yask.wrappers import contexts\n\n__all__ = ['Grid']\n\n\nclass Grid(grid.Grid):\n\n def __init__(self, *args, **...
python
chosen
[ { "from": "system", "value": "Update for Django version 1.11\n" }, { "from": "human", "value": "\"\"\"\nContains some common filter as utilities\n\"\"\"\nfrom django.template import Library, loader, Context\nfrom django.contrib.admin.templatetags.admin_list import result_headers, result_hidden_f...
python
chosen
[ { "from": "system", "value": "Allow for callables in getIntProperty()\n\nSome tags can now implicitly be functions, as long as they are called\nthrough getIntProperty().\nThe function will take the current value as input, and will output the\nresult of a calculation. This matters for Gahz'rilla and Blessed ...
python
chosen
[ { "from": "system", "value": "Replace string withe nvironment variable\n" }, { "from": "human", "value": "import slackclient\nimport time\nimport os\n\nslackClient = slackclient.SlackClient(os.environ[\"SLACK_TOKEN\"])\nslackClient.rtm_connect()\nlastPingTime = 0\nwhile True:\n for message in...
python
chosen
[ { "from": "system", "value": "Move return statement in _lookup_user into except/else flow\n" }, { "from": "human", "value": "from django.contrib.auth import get_user_model\nfrom django.conf import settings\nfrom django.contrib.auth.models import check_password\nfrom django.core.validators import...
python
chosen
[ { "from": "system", "value": "Add missing error URL regex\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nimport views\n\n\nurlpatterns = patterns('',\n url(r'^$', views.home, name='pontoon.home'),\n url(r'^locale/(?P<locale>[A-Za-z0-9\\-\\@\\.]+)/url/(?P<url>...
python
chosen
[ { "from": "system", "value": "tests/basics: Add test for break from within try within a for-loop.\n" }, { "from": "human", "value": "# Test various loop types, some may be implemented/optimized differently\nwhile True:\n try:\n break\n finally:\n print('finally 1')\n\n\nfor i...
python
chosen
[ { "from": "system", "value": "Refactor Forecast to also use shared AWSError class\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport json\n\n\nclass AWSError(Exception):\n TYPE = None\n STATUS = 400\n\n def __init__(self, message, type=None, status=None...
python
chosen
[ { "from": "system", "value": "Add a test for asv machine --yes using defaults values\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom __future__ import (absolute_import, division, print_function,\n ...
python
chosen
[ { "from": "system", "value": "Print eval results in test\n" }, { "from": "human", "value": "import unittest\nimport time\nimport pandas as pd\nfrom bert_trainer import BERTTrainer\nfrom utils import *\n\nclass TestBERT(unittest.TestCase):\n\n def test_init(self):\n trainer = BERTTraine...
python
chosen
[ { "from": "system", "value": "Add kill_adb() and increase python-adb logging to WARNING.\n\nIt gives a master switch that can easily be temporarily increased to INFO or\neven DEBUG when needed by simply pushing a new tainted swarming server version.\nThis helps quickly debugging issues. On the other hand, e...
python
chosen
[ { "from": "system", "value": "Make submodules script work in both 2 and 3 pythons\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport re\nimport subprocess\n\ndef main():\n source = open(\".gitmodules\").read()\n paths = re.findall(r\"path = (.*)\", source)\n\n print \"github...
python
chosen
[ { "from": "system", "value": "Fix typo in docs for /icon set.\n" }, { "from": "human", "value": "import asyncio\nimport io\nimport re\n\nfrom plumeria.command import commands, CommandError\nfrom plumeria.message import Message\nfrom plumeria.message.image import read_image\nfrom plumeria.perms i...
python
chosen