conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make compatible with Python <2.7\n\nThe argparse module was added in Python 2.7, but the Python bundled\nwith Inkscape is 2.6. Switching to optparse makes this extension\ncompatible with the Python bundled with Inkscape.\n" }, { "from": "human", "value": "#!/usr/bi...
python
chosen
[ { "from": "system", "value": "Change test to check for KeyError instead of IndexError for test_non_item\n" }, { "from": "human", "value": "from hash_table import HashTable\nimport io\nimport pytest\n\n\nwords = []\n\nwith io.open('/usr/share/dict/words', 'r') as word_file:\n words = word_file...
python
chosen
[ { "from": "system", "value": "Complete site scraper for all American cities\n\nareaScraper.py contains the getCities() function, which will\nreturn a dictionary of 'city name string' : 'url string'\nfor each Craigslist \"site\", corresponding to American cities,\nregions, etc.\n" }, { "from": "human...
python
chosen
[ { "from": "system", "value": "Make Grok a new-style class inheriting from object\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass Grok:\n\n \"\"\"stats.grok.se article statistics.\"\"\"\n\n def __init__(self, title, site):\n self.site = site\n self.title ...
python
chosen
[ { "from": "system", "value": "Validate if the file exists (if/else)\n" }, { "from": "human", "value": "#Import dependencies\n#Load OS functions from the standard library\nimport os\n\nos.chdir('/home/israel/Development/Python_Exercises/python-octo-wookie/head1stpython/Chapter3')\n#Change path fo...
python
chosen
[ { "from": "system", "value": "Add some tests for the implemented methods\n" }, { "from": "human", "value": "import unittest\n\nfrom dict_utils import dict_utils\n\nclass DictUtilsTestCase(unittest.TestCase):\n\n def test_dict_search(self):\n pass\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Refactor tests to check for the new headers\n" }, { "from": "human", "value": "from unittest import mock\nfrom werkzeug.test import EnvironBuilder\n\nfrom notifications_utils import request_helper\nfrom notifications_utils.request_helper import CustomRequest\n\n\nde...
python
chosen
[ { "from": "system", "value": "Fix checking for available locales\n\n\"subprocess.check\" returns bytes, so we need to decode the lang\ncodes before comparing them with required languages.\n" }, { "from": "human", "value": "\nimport subprocess\n\n\"\"\"Helper functions, decorators,... for working...
python
chosen
[ { "from": "system", "value": "Fix broken tag-tree links in changelog\n" }, { "from": "human", "value": "# Obtain shared config values\nimport sys\nimport os\nfrom os.path import abspath, join, dirname\n\nsys.path.append(abspath(join(dirname(__file__), '..')))\nfrom shared_conf import *\n\n# Loca...
python
chosen
[ { "from": "system", "value": "Test before creating the get_pv() method\n" }, { "from": "human", "value": "import rml.element\n\n\ndef test_create_element():\n e = rml.element.Element('BPM', 6.0)\n assert e.get_type() == 'BPM'\n assert e.get_length() == 6.0\n\n\ndef test_add_element_to_f...
python
chosen
[ { "from": "system", "value": "Rename test class consistently with others.\n" }, { "from": "human", "value": "import unittest\n\nimport websockets\nimport websockets.client\nimport websockets.exceptions\nimport websockets.legacy.auth\nimport websockets.legacy.client\nimport websockets.legacy.prot...
python
chosen
[ { "from": "system", "value": "Fix `assert_called` usage for Python 3.5 build\n\nThe `assert_called` method seems to invoke a bug caused by a type in the\nunittest mock module. (The bug was ultimately tracked and fix here:\nhttps://bugs.python.org/issue24656)\n" }, { "from": "human", "value": "# ...
python
chosen
[ { "from": "system", "value": "Fix 500 error when no ID parameter is passed\n" }, { "from": "human", "value": "import json\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.http import HttpResponse, Http404, HttpResponseBadRequest\nfrom django.views.generic.detail import BaseDet...
python
chosen
[ { "from": "system", "value": "Make the language changeable via a GET parameter.\n" }, { "from": "human", "value": "#!/usr/bin/env python2.7\nfrom werkzeug.wrappers import Request, Response\n\nfrom get_html import get_html, choose_lang\n\n@Request.application\ndef run(request):\n\tlang = choose_l...
python
chosen
[ { "from": "system", "value": "Fix memcache hosts setting from env\n\nBefore this fix if one had set OS env vars for both CLUSTER_SERVERS and\nMEMCACHE_HOSTS the value of later would override the former and the\ngraphite web application fails to show any metrics.\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Make the hash function for generic case\n" }, { "from": "human", "value": "\"\"\"This module contains utility functions for the Mythril support package.\"\"\"\nfrom typing import Dict\nimport logging\nimport _pysha3 as sha3\n\nlog = logging.getLogger(__name__)\n\n\n...
python
chosen
[ { "from": "system", "value": "Add basic state machine for gear ratios\n" }, { "from": "human", "value": "import threading\n\n# Sounds note: Could use http://simpleaudio.readthedocs.io/en/latest/installation.html\nclass GearRatio (threading.Thread):\n PIN1 = 5\n PIN2 = 6\n\n STATE_IDLE =...
python
chosen
[ { "from": "system", "value": "Introduce scope_types in server password policy\n\noslo.policy introduced the scope_type feature which can\ncontrol the access level at system-level and project-level.\n - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope\n - http://specs.openstack.org...
python
chosen
[ { "from": "system", "value": "Convert text columns to varchar for mysql\n" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 4093ccb6d914\nRevises: None\nCreate Date: 2014-04-30 22:02:09.991428\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '4093ccb6d914'\ndo...
python
chosen
[ { "from": "system", "value": "Add a command line argument for enabling instatrace globally\n" }, { "from": "human", "value": "import argparse\nimport logging\nimport sys\n\nfrom . import commands\n\nparser = argparse.ArgumentParser(description=\"Cobe control\")\nparser.add_argument(\"-b\", \"--b...
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": "Change postman testing environment to development\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\n\nfrom instance.config import app_config\n\n\napp = Flask(__name__)\n\n\ndef EnvironmentName(environ):\n app.con...
python
chosen
[ { "from": "system", "value": "FIX partner person not instalable\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\n{\n 'name': 'Partners Persons Management',\n 'version': '1.0',\n 'category': 'Tools',\n 'sequence': 14,\n 'summary': '',\n 'description': \"\"\"\nPart...
python
chosen
[ { "from": "system", "value": "Add -h as an alternative help flag\n" }, { "from": "human", "value": "import click\n\nimport repl as benchrepl\n\n@click.group()\n@click.option('--debug/--no-debug', default=False)\ndef cli(debug):\n\t\"\"\"Benchctl is a utility for interacting with benchd and bench...
python
chosen
[ { "from": "system", "value": "Make sure there is a default for LOG Group\n" }, { "from": "human", "value": "import os\n\n\nEQ_RABBITMQ_URL = os.getenv('EQ_RABBITMQ_URL', 'amqp://admin:admin@localhost:5672/%2F')\nEQ_RABBITMQ_QUEUE_NAME = os.getenv('EQ_RABBITMQ_QUEUE_NAME', 'eq-submissions')\nEQ_R...
python
chosen
[ { "from": "system", "value": "Mark 2012.2 final in prep for RC1\n\nMark 2012.2 Final=True as we prepare to publish Nova Folsom RC1\n\nChange-Id: I72731bded164aeec3c7e47f6bfe44fb219a9ea56\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenSta...
python
chosen
[ { "from": "system", "value": "Use treestore to get URIs from IDs.\n" }, { "from": "human", "value": "from treestore import Treestore\nimport settings\n\n\ndef get_treestore():\n return Treestore(**settings.TREESTORE_KWARGS)\n\ndef uri_from_tree_id(tree_id):\n return (settings.TREE_URI + tr...
python
chosen
[ { "from": "system", "value": "Fix clean logs script wrong date parsing\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport os\nimport datetime\n\nfrom config import USER_DIRECTORY, LOG_DIRECTORY_NAME, STORE_LOGS\n\n\nNOW = datetime.datetime.now()\n\ndef clean_lo...
python
chosen
[ { "from": "system", "value": "Change Site.fields to protected Site._fields\n" }, { "from": "human", "value": "from six import iteritems\n\nfrom yolapy.services import Yola\n\n\nclass Site(object):\n \"\"\"Represents a Site resource on the Yola API.\"\"\"\n\n def __init__(self, **kwargs):\n...
python
chosen
[ { "from": "system", "value": "Change the import statement so that the test is skipped when\nos.startfile is not present.\n" }, { "from": "human", "value": "# Ridiculously simple test of the os.startfile function for Windows.\n#\n# empty.vbs is an empty file (except for a comment), which does\n# ...
python
chosen
[ { "from": "system", "value": "Use type's module and name to show full class path correctly\n" }, { "from": "human", "value": "import json\n\nclass Model:\n def __init__(self, client, data, conversion = None):\n self._client = client\n self._data = data\n\n for k, v in dat...
python
chosen
[ { "from": "system", "value": "Fix python3 crash and cleaner error reporting.\n" }, { "from": "human", "value": "\nfrom __future__ import print_function\n\nimport subprocess\nimport sys\n\n\nDOCKER_CREATE_IN = 'docker create -it nodev {}'\nDOCKER_SIMPLE_CMD_IN = 'docker {} {container_id}'\n\n\nde...
python
chosen
[ { "from": "system", "value": "Add docstring into load function\n\nDescribe which file parse at least.\n" }, { "from": "human", "value": "# Copyright 2015-2016 Masayuki Yamamoto\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compl...
python
chosen
[ { "from": "system", "value": "Add an option to show a personalised block to everyone\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.utils.translation import ugettext_lazy as _\nfrom wagtail.core import blocks\n\nfrom wagtail_personalisa...
python
chosen
[ { "from": "system", "value": "Fix problems with videos that do not have 720p mode\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n__all__ = ['dailymotion_download']\n\nfrom ..common import *\n\ndef dailymotion_download(url, output_dir = '.', merge = True, info_only = False):\n \"\...
python
chosen
[ { "from": "system", "value": "Make shape a property for LinearAAMAlgorithmResult\n" }, { "from": "human", "value": "from __future__ import division\nfrom menpofit.result import (\n ParametricAlgorithmResult, MultiFitterResult, SerializableIterativeResult)\n\n\n# TODO: document me!\n# TODO: ha...
python
chosen
[ { "from": "system", "value": "Add first model for Enrollment application\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\nfrom Portal.models import CharacterAttribute\nfrom dja...
python
chosen
[ { "from": "system", "value": "Switch to real-time index (easier for low volume)\n" }, { "from": "human", "value": "from haystack import indexes\nfrom pylinks.links.models import Link\n\n\nclass LinkIndex(indexes.SearchIndex, indexes.Indexable):\n text = indexes.CharField(document=True, use_te...
python
chosen
[ { "from": "system", "value": "Add handler and logger for management commands\n" }, { "from": "human", "value": "import os\nfrom .toggles import *\n\nif not DEBUG:\n EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\n EMAIL_HOST = os.environ.get('RCAMP_EMAIL_HOST')\n EMAIL_PO...
python
chosen
[ { "from": "system", "value": "Add a context to the fixture translations\n" }, { "from": "human", "value": "import json\nimport codecs\nimport tempfile\nfrom django.core.management.commands.makemessages import Command as BaseCommand\n\n\nclass Command(BaseCommand):\n \"\"\" Extend the makemess...
python
chosen
[ { "from": "system", "value": "FIX: Fix abnormally big spikes in graph\n" }, { "from": "human", "value": "class App(object):\n def __init__(self, ID, name):\n self.ID = ID\n self.name = name\n self.date = []\n self.minutes = []\n self.last_day = []\n\n def...
python
chosen
[ { "from": "system", "value": "Add missing dependency for pyuv.\n" }, { "from": "human", "value": "#\n# This file is part of gruvi. Gruvi is free software available under the terms\n# of the MIT license. See the file \"LICENSE\" that was provided together with\n# this source file for the licensin...
python
chosen
[ { "from": "system", "value": "Revise download_url string for consistency with main script\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\nfrom pyspeedtest import __program__, __version__\n\n# allow setup.py to be run from any path\nos.chdir(os.path.dirname(os.path.abs...
python
chosen
[ { "from": "system", "value": "Use a context handler for reading in README\n" }, { "from": "human", "value": "from setuptools import setup\n\nfrom pybib import __version__\n\nsetup(name='pybib',\n version=__version__,\n description='Fetch citation information, given a Digital Object Ide...
python
chosen
[ { "from": "system", "value": "Update long_description for PyPI description integration\n" }, { "from": "human", "value": "from authy import __version__\nfrom setuptools import setup, find_packages\n\n# to install authy type the following command:\n# python setup.py install\n#\n\nsetup(\n ...
python
chosen
[ { "from": "system", "value": "Fix syntax of dependencies to be compatible with debuild\n\nAlso drop argparse as an explicit dependency, it's\npart of python3\n" }, { "from": "human", "value": "from distutils.core import setup\n\nfrom setuptools import find_packages\n\nsetup(\n name='mediawiki...
python
chosen
[ { "from": "system", "value": "Bump version number for host clone functionality\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='striketracker',\n version='0.5',\n description='Command line interface to the Highwinds CDN',\n url='https://github.com/Hig...
python
chosen
[ { "from": "system", "value": "Remove build status from rst for PyPI\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='django-cacheops',\n version='1.3.1',\n author='Alexander Schepanovski',\n author_email='suor.web@gmail.com',\n\n description='A sli...
python
chosen
[ { "from": "system", "value": "Add comma to separate classifiers\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='lmsh',\n version='0.1',\n description=\"Command line interface to Lab Manager SOAP API\",\n license='BSD',\n author='Jam...
python
chosen
[ { "from": "system", "value": "Update package details to point to my repo\n\nIs this right? I guess it's right since I'm taking over\nresponsibility for this fork. Would be nice if the package\necosystem had a full \"history of ownership\" feature instead\nof just overwriting everything in your own name?\n" ...
python
chosen
[ { "from": "system", "value": "Make long description not point to Travis since can't guarantee tag\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom setuptools import setup\n\nlong_description=\"\"\"TravisCI results \n .. ima...
python
chosen
[ { "from": "system", "value": "Add a prerelease version number.\n" }, { "from": "human", "value": "\"\"\"\nFlask-Selfdoc\n-------------\n\nFlask selfdoc automatically creates an online documentation for your flask app.\n\"\"\"\nfrom setuptools import setup\n\n\ndef readme():\n with open('READM...
python
chosen
[ { "from": "system", "value": "Reduce the requirements a little bit.\n" }, { "from": "human", "value": "try:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nimport sys\n\ndata = dict(\n name='python-datetime_tz',\n version='0.1',\n author='...
python
chosen
[ { "from": "system", "value": "Fix smart_open to version which supports gzip streaming\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\npackage = 'aws-utils'\nversion = '0.2.7'\n\nINSTALL_REQUIRES = [\n 'boto>=2.38.0',\n 'boto3>=1.2.3',\n 'smart-open>=1.3...
python
chosen
[ { "from": "system", "value": "Update pyuntl source to match aubrey's requirement" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nsetup(\n name='aubreylib',\n version='2.0.0',\n description='A helper library for the Aubrey access system.',\n a...
python
chosen
[ { "from": "system", "value": "Fix up package naming confusion for the moment.\n" }, { "from": "human", "value": "import os\nimport setuptools\n\nsetuptools.setup(\n name='gymnasium',\n version='0.0.2',\n packages=setuptools.find_packages(),\n author='Leif Johnson',\n author_email=...
python
chosen
[ { "from": "system", "value": "Set version number, add beta status\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\n\n\nsetup(name='django-backupdb',\n versi...
python
chosen
[ { "from": "system", "value": "Use >= for install requirements\n\nThe currently listed requirements are getting a bit old and it's hard to resolve them\r\nwith the requirements in other libraries." }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport census\n\nlong_...
python
chosen
[ { "from": "system", "value": "Fix install error for [pip install git+git://..]\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\nversion = '0.1.0'\nname = 'apns-proxy-client'\nshort_description = 'Client library for APNs Proxy Server.'\n\ndef read(fname):\n return ...
python
chosen
[ { "from": "system", "value": "Update classifiers for a beta release\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Setup script for GDM.\"\"\"\n\nimport setuptools\n\nfrom gdm import __project__, __version__, CLI, DESCRIPTION\n\nimport os\nif os.path.exists('README.rst'):\n ...
python
chosen
[ { "from": "system", "value": "Create a pre-release with the new zenodo metadata\n\nA recent PR added .zenodo.json. Making a pre-release should trigger zenodo to rebuild their info page." }, { "from": "human", "value": "# Package versioning solution originally found here:\n# http://stackoverflow....
python
chosen
[ { "from": "system", "value": "Add importlib dependency on Py2.6\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os, sys\n\nversion = '0.0.1'\n\nhere = os.path.abspath(os.path.dirname(__file__))\ntry:\n README = open(os.path.join(here, 'README.rst')).read...
python
chosen
[ { "from": "system", "value": "Call long_desc instead of the function\n" }, { "from": "human", "value": "import multiprocessing # noqa # stop tests breaking tox\nfrom setuptools import find_packages, setup\n\nimport tvrenamr\n\n\ndef long_desc():\n with open('README.rst') as f:\n readm...
python
chosen
[ { "from": "system", "value": "Add a console_scripts entry point\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom setuptools import setup\n\n\nsetup(name=\"abzer\",\n author=\"Wieland Hoffmann\",\n author_email=\"themineo@gmail.com\",...
python
chosen
[ { "from": "system", "value": "Allow posting data as dict by jquery\n" }, { "from": "human", "value": "from django.core.exceptions import ObjectDoesNotExist\nfrom django.shortcuts import get_object_or_404\nfrom rest_framework import renderers, status\nfrom rest_framework.decorators import rendere...
python
chosen
[ { "from": "system", "value": "Bump version number to 0.2.9\n\nSigned-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>\n" }, { "from": "human", "value": "\"\"\"Download genome files from the NCBI\"\"\"\nfrom .config import (\n SUPPORTED_TAXONOMIC_GROUPS,\n NgdCo...
python
chosen
[ { "from": "system", "value": "Add Method the return time now in complete UTC iso complete format\n" }, { "from": "human", "value": "\"\"\"Helper functions\n\nConsists of functions to typically be used within templates, but also\navailable to Controllers. This module is available to templates as ...
python
chosen
[ { "from": "system", "value": "Test for a deferred result of DeployScript.main\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nUnit tests for the implementation ``flocker-deploy``.\n\"\"\"\n\nfrom twisted.trial.unittest import TestCase, S...
python
chosen
[ { "from": "system", "value": "Add current date to generated HTML\n" }, { "from": "human", "value": "import os\n\ntemplate_header = \"\"\"<html>\n<head><title>Littlefield Charts</title></head>\n<body>\n<table>\"\"\"\n\ntemplate_footer = \"\"\"</table>\n<p><a href=\"production.csv\">Download produ...
python
chosen
[ { "from": "system", "value": "Add newline, spaces on string format\n\nAdd newline on end of file, put spaces around the string operator (pep8/pylint)." }, { "from": "human", "value": "\"\"\"Various display related classes.\n\nAuthors : MinRK, dannystaple\n\"\"\"\nimport urllib\n\nclass YouTubeVi...
python
chosen
[ { "from": "system", "value": "Add a simple block comment explaining what happens.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nsettings = \"\"\"settings = {\n logfile = \"/var/log/lsyncd/lsyncd.log\",\n statusFile = \"/var/log/lsyncd/lsyncd-status.log\",\n statusInterval = 5,...
python
chosen
[ { "from": "system", "value": "Debug and add test cases\n" }, { "from": "human", "value": "# Return true if two strings are anagrams of one another\n\ndef is_anagram(str_one, str_two):\n\t# lower case both strings to account for case insensitivity\n\ta = str_one.lower()\n\tb = str_two.lower()\n\n...
python
chosen
[ { "from": "system", "value": "Add test for mercurial repo\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 unicode_literals)\n...
python
chosen
[ { "from": "system", "value": "Remove Launcher.updatedir after mkdirs test\n\nShould go into fixture later\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\n\nfrom ..pyautoupdate.launcher import Launcher\nfrom .pytest_makevers import create_update_dir\nimp...
python
chosen
[ { "from": "system", "value": "Support multiple templates in TEST_TEMPLATES setting.\n\nUnit tests need to be able to test redirects and other features\ninvolving multiple web pages. This commit changes the singleton\nTEST_TEMPLATE setting to TEST_TEMPLATES, which is a list of\npath, template tuples.\n" }...
python
chosen
[ { "from": "system", "value": "Add an interface class and a base class of for Excel Workbook\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport xlsxwriter\n\n\nclass Ex...
python
chosen
[ { "from": "human", "value": "Add new skipUnlessBuiltin function for testing\n" }, { "from": "gpt", "value": "# Copyright (C) 2017 Martin Packman <gzlist@googlemail.com>\n#\n# This file is part of paramiko.\n#\n# Paramiko is free software; you can redistribute it and/or modify it under the\n# ter...
python
chosen
[ { "from": "system", "value": "Use default user/password for testing\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os, sys\n\nsys.path.insert(0, '..')\n\nPROJECT_ROOT = os.path.dirname(__file__)\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES = {\n 'default': {\n ...
python
chosen
[ { "from": "system", "value": "Fix tests to correctly decode utf-8 bytestrings.\n" }, { "from": "human", "value": "import json\n\n\ndef test_get_user_list(client, user):\n response = client.get(\"/api/v1/users\")\n user_list = json.loads(str(response.data))\n user_data = user_list[\"data...
python
chosen
[ { "from": "system", "value": "Test for valid and invalid project names\n" }, { "from": "human", "value": "import sys\nimport unittest\n\nfrom skeletor.config import Config\n\nfrom .helpers import nostdout\n\n\nclass ConfigTests(unittest.TestCase):\n \"\"\" Argument Passing & Config Tests. \"\...
python
chosen
[ { "from": "system", "value": "Add tests for class Person\n" }, { "from": "human", "value": "import unittest\nfrom classes.person import Person\n\n\nclass PersonClassTest(unittest.TestCase):\n pass\n # def test_add_person_successfully(self):\n # my_class_instance = Person()\n # ...
python
chosen
[ { "from": "system", "value": "Add a stop method to base class\n" }, { "from": "human", "value": "import json\nimport pika\n\n\nclass Publisher(object):\n\n def __init__(self, rabbit_url, exchange):\n self._rabbit_url = rabbit_url\n self._exchange = exchange\n self._connec...
python
chosen
[ { "from": "system", "value": "Add installer and uninstaller to main\n" }, { "from": "human", "value": "import sys\nimport argparse\nfrom .__init__ import __version__\nfrom . make_bash import add_make_bash\nfrom . check_recipe import add_check_recipe\nfrom . list_files import add_list_files\nfrom...
python
chosen
[ { "from": "system", "value": "Sort the logfile by added time.\n" }, { "from": "human", "value": "from flask.ext.admin import Admin\nfrom flask.ext.admin.contrib.sqla import ModelView\n\nfrom dadd.master import models\n\n\nclass ProcessModelView(ModelView):\n # Make the latest first\n colum...
python
chosen
[ { "from": "system", "value": "Implement rudimentary unit tests for dragon class\n" }, { "from": "human", "value": "import pytest\nfrom mugloar import dragon\n\n\ndef test_partition():\n for solution in dragon.partition(20, 4, 0, 10):\n print(solution)\n assert abs(solution[0]) +...
python
chosen
[ { "from": "system", "value": "Fix test for new bands_inspect version.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\nimport pytest\nimport tempfile\nimport numpy as np\nimport bands_inspect as bi\nfrom click.testing import CliRunner\n\nimport tb...
python
chosen
[ { "from": "system", "value": "Add tests for base64 image\n" }, { "from": "human", "value": "import unittest\nfrom xhtml2pdf.parser import pisaParser\nfrom xhtml2pdf.context import pisaContext\n\n_data = b\"\"\"\n<!doctype html>\n<html>\n<title>TITLE</title>\n<body>\nBODY\n</body>\n</html>\n\"\"\...
python
chosen
[ { "from": "system", "value": "Fix broken plugin on Windows.\n" }, { "from": "human", "value": "# encoding: utf-8\n\n'''This adds a \"slugify\" command to be invoked by Sublime Text. It is made\navailable as \"Slugify\" in the command palette by Default.sublime-commands.\nParts of these commands ...
python
chosen
[ { "from": "system", "value": "cm: Use `twine` to deploy Wikked to Pypi.\n" }, { "from": "human", "value": "from invoke import task, run\n\n\n@task\ndef makerelease(ctx, version, local_only=False):\n if not version:\n raise Exception(\"You must specify a version!\")\n\n # FoodTruck a...
python
chosen
[ { "from": "system", "value": "Put weaker requirements on Archive.org service\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nThis module contains Service implementation of Archive.org.\nhttp://archive.org\n\"\"\"\n\n\nfrom . import Service, JSONMixin\n\nfrom six import text_t...
python
chosen
[ { "from": "system", "value": "Support case when expiration_datetime is None\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\n\nfrom invisibleroads_macros_security import make_random_string\n\n\nclass DictionarySafe(dict):\n\n def __init__(self, key_length):\n ...
python
chosen
[ { "from": "system", "value": "Change name of date to datetime\n" }, { "from": "human", "value": "RESOURCE_METHODS = ['GET', 'POST', 'DELETE']\nITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']\n\nschema = {\n 'name': {\n 'type': 'string',\n 'minlength': 3,\n 'maxlength': 5...
python
chosen
[ { "from": "system", "value": "Change to use holding_area directory\n" }, { "from": "human", "value": "#!/usr/bin/python\nsplitString='images/clean/impc/'" }, { "from": "gpt", "value": "#!/usr/bin/python\n#splitString='images/clean/impc/'\nsplitString='images/holding_area/impc/'\n" ...
python
chosen
[ { "from": "system", "value": "Add special case for \"anywhere\"\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport dataproperty\nimport six\n\nfrom ._error import Netw...
python
chosen
[ { "from": "system", "value": "Make test names lower case prefix\n" }, { "from": "human", "value": "import unittest\nimport src\nimport sys\nfrom io import StringIO\n\n\nclass TestConfigFileLoading(unittest.TestCase):\n\n filepath_prefix = ''\n\n @classmethod\n def setUpClass(cls):\n ...
python
chosen
[ { "from": "system", "value": "Test multiple values of N and N_prime\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_library\nfro...
python
chosen
[ { "from": "system", "value": "Allow searching keys on snipts\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom snipts.models import Favorite, Snipt\n\nclass SniptAdmin(admin.ModelAdmin):\n readonly_fields = ('user',)\n list_display = ('title', 'slug', 'user', 'lex...
python
chosen
[ { "from": "system", "value": "Use OneToOneField on SecondaryStructure model\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance w...
python
chosen
[ { "from": "system", "value": "Add code test for test_remove function\n" }, { "from": "human", "value": "from devicehive import NetworkError\nfrom devicehive import ApiResponseError\n\n\ndef test_save(test):\n\n def handle_connect(handler):\n name = test.generate_id('n-s')\n desc...
python
chosen
[ { "from": "system", "value": "Fix for SQLAlchemy unicode warning\n" }, { "from": "human", "value": "\"\"\"Test Migration\n\nRevision ID: 132231d12fcd\nRevises: None\nCreate Date: 2013-04-27 11:09:23.896698\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '132231d12fcd'\ndown_rev...
python
chosen