conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Replace coverage API calls by subprocess calls." }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Script to collect coverage information on ofStateManager\"\"\"\n\nimport os\nimport sys\nimport inspect\nimport coverage\nimport subprocess\n\n\ndef main():...
python
chosen
[ { "from": "system", "value": "Add basic test for fastq file checker\n" }, { "from": "human", "value": "import pytest\n\n# TODO: Implement real tests!\n#\n# Right now this is just here as a stub so that we at least have some\n# test for Travis to go through. We want complete test coverage,\n# eve...
python
chosen
[ { "from": "system", "value": "Fix test suite for Django 1.11\n" }, { "from": "human", "value": "from django.urls import path\n\nfrom . import views\n\nurlpatterns = [\n path('', views.ExampleFormView.as_view(), name='upload'),\n]\n" }, { "from": "gpt", "value": "try:\n from dja...
python
chosen
[ { "from": "system", "value": "Set port by environment variable\n" }, { "from": "human", "value": "import recommender\nfrom flask import Flask, render_template, request\napp = Flask(__name__)\n\n@app.route('/')\ndef index():\n return render_template('template.html')\n\n@app.route('/graph')\nde...
python
chosen
[ { "from": "system", "value": "[Feature] Add BucketListApi resource to api.\n" }, { "from": "human", "value": "\"\"\"This module runs the api server.\"\"\"\nimport os\nfrom app import flask_app, db\nfrom app.models import User, BucketList, BucketListItem\nfrom flask.ext.script import Manager, She...
python
chosen
[ { "from": "system", "value": "user_voting: Add date field for timestamps\n" }, { "from": "human", "value": "from django.contrib.contenttypes import generic\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.auth.models import User\nfrom django.db import models\n\nfr...
python
chosen
[ { "from": "system", "value": "Change tuples to lists where applicable\n" }, { "from": "human", "value": "from cms.admin import SearchMetaBaseAdmin\nfrom django.contrib import admin\n\nfrom .models import Career\n\n\n@admin.register(Career)\nclass CareerAdmin(SearchMetaBaseAdmin):\n prepopulat...
python
chosen
[ { "from": "system", "value": "Make Eidos reader instantiate when first reading\n" }, { "from": "human", "value": "from indra.java_vm import autoclass, JavaException\nfrom .scala_utils import get_python_json\n\nclass EidosReader(object):\n \"\"\"Reader object keeping an instance of the Eidos r...
python
chosen
[ { "from": "system", "value": "Allow dumpdata of specific version of cbv.\n" }, { "from": "human", "value": "from django.core.management import call_command\nfrom django.core.management.commands import LabelCommand\n\n\nclass Command(LabelCommand):\n def handle_label(self, label, **options):\n...
python
chosen
[ { "from": "system", "value": "Set DYLD_LIBRARY_PATH to find locally built dynamic libraries.\n" }, { "from": "human", "value": "#!/bin/sh\n\nPYTHONPATH=\"%builddir%\":\"%srcdir%\":$PYTHONPATH \\\n python \"%srcdir%\"/tests/python/UnitTests.py\n" }, { "from": "gpt", "value": "#!/bi...
python
chosen
[ { "from": "system", "value": "Adjust test_person_made_works to keep consistency.\n" }, { "from": "human", "value": "\n\ndef test_team_has_members(fx_people, fx_teams):\n assert fx_teams.clamp.members == {\n fx_people.clamp_member_1,\n fx_people.clamp_member_2,\n fx_people...
python
chosen
[ { "from": "system", "value": "Include URL of request in error reports\n" }, { "from": "human", "value": "import bugsnag\nfrom sanic.handlers import ErrorHandler\n\nfrom . import settings\n\nif settings.BUGSNAG_API_KEY:\n bugsnag.configure(\n api_key=settings.BUGSNAG_API_KEY,\n p...
python
chosen
[ { "from": "system", "value": "Fix for when msmb_data is not available\n" }, { "from": "human", "value": "\"\"\"Base IO code for all datasets\n\"\"\"\n\n# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>\n# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>\n# 2010 Olivier Grisel <olivier....
python
chosen
[ { "from": "system", "value": "Switch to regexp based matching of date instead of dateutil\n" }, { "from": "human", "value": "from dateutil.parser import parse\n\nfrom comics.aggregator.crawler import CrawlerBase, CrawlerResult\nfrom comics.meta.base import MetaBase\n\nclass Meta(MetaBase):\n ...
python
chosen
[ { "from": "system", "value": "Use fnmatch patterns instead of regexes for URL patterns\n\nfnmatch patterns have enough flexibility for this use case and this avoids the\nneed to remember to escape periods, which is easy to forget otherwise. The\nresulting patterns are also easier to read.\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Remove unnecessary code and libraries\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\nimport time\nimport sys\nfrom tweepy.streaming import StreamListener\nfrom tweepy import OAuthHandler\nfrom tweepy import Stream\nimport tweepy\nimport json\n\n#Get Hash...
python
chosen
[ { "from": "system", "value": "Add missing `comm` argument to LocalArray constructor.\n\nSegfaults otherwise..." }, { "from": "human", "value": "import tempfile\nfrom numpy.testing import assert_allclose\nfrom os import path\nfrom distarray.local import LocalArray, save, load\nfrom distarray.test...
python
chosen
[ { "from": "system", "value": "ENH: Add Choose node to imported nodes\n" }, { "from": "human", "value": "################################################################################\n# Copyright (C) 2011-2012 Jaakko Luttinen\n#\n# This file is licensed under the MIT License.\n################...
python
chosen
[ { "from": "system", "value": "Deal with the case of large radii for optically thin temperature radius\n" }, { "from": "human", "value": "class OptThinRadius(object):\n\n def __init__(self, temperature, value=1.):\n self.temperature = temperature\n self.value = value\n\n def _...
python
chosen
[ { "from": "system", "value": "Increase HTTP timeout to 60 seconds\n" }, { "from": "human", "value": "import logging\nimport requests\nimport time\nfrom cattle import type_manager\nfrom cattle.utils import log_request\n\n\nlog = logging.getLogger(\"agent\")\n\n\nclass Publisher:\n def __init__...
python
chosen
[ { "from": "system", "value": "Add UniqueConstraint for IndexFile SQL model\n" }, { "from": "human", "value": "from sqlalchemy import Column, Enum, Integer, String\n\nfrom virtool.pg.utils import Base, SQLEnum\n\n\nclass IndexType(str, SQLEnum):\n \"\"\"\n Enumerated type for index file typ...
python
chosen
[ { "from": "system", "value": "Add category filtering on the server side to save client fetching.\n" }, { "from": "human", "value": "# Paths to key files\nFIREBASE_KEY_PATH=\"firebase.local.json\"\n\n# Firebase config for prox-server\n# These are public-facing and can be found in the console unde...
python
chosen
[ { "from": "system", "value": "Use \"sublime-session\" as file extension\n\nFurthermore fix some bugs in serialize.py\n" }, { "from": "human", "value": "import sublime\n\nimport json\nimport os\n\nfrom ..json import encoder\nfrom ..json import decoder\n\nfrom . import settings\n\n_DEFAULT_PATH = ...
python
chosen
[ { "from": "system", "value": "Add functionality to delete all templates\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport os\nfrom lib.functional import multi_map\n\nfrom engine import types, consts\n\ntemplate_dir = os.path.join(os.environ['PORTER'], 'templates')\n...
python
chosen
[ { "from": "system", "value": "Add retries to cppn param test\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nimport pytest\n\nimport numpy as np\nimport tensorflow as tf\n\nimport logging\n\nfrom lucid.optvis.param.cppn import cppn\n\n\nlog ...
python
chosen
[ { "from": "system", "value": "Add useful modules/pckg from the standard library\n" }, { "from": "human", "value": "import cPickle as pickle\nimport os\nimport sys\n\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport scipy as sp\nimport sci...
python
chosen
[ { "from": "system", "value": "Update to use the static Brain.init()\n" }, { "from": "human", "value": "import logging\nimport os\n\nimport brain\n\nfrom cmdparse import Command\n\nlog = logging.getLogger(\"hal\")\n\nclass InitCommand(Command):\n def __init__(self):\n Command.__init__(s...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.11-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=10\nbranch=\"master\"\ntimestamp=1376502388.26" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=11\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Fix database connectivity on Linux.\n" }, { "from": "human", "value": "import psycopg2\n\nc = psycopg2.connect(user='postgres', password='password')\nc.set_session(autocommit=True)\ncur = c.cursor()\ntry:\n cur.execute('CREATE DATABASE pycah;')\n c.commit()\n c.c...
python
chosen
[ { "from": "system", "value": "Fix up the deprecate surfs object\n" }, { "from": "human", "value": "from .dataset import Dataset, VolumeData, VertexData, DataView, View\nfrom . import align, volume, quickflat, webgl, segment, options\nfrom .database import db\nfrom .utils import *\nfrom .quickfla...
python
chosen
[ { "from": "system", "value": "Add is_permutation function. Simplifiy unique function.\n" }, { "from": "human", "value": "def unique(string):\n counter = {}\n for c in string:\n if c in counter:\n counter[c] += 1\n else:\n counter[c] = 1\n print(count...
python
chosen
[ { "from": "system", "value": "Use a choices for specifiying type of reporter\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport sys\nimport argparse\n\nfrom mamba import application_factory, __version__\nfrom mamba.infrastructure import is_python3\n\n\ndef main():\n argument...
python
chosen
[ { "from": "system", "value": "Add Hypervisor base class for workstation and virtualbox\n" }, { "from": "human", "value": "# coding=UTF-8\n" }, { "from": "gpt", "value": "# coding=UTF-8\n\n\nclass GuestInfo:\n OS_WINDOWS = \"windows\"\n OS_LINUX = \"linux\"\n def __init__(sel...
python
chosen
[ { "from": "system", "value": "Add staticmethod annotation + docstrings to module, class, and all public methods\n" }, { "from": "human", "value": "import requests\nimport os\n\n\nclass Api:\n\n _API_ENDPOINT = 'api/v1'\n\n def __init__(self, url, token=None):\n self.url = Api.add_sl...
python
chosen
[ { "from": "system", "value": "Fix the description of DecompilationPhase.__init__().\n" }, { "from": "human", "value": "#\n# Project: retdec-python\n# Copyright: (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors\n# License: MIT, see the LICENSE file for more details\n#\n\n\"\"\"Phase...
python
chosen
[ { "from": "system", "value": "Add prefix to required environment variables.\n" }, { "from": "human", "value": "from os import environ\n\nDEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)\nENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)\nDECODING_COMMAND = environ.get('DEC...
python
chosen
[ { "from": "system", "value": "Remove clearing of exception context when raising a new exception\n\nThis syntax is only supported in Python 3.3 and up and is causing tests in\nPython 2.7 to fail.\n" }, { "from": "human", "value": "from pkg_resources import DistributionNotFound, get_distribution, ...
python
chosen
[ { "from": "system", "value": "Check the version of any of the supported Psycopg2 packages\n\nA check was introduced in commit 8e0c4857a1c08f257b95d3b1ee5f6eb795d55cdc which\nwould check what version of the 'psycopg2' Python (pip) package was installed\nas the dependency was removed from setup.py.\n\nThe che...
python
chosen
[ { "from": "system", "value": "Fix failing tests on setup.py test\n" }, { "from": "human", "value": "from plasmapy.classes import BasePlasma, GenericPlasma\n\n\nclass NoDataSource(BasePlasma):\n pass\n\nclass IsDataSource(BasePlasma):\n @classmethod\n def is_datasource_for(cls, **kwargs)...
python
chosen
[ { "from": "system", "value": "Add geometry_application_reference to new unique index.\n" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 1815829d365\nRevises: 3fcddd64a72\nCreate Date: 2016-02-09 17:58:47.362133\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision ...
python
chosen
[ { "from": "system", "value": "Use JSON to parse hlint output\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Hardy Jones\n# Copyright (c) 2013\n#\n# License: MIT\n#\n\n\"\"\"This module exports the Hlin...
python
chosen
[ { "from": "system", "value": "Fix preview still being slightly different.\n" }, { "from": "human", "value": "from django.views.decorators.csrf import csrf_exempt\nfrom django.views.generic import View\nfrom django.utils.decorators import method_decorator\nfrom django.shortcuts import render\n\n\...
python
chosen
[ { "from": "system", "value": "Add execute_anybodycon to toplevel package\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"AnyPyTools library.\"\"\"\n\nimport sys\nimport platform\nimport logging\n\nfrom anypytools.abcutils import AnyPyProcess\nfrom anypytools.macroutils import A...
python
chosen
[ { "from": "system", "value": "Add support to search for word in search api\n" }, { "from": "human", "value": "from flask import Blueprint, jsonify, request\nfrom importlib import import_module\nimport re\n\n\nblueprint = Blueprint('search_api', __name__, url_prefix='/search')\n\n@blueprint.route...
python
chosen
[ { "from": "system", "value": "Add simple tags for title and description\n" }, { "from": "human", "value": "from django.template import Library\n\nfrom simpleseo import settings\nfrom simpleseo.models import SeoMetadata\n\nregister = Library()\n\n\n@register.filter\ndef single_quotes(description)...
python
chosen
[ { "from": "system", "value": "Remove extra arguments from decorated function\n" }, { "from": "human", "value": "\"\"\"Decorators.\n\n\"\"\"\n\nfrom functools import wraps\n\nfrom astropy import units as u\n\nfrom poliastro.bodies import Body\nfrom poliastro.twobody.rv import RVState\n\nu.kms = u...
python
chosen
[ { "from": "system", "value": "Remove broken leading and trailing characters.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport base64\nimport rsa\nimport six\n\nfrom st2common.runners.base_action import Action\n\n\nclass AwsDecryptPassworData(Action):\n\n def run(self, keyfil...
python
chosen
[ { "from": "system", "value": "Fix encoding detection in python (shebang line was not parsed anymore)\n" }, { "from": "human", "value": "\"\"\"\nContains the python specific FileManager.\n\"\"\"\nimport ast\nimport re\nfrom pyqode.core.managers import FileManager\n\n\nclass PyFileManager(FileMana...
python
chosen
[ { "from": "system", "value": "Update log location to reflect ubuntu" }, { "from": "human", "value": "# Location of Apache Error Log\nlog_location_linux = '/var/log/httpd/error_log'\nlog_location_windows = 'C:\\Apache24\\logs\\error.log'\n\n# Regular expression to filter for timestamp in Apache E...
python
chosen
[ { "from": "system", "value": "Update test settings for Django >= 1.8.\n" }, { "from": "human", "value": "# Only used for running the tests\n\nimport os\n\nCONTACT_EMAILS = ['charlie@example.com']\n\nDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}\n\nINSTALLED_APPS = ['contact',...
python
chosen
[ { "from": "system", "value": "Check filterform validity before calling filter()\n" }, { "from": "human", "value": "from django.views.generic.list import MultipleObjectMixin\n\n__all__ = ('FilterFormMixin',)\n\n\nclass FilterFormMixin(MultipleObjectMixin):\n \"\"\"\n Mixin that adds filteri...
python
chosen
[ { "from": "system", "value": "Remove spaces around '=' for default param\n" }, { "from": "human", "value": "class Garden:\n\n DEFAULT_STUDENTS = (\"Alice Bob Charlie David Eve Fred Ginny \"\n \"Harriet Ileana Joseph Kincaid Larry\").split()\n\n PLANTS = {'G': 'Grass'...
python
chosen
[ { "from": "system", "value": "Use SlugRelatedField for foreign keys for better readability\n" }, { "from": "human", "value": "import uuid\nimport jsonschema\n\nfrom rest_framework import serializers\n\nfrom .models import (\n Api,\n Consumer,\n ConsumerKey,\n Plugin,\n)\nfrom .schema...
python
chosen
[ { "from": "system", "value": "Switch import from ugettext to gettext\n" }, { "from": "human", "value": "from django.core.paginator import InvalidPage, Paginator\nfrom django.http import Http404\nfrom django.utils.translation import ugettext as _\nfrom haystack.forms import FacetedSearchForm\nfro...
python
chosen
[ { "from": "system", "value": "Fix test failures in Python 3.3b2\n\nThe fromlist argument of __import__ was being called as [''], which is\nmeaningless. Because we need fromlist to be non-empty to get the submodule\nreturned, this was changed to ['*'].\n" }, { "from": "human", "value": "\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Make api accessible from python package\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntapioca_toggl\n-------------\n\nPython wrapper for Toggl API v8\n\"\"\"\n\n__version__ = '0.1.0'\n" }, { "from": "gpt", "value": "# -*- coding: ...
python
chosen
[ { "from": "system", "value": "Check status code before object\n" }, { "from": "human", "value": "import requests\nfrom requests.exceptions import RequestException\n\nfrom py_nist_beacon.nist_randomness_beacon_value import (\n NistRandomnessBeaconValue\n)\n\n\nclass NistRandomnessBeacon(object...
python
chosen
[ { "from": "system", "value": "Raise exceptions rather than catching\n" }, { "from": "human", "value": "import pandas\nimport traceback\nimport typing\n\n\ndef process_files(file_iterator: typing.Iterator[typing.IO], processor: typing.Callable) -> pandas.DataFrame:\n\n def get_frames():\n ...
python
chosen
[ { "from": "system", "value": "Fix ListProperties to be compatible with buildbot 0.8.4p1.\n\nThe duplicated code will be removed once 0.7.12 is removed.\n\nReview URL: http://codereview.chromium.org/7193037\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@91477 0039d316-1c4b-4281-b951-d872f2087c98\n" ...
python
chosen
[ { "from": "system", "value": "Use official URL for collector\n" }, { "from": "human", "value": "import simplejson as json\nimport zmq\nimport sys\nimport base64\nimport zlib\nfrom jsonsig import *\n\nfieldnames = \"buyPrice,sellPrice,demand,demandLevel,stationStock,stationStockLevel,categoryName...
python
chosen
[ { "from": "system", "value": "Update representative importance, remove Reinhold Mitterlehner\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nPROJECT_NAME = \"Stoppt das Überwachungspaket!\"\n\nIMPORTANT_REPS = [\"05375\", \"02819\", \"51570\", \"02941\", \"08696\", \"35504\"]\n" },...
python
chosen
[ { "from": "system", "value": "Change class definitions from old style to new style\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\n...
python
chosen
[ { "from": "system", "value": "Normalize imports in regression test\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom spacy.tokens import Doc\nfrom spacy.vocab import Vocab\nfrom spacy.matcher import Matcher\nfrom spacy.lang.lex_attrs import LEX_ATTRS\n\n\ndef tes...
python
chosen
[ { "from": "system", "value": "Allow back None as identifier\n" }, { "from": "human", "value": "from tornadowebapi.traitlets import HasTraits\n\n\nclass Resource(HasTraits):\n \"\"\"A model representing a resource in our system.\n Must be reimplemented for the specific resource in our domai...
python
chosen
[ { "from": "system", "value": "Test getting elements with different family names.\n" }, { "from": "human", "value": "import rml.lattice\nimport rml.element\n\n\nDUMMY_NAME = 'dummy'\n\n\ndef test_create_lattice():\n l = rml.lattice.Lattice(DUMMY_NAME)\n assert(len(l)) == 0\n assert l.nam...
python
chosen
[ { "from": "system", "value": "Add debian endpoint as comment to file.\n" }, { "from": "human", "value": "# This file is part of fedmsg.\n# Copyright (C) 2012 Red Hat, Inc.\n#\n# fedmsg is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\...
python
chosen
[ { "from": "system", "value": "Fix and add ddsc-site urls.\n" }, { "from": "human", "value": "# (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.\nfrom __future__ import print_function, unicode_literals\nfrom __future__ import absolute_import, division\n\nfrom rest_framework.reverse import ...
python
chosen
[ { "from": "system", "value": "Allow file paths to be given to set_log_target.\n" }, { "from": "human", "value": "\"\"\"\n.. module:: dbsync.logs\n :synopsis: Logging facilities for the library.\n\"\"\"\n\nimport logging\n\n\n#: All the library loggers\nloggers = set()\n\n\nlog_handler = None\n...
python
chosen
[ { "from": "system", "value": "fix: Add linked bank accounts to supplier dashboard\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom frappe import _\n\n\ndef get_data():\n\treturn {\n\t\t'heatmap': True,\n\t\t'heatmap_message': _('This is based on transactions aga...
python
chosen
[ { "from": "system", "value": "Update facebook.cli example to use short syntax\n" }, { "from": "human", "value": "from rauth.service import OAuth2Service\nimport re\nimport webbrowser\n\n# Get a real consumer key & secret from:\n# https://developers.facebook.com/apps\n\nfacebook = OAuth2Service(\...
python
chosen
[ { "from": "system", "value": "Test post_save of AccessToken as step 1 in writing a fhir consent directive.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# vim: ai ts=4 sts=4 et sw=4\n\n\"\"\"\ndjango-fhir\nFILE: __init__.py\nCreated: 1/6/16 5:07 PM\n\n\n\"\"\...
python
chosen
[ { "from": "system", "value": "Allow overridable message formatting in the RSS bot.\n" }, { "from": "human", "value": "\ntry:\n from feedparser import parse\nexcept ImportError:\n parse = None\n\nfrom gnotty.bots import events\n\n\nclass RSSMixin(object):\n \"\"\"\n Mixin for bots tha...
python
chosen
[ { "from": "human", "value": "Add create action for os-scheduler-partner\n" }, { "from": "gpt", "value": "\"\"\"\nScheduler Partner interface (v2 extension).\n\"\"\"\nfrom novaclient import base\nfrom novaclient.openstack.common.gettextutils import _\nfrom novaclient import utils\n\nclass Schedul...
python
chosen
[ { "from": "system", "value": "Add minimum fragment length filtering.\n" }, { "from": "human", "value": "import sys\nimport os\nimport argparse\nimport fileinput\nimport subprocess\n\nparser = argparse.ArgumentParser(description = \"Convert BEDPE into a BED file of fragments.\", formatter_class =...
python
chosen
[ { "from": "system", "value": "Fix templating in _another_ debug statement\n" }, { "from": "human", "value": "import logging\n\nclass Response(object):\n \"\"\"The object sent back to the callback\n Contains methods for calling senders and responders on Espresso\n \"\"\"\n def __init_...
python
chosen
[ { "from": "system", "value": "Use spaces instead of tabs\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#keys.py\n\nkeys = dict(\n\tconsumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\tconsumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\taccess_key = 'xxxxxxxxxxxxxxxxxxxx...
python
chosen
[ { "from": "system", "value": "Refactor treenexus logic into a function\n" }, { "from": "human", "value": "def index():\n def GET():\n return locals()\n\n@request.restful()\ndef api():\n response.view = 'generic.json'\n def GET(resource,resource_id):\n if not resource=='stu...
python
chosen
[ { "from": "system", "value": "Fix imports style and made feed_name optional\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.core.management import CommandError, BaseCommand\n\nfrom saleor.integrations.feeds import SaleorFeed\nfrom saleor.integrations imp...
python
chosen
[ { "from": "system", "value": "Refactor cleanup command to use settings.py\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nfrom crashmanager.models import CrashEntry, Bucket, Bug\nfrom django.db.models.aggregates import Count\nfrom datetime import datetim...
python
chosen
[ { "from": "system", "value": "Make py_version and assertion more readable\n" }, { "from": "human", "value": "\"\"\"Tests for correctly generated, working setup.\"\"\"\nfrom os import system\nfrom sys import version_info\n\nfrom . import pytest_generate_tests # noqa, pylint: disable=unused-impor...
python
chosen
[ { "from": "system", "value": "Add full context to the create_referral tag" }, { "from": "human", "value": "from django import template\n\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom anafero.models import ReferralResponse, ACTION_DISPLAY\n\n\nregister = template.Library()\n...
python
chosen
[ { "from": "system", "value": "Test coverage for the discrete derivative class\n" }, { "from": "human", "value": "import unittest\nfrom TSatPy import discrete\n\nclass TestDerivative(unittest.TestCase):\n\n def test_derivative(self):\n\n print 'aoue'\n d = discrete.Derivative()\n...
python
chosen
[ { "from": "system", "value": "Fix joining of capnp import paths\n" }, { "from": "human", "value": "\"\"\"Helpers for writing rules that depends on //py/g1/third-party/capnp.\"\"\"\n\n__all__ = [\n 'make_global_options',\n]\n\n\ndef make_global_options(ps):\n return [\n 'compile_sche...
python
chosen
[ { "from": "system", "value": "Add emoji shortcuts to Context\n" }, { "from": "human", "value": "__all__ = ['Context']\n\nfrom lifesaver import bot\n\n\nclass Context(bot.Context):\n @property\n def pool(self):\n return self.bot.pool\n" }, { "from": "gpt", "value": "__all...
python
chosen
[ { "from": "system", "value": "Change org-name to what is now lowercase\n" }, { "from": "human", "value": "#!/bin/env python\n\n\"\"\"\nFork github repos\n\"\"\"\n\n# technical debt:\n# --------------\n\n\nfrom github3 import login\nfrom getpass import getuser\nimport os\nimport sys\nimport time\...
python
chosen
[ { "from": "system", "value": "Change dumplicate entry catching settings.\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n\nimport datetime\nfrom koushihime.main.models import PushRecord, WaitingQueue\n\n\ndef recent_have_pushed(title, hours=24):\n limit_date = datetime.datetime.utc...
python
chosen
[ { "from": "system", "value": "Update to VGG laod from datadir\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom tensorflow_fcn import fcn8_vgg\n\nimport tensorflow as tf\n\n\ndef inference(hyp...
python
chosen
[ { "from": "system", "value": "Remove the try/except clause from get_user().\n\nIt doesn't seem like the code will -ever- hit the except clause as the\nmethod that calls this has fallbacks of its own.\n" }, { "from": "human", "value": "from django.contrib.auth import get_user_model\nfrom django.c...
python
chosen
[ { "from": "system", "value": "Use context management protocol for test data fixtures\n" }, { "from": "human", "value": "\nimport shutil\nfrom os import getcwd\nfrom os.path import join, exists, abspath\nimport dependency_updater\n\ndef destroy_testdata(target_path):\n if exists(target_path): ...
python
chosen
[ { "from": "system", "value": "Reset version number on v1.0.x maintenance branch\n" }, { "from": "human", "value": "\"\"\"Fill missing values in a grid.\"\"\"\n# Copyright (c) 2012-2014 Andrew Dawson\n# \n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this so...
python
chosen
[ { "from": "system", "value": "Make Hook.args default to the empty string\n" }, { "from": "human", "value": "from events import Event, ACCEPTED\n\nclass Hook(Event):\n contains = ('name', 'is_command', 'args')\n requires = tuple()\n requires_predicate = ('name',)\n name = None\n is...
python
chosen
[ { "from": "system", "value": "Fix to handle multiple path segments\n" }, { "from": "human", "value": "# pipeurlbuilder.py\n#\n\nimport urllib\nfrom pipe2py import util\n\ndef pipe_urlbuilder(context, _INPUT, conf, **kwargs):\n \"\"\"This source builds a url and yields it forever.\n \n K...
python
chosen
[ { "from": "system", "value": "Add copyright and license terms\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\n\nfrom rest_framework import serializers\n\nfrom . import models\n\n\nclass ProjectExistsValidator:\n def validate_project_id(self, attrs, ...
python
chosen
[ { "from": "system", "value": "Make _Registry hashable so that django can import from scrapi\n" }, { "from": "human", "value": "import sys\n\n\nclass _Registry(dict):\n\n # These must be defined so that doctest gathering doesn't make\n # pytest crash when trying to figure out what/where scr...
python
chosen
[ { "from": "system", "value": "REFACTOR : Changed the name of step name from 'name' to 'step_name' to avoid clashing with a potential use of the word 'name' in kwargs.\n" }, { "from": "human", "value": "from hitchdoc.database import Database\nfrom hitchdoc import exceptions\nimport pickle\nimport...
python
chosen
[ { "from": "system", "value": "Update to new namespace interface, walk components\n" }, { "from": "human", "value": "import PyWXSB.XMLSchema as xs\nimport PyWXSB.Namespace as Namespace\nfrom PyWXSB.generate import PythonGenerator as Generator\n\nimport sys\nimport traceback\nfrom xml.dom import m...
python
chosen
[ { "from": "system", "value": "Support for newer versions of django" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls import url\n\nfrom freeze import views\n\n\nurlpatterns = [\n url(r'^download-static-site/$', views.download_static_site, name='freeze_download_...
python
chosen
[ { "from": "system", "value": "Fix adaptive tests loading script\n" }, { "from": "human", "value": "import json, sqlite3, csv, sys\nconnection = sqlite3.connect('./db/dev.sqlite3')\n\nfilename = sys.argv[1]\n\nif filename.endswith('json'):\n with open(filename) as f:\n scenarios = json....
python
chosen
[ { "from": "system", "value": "Update depracted flask extension code\n" }, { "from": "human", "value": "from auth import jwt\n\nfrom spark import Spark\nspark = Spark()\n\nfrom gc3pie import GC3Pie\ngc3pie = GC3Pie()\n\nfrom flask.ext.uwsgi_websocket import GeventWebSocket\nwebsocket = GeventWebS...
python
chosen
[ { "from": "system", "value": "Add gpio clean up tool\n" }, { "from": "human", "value": "import RPi.GPIO as GPIO\n\nGPIO.setup(16, GPIO.IN)\nGPIO.setup(20, GPIO.IN)\nGPIO.setup(23, GPIO.IN)\nGPIO.setup(18, GPIO.IN)\nGPIO.setup(17, GPIO.IN)\nGPIO.setup(27, GPIO.IN)\nGPIO.setup(5, GPIO.IN)\n\nGPIO....
python
chosen