conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "REFACTOR Improve test name's grammar and accuracy.\n" }, { "from": "human", "value": "from tddcommitmessage.messagebody import MessageBody\n\ndef test_message_wrapped_in_quotes():\n msg = MessageBody('forty-two')\n assert str(msg) == '\"forty-two\"'\n\ndef tes...
python
chosen
[ { "from": "system", "value": "Clean up the argument parsing\n" }, { "from": "human", "value": "from .settings import BongSettings, DEFAULT_MESSAGE\nfrom .metadata import VERSION, SUMMARY\nimport argparse\n\nPARSER = argparse.ArgumentParser(description=SUMMARY)\nPARSER.add_argument('-V', '--versi...
python
chosen
[ { "from": "human", "value": "Add build script Python version check\n" }, { "from": "gpt", "value": "import sys\nif sys.version_info[0] != 2 or not (5 <= sys.version_info[1] <= 7):\n sys.stderr.write('error: unsupported Python version (2.5-2.7 required)\\n')\n sys.exit(1)\n" } ]
python
chosen
[ { "from": "system", "value": "Remove explicit path from load_dotenv call\n" }, { "from": "human", "value": "#! /usr/bin/env python3.6\n# coding: utf-8\n\nimport os\nimport datetime as dt\nfrom pathlib import Path\n\nimport pytz\nfrom dotenv import load_dotenv\n\nenv_path = Path('.') / '.env'\nlo...
python
chosen
[ { "from": "system", "value": "Make some of the NetworkLocationSerializer fields read-only\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom rest_framework import serializers\nfrom rest...
python
chosen
[ { "from": "system", "value": "Rename test so it actually runs\n" }, { "from": "human", "value": "from pyxform.tests_v1.pyxform_test_case import PyxformTestCase\n\nclass WhitespaceTest(PyxformTestCase):\n def test_over_trim(self):\n self.assertPyxformXform(\n name='issue96',\...
python
chosen
[ { "from": "system", "value": "Update to reflect change of display_name --> name\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom opencivicdata.models import division as models\n\n\n@admin.register(models.Division)\nclass DivisionAdmin(admin.ModelAdmin):\n list_display...
python
chosen
[ { "from": "system", "value": "Enable fat binaries on pitman package\n" }, { "from": "human", "value": "CairoGraphicsPackage ('pixman', '0.30.0')\n" }, { "from": "gpt", "value": "class PixmanPackage (CairoGraphicsPackage):\n\tdef __init__ (self):\n\t\tCairoGraphicsPackage.__init__ (se...
python
chosen
[ { "from": "system", "value": "Use default number of workers from config\n\nconfig does a better job at figuring out the optimal number of workers,\nso it will be used instead.\n" }, { "from": "human", "value": "import Queue\n\nfrom parallel import worker\n\n\nclass Runner(object):\n def __ini...
python
chosen
[ { "from": "system", "value": "Change form field image to archive\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import forms\n\nfrom .models import Image\nfrom .widgets import MultipleUpload, CropExample\n\nfrom redactor.widgets import RedactorEdit...
python
chosen
[ { "from": "system", "value": "Return unformatted list from get_language_list.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf import settings\nfrom django.utils import translation\nfrom django.utils.translation import ugettext as _\n\nfrom six import text_type\nfrom ...
python
chosen
[ { "from": "system", "value": "Introduce Python 3.5 syntax error.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Python package to support the research during\nthe annual Lehrexkursion at Universität Hamburg.\n\"\"\"\nfrom os.path import dirname, join\n\nfrom . import csv\nfrom...
python
chosen
[ { "from": "system", "value": "Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.\n" }, { "from": "human", "value": "\"\"\"Handler utilities for getting non-monkey patched std lib stuff\n\nAllows one to get an unpatched thread module, with a thread\ndecor...
python
chosen
[ { "from": "system", "value": "Update year in the license header.\n" }, { "from": "human", "value": "# Copyright 2012 Rackspace\n#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additi...
python
chosen
[ { "from": "system", "value": "Add logging, requests and handle exceptions\n" }, { "from": "human", "value": "from urllib import urlopen\nfrom bs4 import BeautifulSoup\nfrom selenium import webdriver\n\ndef getBeautifulSoupObject(link):\n html = urlopen(link)\n return BeautifulSoup(html)\n\...
python
chosen
[ { "from": "system", "value": "Update to post to correct endpoint\n" }, { "from": "human", "value": "'''\nThe pastalog Log class, which simply sends a POST request to a the server.\n'''\nimport requests\n\n\nclass Log(object):\n def __init__(self, url, model_name):\n self.url = url\n ...
python
chosen
[ { "from": "system", "value": "Fix __str__ method for BookType Model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext as _\n\nfrom egielda import settings\n\n\nclass BookType(models.Model):\n publisher = models.CharField(max_length=...
python
chosen
[ { "from": "system", "value": "Change name of test to avoid collision\n\nThis was spotted by coveralls." }, { "from": "human", "value": "import sys\n\nif sys.hexversion < 0x02070000:\n import unittest2 as unittest\nelse:\n import unittest\n\nfrom hypothesis import given, example\nfrom hypot...
python
chosen
[ { "from": "system", "value": "Mark wiki edits as bot edit" }, { "from": "human", "value": "import ConfigParser\nimport datetime\nfrom wikitools import wiki\nfrom wikitools import category\nfrom plugin import Plugin\n\nclass MediaWiki(Plugin):\n def __init__(self, config=None):\n if config:\n...
python
chosen
[ { "from": "system", "value": "Allow handle_write to accept data\n" }, { "from": "human", "value": "\"\"\" Base classes and data for building the API \"\"\"\nfrom flask_restful import reqparse, Resource\n\nfrom .util import clean_attrs, set_attrs\nfrom dockci.server import DB\n\n\nAUTH_FORM_LOCAT...
python
chosen
[ { "from": "system", "value": "Use os.path.join instead of +\n" }, { "from": "human", "value": "__author__ = 'Maksim Dmitriev'\n\nimport argparse\nimport os\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument('-s', '--source', help='the icon to be resi...
python
chosen
[ { "from": "system", "value": "Change bools to functions in if_any" }, { "from": "human", "value": "import os\nfrom subprocess import Popen, PIPE\nfrom genes.lib.traits import if_any\nfrom genes.ubuntu.traits import is_ubuntu\nfrom genes.debian.traits import is_debian\n\n\n# TODO: stop using sudo...
python
chosen
[ { "from": "system", "value": "Add a route to send parrot images\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef hello():\n return \"Hello 0-downtime %s World!\" % os.environ.get('BLUEGREEN', 'bland')\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Support python 2 and 3 compatability\n" }, { "from": "human", "value": "#!/bin/python\n\ntry:\n import urllib.request as urlrequest\nexcept ImportError:\n import urllib as urlrequest\n\nimport json\n\n\nclass RESTfulApi:\n \"\"\"\n Generic REST API call\...
python
chosen
[ { "from": "system", "value": "Add comment about utils import\n\n" }, { "from": "human", "value": "# -*- mode: python; coding: utf-8 -*-\n# Copyright (c) 2018 Radio Astronomy Software Group\n# Licensed under the 2-clause BSD License\n\n\"\"\"init file for pyuvdata.\n\n\"\"\"\nfrom __future__ impo...
python
chosen
[ { "from": "system", "value": "Set the background color of the reslicer to the lowest value in the image data.\n" }, { "from": "human", "value": "\"\"\"\nDataTransformer\n\n:Authors:\n\tBerend Klein Haneveld\n\"\"\"\n\nfrom vtk import vtkImageReslice\n\n\nclass DataTransformer(object):\n\t\"\"\"D...
python
chosen
[ { "from": "system", "value": "Clean up the name and spacing in the VersionOne code.\n\nThe VersionOne code had some spacing and trailing whitespace problems,\nand also listed the service as \"versionone\" and not \"VersionOne\".\n" }, { "from": "human", "value": "from django import forms\nfrom d...
python
chosen
[ { "from": "system", "value": "Fix span decorator to work with asyncio\n" }, { "from": "human", "value": "from functools import wraps\nfrom sentry_sdk import Hub\n\n\ndef span(op, desc_or_func=None):\n def inner(func):\n @wraps(func)\n def wrapped(*args, **kwargs):\n i...
python
chosen
[ { "from": "system", "value": "Add get not equal default options\n" }, { "from": "human", "value": "from oslo_config import cfg\nfrom oslo_config import generator as gn\n\n__all__ = ['get_conf']\n\n\ndef get_conf(conf_file=None, config_file=None):\n conf_file = '/opt/stack/barbican/etc/oslo-co...
python
chosen
[ { "from": "system", "value": "Insert Upload function & save Google storage." }, { "from": "human", "value": "from flask import Flask\napp = Flask(__name__)\napp.config['DEBUG'] = True\n\n# Note: We don't need to call run() since our application is embedded within\n# the App Engine WSGI applicati...
python
chosen
[ { "from": "system", "value": "Fix typo in hoomd.update.__all__ quote class name\n" }, { "from": "human", "value": "from hoomd.update.box_resize import BoxResize\n\n\n# TODO remove when no longer necessary\nclass _updater:\n pass\n\n\n__all__ = [BoxResize]\n" }, { "from": "gpt", "v...
python
chosen
[ { "from": "system", "value": "Print out an array of points\n" }, { "from": "human", "value": "import re\nimport numpy as np\ninfile = \"shapes.txt\"\nfilt = re.compile(r'^\"?([^\"]*)\"?$')\nconverter = lambda x: filt.match(x.strip()).group(1)\ndata = np.recfromcsv(infile, delimiter=',')\nshapes ...
python
chosen
[ { "from": "system", "value": "Complete step 1 from problem Readme\n" }, { "from": "human", "value": "# File: say.py\n# Purpose: Write a program that will take a number from 0 to 999,999,999,999 and spell out that number in English.\n# Programmer: Amal Shehu\n# Course: Exercism\n...
python
chosen
[ { "from": "system", "value": "Remove a duplicate error class definition\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nimport sqlite3\n\n\nclass DatabaseError(sqlite3.DatabaseError):\n \"\"\"\n Exce...
python
chosen
[ { "from": "system", "value": "Drop configured annotator store uri\n" }, { "from": "human", "value": "from django.conf import settings\n\n__version_info__ = (1, 2, 0, 'dev')\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version...
python
chosen
[ { "from": "system", "value": "Move TODO items to GitHub issues\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport argparse\nimport yaml\nimport jinja2\nimport weasyprint\n\nparser = argparse.ArgumentParser()\nparser.add_argument('--data', help='path to data directory', required=...
python
chosen
[ { "from": "system", "value": "Fix defunct import of checksum module\n" }, { "from": "human", "value": "from checksum import file_sha1sum\n\n\nclass AnalysisFile(object):\n def __init__(self, filename):\n self.filename = filename\n\n def checksum(self):\n return file_sha1sum(s...
python
chosen
[ { "from": "system", "value": "Make generate_token the default token value\n" }, { "from": "human", "value": "import random\nimport re\n\nfrom django.contrib.auth.models import User\nfrom django.db import models\nfrom instances.models import InstanceMixin\n\n\nNUMBER_OF_TOKEN_WORDS = 3\n\ndef gen...
python
chosen
[ { "from": "system", "value": "Convert JSON to unicode before saving to clear up a SQLAlchemy warning.\n" }, { "from": "human", "value": "import Queue\nfrom elixir import Field, Unicode, Entity\n\nfrom astral.models.base import BaseEntityMixin\n\nimport logging\nlog = logging.getLogger(__name__)\...
python
chosen
[ { "from": "system", "value": "Remove hold over from copy n paste" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport unittest\nfrom PythonTemplate import Model\n\n\nclass TestModel(unittest.TestCase):\n def setUp(self, use_auth=False):\n # TODO\n pass\n\n def tes...
python
chosen
[ { "from": "system", "value": "Add some dummy routes in GuildsEndpoint\n" }, { "from": "human", "value": "'''\nguilds.py - All handlers under /guilds/*\n'''\n\nimport json\nimport logging\nfrom ..utils import _err, _json, strip_user_data\n\nlog = logging.getLogger(__name__)\n\nclass GuildsEndpoin...
python
chosen
[ { "from": "system", "value": "Move fields for new output\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport numpy as np\n\nfrom optparse import OptionParser\n\nparser = OptionParser()\n\nparser.add_option(\"-b\",\n \"--bedpe_file\",\n dest=\"bedpe_file\",\n hel...
python
chosen
[ { "from": "system", "value": "Fix logic related to GC of Event references using weakref.WeakValueDictionary.\n" }, { "from": "human", "value": "from threading import Lock, Event\n\n\nclass TransferEventManager(object):\n\n def __init__(self):\n self.events = dict()\n self.events...
python
chosen
[ { "from": "system", "value": "Change test case item, as the previous one had been updated and fixed.\n" }, { "from": "human", "value": "# http://www.openstreetmap.org/way/219071307\nassert_has_feature(\n 16, 10478, 25338, 'roads',\n { 'id': 219071307, 'kind': 'minor_road', 'service': 'driv...
python
chosen
[ { "from": "system", "value": "Add explicit setup for Django 1.7\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nfrom django.conf import settings\n\n\nif not settings.configured:\n settings.configure(\n DATABASES={\n 'default': {\n 'ENGI...
python
chosen
[ { "from": "system", "value": "Make ActivationClient look for correct return code\n" }, { "from": "human", "value": "#\n# Copyright (c) 2010 rPath, Inc.\n#\n# This program is distributed under the terms of the Common Public License,\n# version 1.0. A copy of this license should have been distribu...
python
chosen
[ { "from": "system", "value": "Change pkg version to 0.1.3\n" }, { "from": "human", "value": "try:\n # during the installation process this can raise an exception.\n from .data import SkData\nexcept:\n pass\n\n__author__ = 'Ivan Ogasawara'\n__email__ = 'ivan.ogasawara@gmail.com'\n__versi...
python
chosen
[ { "from": "system", "value": "Fix storage_access in the test config\n" }, { "from": "human", "value": "from parsl.config import Config\nfrom parsl.data_provider.scheme import GlobusScheme\nfrom parsl.executors.threads import ThreadPoolExecutor\nfrom parsl.tests.utils import get_rundir\n\n# If yo...
python
chosen
[ { "from": "system", "value": "Apply default cascade rules for firebird self-ref ForeignKeys.\n" }, { "from": "human", "value": "import testbase\nschema = None\n\n__all__ = 'Table', 'Column',\n\ntable_options = {}\n\ndef Table(*args, **kw):\n \"\"\"A schema.Table wrapper/hook for dialect-speci...
python
chosen
[ { "from": "system", "value": "Add ingredients to avoid as a TabularInline to Client\n\nDo not edit the ingredients to avoid directly, edit them through\na tabular form from the client form\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom member.models import (Member, Cli...
python
chosen
[ { "from": "system", "value": "Add a unit test for ignored nicks in _parse_irc_message\n" }, { "from": "human", "value": "import unittest\n\nfrom cobe.commands import LearnIrcLogCommand\n\nclass testIrcLogParsing(unittest.TestCase):\n def setUp(self):\n self.command = LearnIrcLogCommand...
python
chosen
[ { "from": "system", "value": "Rewrite Container to dump/load two Elements (data,_info) into json file\n" }, { "from": "human", "value": "from os import path\n\nfrom ffflash import RELEASE, log, now, timeout\nfrom ffflash.lib.clock import epoch_repr\nfrom ffflash.lib.data import merge_dicts\nfrom...
python
chosen
[ { "from": "system", "value": "Make cleanup command less verbose\n" }, { "from": "human", "value": "# coding=utf-8\nfrom django.core.management.base import BaseCommand\n\nfrom registration.models import RegistrationProfile\n\n\nclass Command(BaseCommand):\n help = 'Cleanup expired registration...
python
chosen
[ { "from": "system", "value": "Fix to work with new patch\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom glob import glob\nimport os\nimport re\n\ndef make_feedmes():\n # Used to convert all the fit*.galfit files to fit*.diff\n ids = glob('*/')\n for id in ids:\n ...
python
chosen
[ { "from": "system", "value": "Add command line arguments to main script.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport mm1\nimport sim\n\n\n### Params\n# Mean interarrival rate of customers per second;\n# hence, 0.05 <=> 3 people/minute\ninterarrival_rate ...
python
chosen
[ { "from": "system", "value": "Fix broken reference in documentation\n" }, { "from": "human", "value": "\"\"\"This module provides an abstract base class for invocation plugins\"\"\"\n\n\nfrom abc import abstractmethod, ABCMeta\n\n\nclass BasePlugin(object):\n \"\"\"\n Abstract base class f...
python
chosen
[ { "from": "system", "value": "Support environment variables for the extraction\n" }, { "from": "human", "value": "from subgraph_extractor.cli import extract_from_config\nimport click\nfrom cloudpathlib import AnyPath\n\n@click.command()\n@click.option(\n \"--subgraph-config-folder\",\n hel...
python
chosen
[ { "from": "system", "value": "Add definition of abstract harvester model\n" }, { "from": "human", "value": "class BaseProcessor(object):\n NAME = None\n\n def process_raw(self, raw_doc, **kwargs):\n pass # pragma: no cover\n\n def process_normalized(self, raw_doc, normalized, **...
python
chosen
[ { "from": "system", "value": "Make search parameter match template parameter name" }, { "from": "human", "value": "from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator\nfrom django.shortcuts import render\n\nfrom wagtail.core.models import Page\nfrom wagtail.search.models imp...
python
chosen
[ { "from": "system", "value": "Make anonymous user distinguishable from Django's AnonymousUser\n\nDjango uses a special object---the AnonymousUser---for requests that are not\nbound to a logged in user. Since we use guardian we replace this object with an\nactual user object (with the ID set in ANONYMOUS_USE...
python
chosen
[ { "from": "system", "value": "Add test that check hash values of rule\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 15.08.2017 15:31\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import *\nfro...
python
chosen
[ { "from": "system", "value": "Fix tests on Python 2\n" }, { "from": "human", "value": "# -*- coding: utf-8; -*-\n\nimport re\n\nfrom jenkins_autojobs import main\n\n\ndef test_filter_jobs():\n class Job:\n def __init__(self, name):\n self.name = name\n\n class jenkins:\n ...
python
chosen
[ { "from": "system", "value": "Add message to webpage repo trigger\n\nShould fix triggering builds on the webpage repo even when the most\nrecent commit message skip the CI build. Also should make it easier to\nidentify builds started by this trigger.\n\n[ci skip]\n[skip ci]\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Add test for Cramer with different spatial sizes\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\n\n'''\nTest functions for Cramer\n'''\n\nfrom unittest import TestCase\n\nimport numpy as np\nimport numpy.testing as npt...
python
chosen
[ { "from": "system", "value": "Fix best four point cli\n" }, { "from": "human", "value": "import twstock\n\n\ndef main(argv):\n print('四大買賣點判斷 Best Four Point')\n print('------------------------------')\n if len(argv) > 1:\n sids = argv[1:]\n for sid in sids:\n b...
python
chosen
[ { "from": "system", "value": "Stop Click from aborting due to misconfigured locale\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import division, print_function\nimport click\n\nCONTEXT_SETTINGS = {\n 'help_option_names': ['-h', '--help'],\n}\n\n@click.group(cont...
python
chosen
[ { "from": "system", "value": "Implement the type specific values output\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nimport argparse\nimport client_wrap\n\ndef parse_args():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"-t\", \"--type\", help=\"typ...
python
chosen
[ { "from": "system", "value": "Allow user to input \"0\" as value" }, { "from": "human", "value": "import sys\nimport os\nfrom workflow import Workflow\n\n\ndef main(wf):\n user_input = wf.args[0]\n if user_input != '':\n try:\n if int(user_input) <= 100 and int(user_input...
python
chosen
[ { "from": "system", "value": "Change includeNeighborhood default value to 0\n" }, { "from": "human", "value": "from .location_schema import Location\nfrom marshmallow import Schema, fields, post_dump\nfrom .location_api_url import LocationUrl\n\n\nclass LocationByPointQueryString(Schema):\n p...
python
chosen
[ { "from": "system", "value": "ENH: Fix directory in hash funcs.\n" }, { "from": "human", "value": "\"\"\"\nA collection of utilities to see if new ReST files need to be automatically\ngenerated from certain files in the project (examples, datasets).\n\"\"\"\n\ndef get_hash(f):\n \"\"\"\n G...
python
chosen
[ { "from": "system", "value": "Increase lambda-k space to better differentiate bottlenecks from startup cost.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Sep 23 15:23:58 2015\n\n@author: jensv\n\"\"\"\n\nimport skin_core_scanner_simple as scss\nreload(scss)\...
python
chosen
[ { "from": "system", "value": "Update test file - add flag for reports\n" }, { "from": "human", "value": "import pytest\nfrom bs4 import BeautifulSoup as BS\n\npytest.main(['--durations', '10', '--cov-report', 'html'])\nurl = r'htmlcov/index.html'\npage = open(url)\nsoup = BS(page.read(), feature...
python
chosen
[ { "from": "system", "value": "Add fix_ordering method to OrderedModelManager\n" }, { "from": "human", "value": "from django.db import models\nfrom django.core.exceptions import ValidationError\n\n\nclass OrderedModelManager(models.Manager):\n def swap(self, obj1, obj2):\n tmp, obj2.ord...
python
chosen
[ { "from": "system", "value": "Change to new version number\n" }, { "from": "human", "value": "#\n# Konstrukteur - Static website generator\n# Copyright 2013 Sebastian Fastner\n#\n\n\"\"\"\n**Konstrukteur - Static website generator**\n\nKonstrukteur is a website generator that uses a template and...
python
chosen
[ { "from": "system", "value": "Test run speedup by changing password hasher\n" }, { "from": "human", "value": "from familyconnect_registration.settings import * # flake8: noqa\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = 'TESTSEKRET'\n\n# SECURITY WARNING: ...
python
chosen
[ { "from": "system", "value": "Use a different way of ensuring 3.3+.\n" }, { "from": "human", "value": "import os\nimport sys\nimport marshal\n\n\nif sys.hexversion < 0x03030000:\n raise ImportError('python >= 3.3 required')\n\nif sys.implementation.cache_tag is None:\n raise ImportError('p...
python
chosen
[ { "from": "system", "value": "Stop experimenting on this project for the moment" }, { "from": "human", "value": "'''\r\nCreated on Jan 15, 2017\r\n\r\n@author: Marlon_2\r\n'''\r\nimport tkinter as tk # import\r\nfrom tkinter import ttk # impork ttk from tkinter\r\n\r\nwin = tk.Tk(); # cr...
python
chosen
[ { "from": "system", "value": "Add per-word replace probability, max outputs.\n" }, { "from": "human", "value": "import piglatin\n\nfrom interfaces.SentenceOperation import SentenceOperation\nfrom tasks.TaskTypes import TaskType\n\nclass PigLatin(SentenceOperation):\n tasks = [\n TaskTy...
python
chosen
[ { "from": "system", "value": "Create UserManager to ensure ForeignKey relation is saved and associated with User upon creation\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Import chosenforms for pretty search forms\nfrom chosen import forms as chosenforms\n# Import the AbstractU...
python
chosen
[ { "from": "system", "value": "Update factory registers with stages.\n" }, { "from": "human", "value": "from kivy.factory import Factory\n\nr = Factory.register\nr('MoaStage', module='moa.stage.base')\nr('StageRender', module='moa.stage.base')\nr('Delay', module='moa.stage.delay')\nr('TreeRender'...
python
chosen
[ { "from": "system", "value": "Add MIT LICENSE. Fix test dir removing issue - re-raise exception after delete this dir.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom passwd_change import passwd_change, shadow_change, mails_delete\n\nfrom unittest import TestCase, TestLoader, T...
python
chosen
[ { "from": "system", "value": "Fix newline output of downloaded srt\n" }, { "from": "human", "value": "from termcolor import colored\n\nfrom .parser import Addic7edParser\nfrom .file_crawler import FileCrawler\nfrom .logger import init_logger\nfrom .config import Config\n\n\ndef addic7ed():\n ...
python
chosen
[ { "from": "system", "value": "Choose QubesLocal or QubesRemote based on /etc/qubes-release presence\n\nDo not check for qubesd socket (at module import time), because if not\nrunning at this precise time, it will lead to wrong choice. And a weird\nerror message in consequence (looking for qrexec-client-vm i...
python
chosen
[ { "from": "system", "value": "Add intelligent skip for missing secret info\n" }, { "from": "human", "value": "import unittest\nimport object_storage_tensorflow as obj_tf\n\n\nclass TestStringMethods(unittest.TestCase):\n\n def test_upper(self):\n self.assertEqual('foo'.upper(), 'FOO')\...
python
chosen
[ { "from": "system", "value": "[Utils] Allow colons in filenames for now\n" }, { "from": "human", "value": "# coding=utf-8\nimport string\nfrom numbers import Number\n\n__author__ = 'Gareth Coles'\n\nFILENAME_SAFE_CHARS = (\n \"/\\\\-_.()#\" +\n string.digits +\n string.letters +\n st...
python
chosen
[ { "from": "system", "value": "Set package URL to where it'll be uploaded.\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nimport os\nimport setuptools\nimport sys\n\n# FIXME explain why this is here\nsys.path.insert(0,\n os.path.join(\n os.path.dirname(__file__),\n \"li...
python
chosen
[ { "from": "system", "value": "Support Django < 1.5 with a simplified version of `get_url()`\n" }, { "from": "human", "value": "from django.core.management import call_command\nfrom django.shortcuts import resolve_url\n\nfrom behave_django.testcase import BehaveDjangoTestCase\n\n\ndef before_scen...
python
chosen
[ { "from": "system", "value": "Use `make_admin_app`, document why `admin_app` is still needed\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\nAPI-specific fixtures\n\"\"\"\n\nimport pytest\n\nfrom tests.bas...
python
chosen
[ { "from": "system", "value": "Fix Snippet failing test, ``image`` field is blank.\n" }, { "from": "human", "value": "from nose.tools import eq_, ok_\n\nfrom django.test import TestCase\n\nfrom us_ignite.snippets.models import Snippet\n\n\nclass TestSnippetModel(TestCase):\n\n def tearDown(sel...
python
chosen
[ { "from": "system", "value": "core: Change autotuning 'none' to 'off'\n" }, { "from": "human", "value": "\"\"\"\nThe ``core`` Devito backend is simply a \"shadow\" of the ``base`` backend,\ncommon to all other backends. The ``core`` backend (and therefore the ``base``\nbackend as well) are used ...
python
chosen
[ { "from": "system", "value": "[util] Test file for Graph code\n" }, { "from": "human", "value": "import urllib2\n\ntoken = 'test_token'\nchannel = 'test_channel'\ngraphtype = 'test'\n\nurl = 'http://{}/ocpgraph/{}/{}/{}/'.format('localhost:8000', token, channel, graphtype)\ntry:\n req = urllib2...
python
chosen
[ { "from": "system", "value": "Set global logging level to DEBUG\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\"\"\"Launch the flask-forecaster application.\"\"\"\n\nimport logging\nimport sys\n\n\nlogging.basicConfig(\n datefmt='%Y/%m/%d %H.%M.%S',\n format='%(levelname)s:%(...
python
chosen
[ { "from": "system", "value": "Fix small test problem\\nBTW rotation works now, thanks @BookOwl\n" }, { "from": "human", "value": "import slither, pygame\n\nsnakey = slither.Sprite()\nsnakey.setCostumeByName(\"costume0\")\n\nsnakey.goto(0, 0)\n\nslither.slitherStage.setColor(40, 222, 40)\n\nslith...
python
chosen
[ { "from": "system", "value": "Add extra description to partial match playsong test\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding=utf-8\n\nfrom __future__ import print_function, unicode_literals\n\nimport nose.tools as nose\n\nfrom tests.utils import run_filter\n\n\ndef test_...
python
chosen
[ { "from": "system", "value": "Add site.cfg to datafiles installed for numpy.distutils.\n\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2011 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom numpy.distutils.core import setup\nfrom n...
python
chosen
[ { "from": "system", "value": "Verify no header appears twice when translating 93125.2" }, { "from": "human", "value": "from Bio import SeqIO\nimport logging\nimport unittest\n\nfrom select_taxa import select_genomes_by_ids\nimport translate\n\n\nclass Test(unittest.TestCase):\n\n def setUp(se...
python
chosen
[ { "from": "system", "value": "Adjust POST_LOGIN_VIEW and POST_LOGOUT_VIEW test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n test_configuration\n ~~~~~~~~~~~~~~~~~~\n\n Basic configuration tests\n\"\"\"\n\nimport base64\n\nimport pytest\n\nfrom utils import authen...
python
chosen
[ { "from": "system", "value": "Add support for django 2 to example project\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.core.urlresolvers import reverse\nfrom django.db import models\nimport generic_scaffold\n\nclass Book(models.Model):\n title = mo...
python
chosen
[ { "from": "system", "value": "Change default channel to send_messages\n" }, { "from": "human", "value": "def reverse_insort(seq, val, lo=0, hi=None):\n if hi is None:\n hi = len(seq)\n while lo < hi:\n mid = (lo + hi) // 2\n if val > seq[mid]:\n hi = mid\n ...
python
chosen
[ { "from": "system", "value": "Make package more robust against PySide import errors.\n\nA bad PySide install may lead to exceptions other than\nImportErrors on import. In this case any attempt to\nimport the package will fail, even when the GUI is\nnot even used.\n\nAny error occuring during the attempted i...
python
chosen