conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add docstrings in Delegated class\n" }, { "from": "human", "value": "from .base import AuthenticationBase\n\n\nclass Delegated(AuthenticationBase):\n\n def __init__(self, domain):\n self.domain = domain\n\n def get_token(self, client_id, target, api_typ...
python
chosen
[ { "from": "system", "value": "Fix typo in exception name\n" }, { "from": "human", "value": "#\n# Copyright (c) 2011 rPath, Inc.\n#\n# All Rights Reserved\n#\n\nBAD_REQUEST = 400\nNOT_FOUND = 404\nINTERNAL_SERVER_ERROR = 500\n\nclass RbuilderError(Exception):\n \"An unknown error has occured.\...
python
chosen
[ { "from": "system", "value": "Check if dir exists before calling listdir\n\nChanges along the way to how we clean up and detach after\ncopying an image to a volume exposed a problem in the cleanup\nof the brick/initiator routines.\n\nThe clean up in the initiator detach was doing a blind listdir\nof /dev/di...
python
chosen
[ { "from": "system", "value": "Add a generator for association tables\n" }, { "from": "human", "value": "import random\nfrom whitenoise.generators import BaseGenerator\n\nclass SelectGenerator(BaseGenerator):\n '''\n Creates a value by selecting from another SQLAlchemy table\n Depends on...
python
chosen
[ { "from": "system", "value": "Read HTTP server from env variables\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport os\nimport pprint\nimport StringIO\n\nfrom flask import Flask\nfrom flask import request\n\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef echo(...
python
chosen
[ { "from": "system", "value": "Fix page import path in view decorator module\n" }, { "from": "human", "value": "try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps\n\nfrom feincms.models import Page\n\n\ndef add_page_to_extra_context(view_func...
python
chosen
[ { "from": "system", "value": "Add unit test for register\n" }, { "from": "human", "value": "from django.core.urlresolvers import resolve\nfrom xpserver_web.views import main\n\n\ndef test_root_resolves_to_hello_world():\n found = resolve('/')\n assert found.func == main\n\n" }, { "...
python
chosen
[ { "from": "system", "value": "Revise doc string by adding \"undirected\"\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\n\ndef make_set():\n\tpass\n\n\ndef link():\n\tpass\n\n\ndef find():\n\tpas...
python
chosen
[ { "from": "system", "value": "Fix bug : error at logging\n" }, { "from": "human", "value": "import logging\nimport webapp2\nfrom google.appengine.ext.webapp.mail_handlers import InboundMailHandler\nfrom google.appengine.api import mail\n\nclass ReplyHandler(InboundMailHandler):\n def receive(...
python
chosen
[ { "from": "system", "value": "Read settings from environment, if available\n" }, { "from": "human", "value": "import socket\n\ntry:\n from django.conf import settings\nexcept ImportError:\n settings = None\n\nfrom client import StatsClient\n\n\n__all__ = ['StatsClient', 'statsd']\n\nVERSIO...
python
chosen
[ { "from": "system", "value": "Clean up quota cleanup migration [WAL-433]\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import migrations\n\nfrom nodeconductor.quota...
python
chosen
[ { "from": "system", "value": "Remove unecessary parentheses with assert stmt\n" }, { "from": "human", "value": "from pkg_resources import safe_version\nimport stagpy\nimport helpers\n\ndef test_init_config_None():\n stagpy.conf.core.path = 'some_path'\n helpers.reset_config()\n assert(s...
python
chosen
[ { "from": "system", "value": "Add more tests for pool\n" }, { "from": "human", "value": "import random\nimport unittest\n\nfrom aioes.pool import RandomSelector, RoundRobinSelector\n\n\nclass TestRandomSelector(unittest.TestCase):\n\n def setUp(self):\n random.seed(123456)\n\n def t...
python
chosen
[ { "from": "system", "value": "Update code for changed function.\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport sys\nif 'darwin' in sys.platform:\n sys.path.append('/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python')\nsys.path.append('.')\n\nimport...
python
chosen
[ { "from": "system", "value": "Allow script to take multiple paths, and adjust to standard __main__ idiom\nfor cmdline scripts.\n\n* tools/dev/wc-format.py:\n (usage): remove. all paths are allowed.\n (print_format): move guts of format fetching and printing into this\n function. print 'not under versio...
python
chosen
[ { "from": "system", "value": "Return correct status code to shell when tests fail.\n\nWhen tests fail (due to e.g. missing feedparser), then the exit code of tests/runtests.py is 0, which is treated by shell as\nsuccess. Patch by Arfrever Frehtes Taifersar Arahesis.\n" }, { "from": "human", "va...
python
chosen
[ { "from": "system", "value": "Add checker for LD_LIBRARY_PATH env variable\n" }, { "from": "human", "value": "\"\"\"Tools for checking environment variables\"\"\"\n\nimport os\nfrom configparser import NoOptionError\n\nfrom .config import CONFIG\n\ndef path_sufficient():\n \"\"\"\n Checks ...
python
chosen
[ { "from": "system", "value": "Add some extra tests for prefiltering.\n" }, { "from": "human", "value": "\"\"\"Tests for input manipulation machinery.\"\"\"\n\n#-----------------------------------------------------------------------------\n# Imports\n#---------------------------------------------...
python
chosen
[ { "from": "system", "value": "Remove flask usage in init\n" }, { "from": "human", "value": "import logging\n\nfrom flask import Flask\n\n\nlog = logging.getLogger(__name__)\n\n\ndef create_app(config_dict):\n app = Flask(__name__, static_folder=None)\n app.config.update(**config_dict)\n\n ...
python
chosen
[ { "from": "system", "value": "Add 2 tests for Utils\n" }, { "from": "human", "value": "import os\nfrom unittest import TestCase\n\nimport requests\n\nfrom furikura import utils\n\n\ndef test_request():\n requests.get('https://example.com')\n\nclass TestUtils(TestCase):\n def test_get_file(...
python
chosen
[ { "from": "system", "value": "Fix utils test and add an extra test.\n" }, { "from": "human", "value": "from django_logutils.utils import add_items_to_message\n\n\ndef test_add_items_to_message():\n msg = \"log message\"\n items = {'user': 'benny', 'email': 'benny@example.com'}\n msg = a...
python
chosen
[ { "from": "system", "value": "Refresh monitoring.nagios.log and fix pylint+pep8.\n" }, { "from": "human", "value": "#===============================================================================\n# -*- coding: UTF-8 -*-\n# Module : log\n# Author : Vincent BESANCON aka 'v!nZ' <bes...
python
chosen
[ { "from": "system", "value": "Add code for thread to filter valid files for processing\n" }, { "from": "human", "value": "#import spam\nimport filter_lta\n\n#VALID_FILES = filter_lta.VALID_OBS().split('\\n') \nprint filter_lta.VALID_OBS()\n\n#def extract_basename():\n\ndef main():\n #Convert ...
python
chosen
[ { "from": "system", "value": "Change cache land, use settings mapentity\n" }, { "from": "human", "value": "from django.shortcuts import get_object_or_404\nfrom django.views.decorators.cache import cache_page\nfrom django.conf import settings\nfrom django.utils.decorators import method_decorator\...
python
chosen
[ { "from": "system", "value": "UTILS: Add init-helper 'wait for subscriber'\n\nFor integration-testing purposes it is often useful to wait until a\nparticular node subscribes to you\n" }, { "from": "human", "value": "import rospy\nfrom time import time\n\n\ndef wait_for_param(param_name, timeout=...
python
chosen
[ { "from": "system", "value": "Write to temp directories in such a way that files get cleaned up\n" }, { "from": "human", "value": "import tempfile\n\nimport pytest\n\nfrom pre_commit_hooks.pretty_format_json import pretty_format_json\nfrom testing.util import get_resource_path\n\n\n@pytest.mark....
python
chosen
[ { "from": "system", "value": "Print out dtypes in .root file individually\n" }, { "from": "human", "value": "__author__ = 'jacob'\nimport ROOT\nimport numpy as np\nimport os\nfrom root_numpy import root2array, root2rec, tree2rec\n\n# Look at r284484 data\n\nfilename = os.path.join(\"data\", \"r2...
python
chosen
[ { "from": "system", "value": "Replace error codes with error subclasses\n\nThis provides the same information but is a cleaner solution for python\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nclass Error...
python
chosen
[ { "from": "system", "value": "Fix DATrie support under Python 2.\n\nThis is a simple issue of using `str` to refer to what should be\n`six.text_type`.\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, unicode_literals\n\nfrom itertools import chain\n\nfrom datr...
python
chosen
[ { "from": "system", "value": "Update related name for `layout` field.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('ice...
python
chosen
[ { "from": "system", "value": "Rename of the author field to content_type in the model, in order to\navoid confusion\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contentt...
python
chosen
[ { "from": "system", "value": "Set jnius classpath to biopax jars automatically\n" }, { "from": "human", "value": "\"\"\"Handles all imports from jnius to prevent conflicts resulting from attempts\nto set JVM options while the VM is already running.\"\"\"\n\nimport jnius_config\n\nif '-Xmx4g' not...
python
chosen
[ { "from": "system", "value": "Add menu to choose star or planet, print results.\n" }, { "from": "human", "value": "import ephem\nfrom datetime import datetime\n\ndef const(planet_name): # function name and parameters \n planet_class = getattr(ephem, planet_name) # sets ephem objec...
python
chosen
[ { "from": "system", "value": "Add more properties to be updated\n" }, { "from": "human", "value": "from corehq.apps.data_interfaces.models import CaseRuleActionResult, AUTO_UPDATE_XMLNS\nfrom corehq.apps.hqcase.utils import update_case\n\n\ndef escalate_tech_issue(case, rule):\n if case.type ...
python
chosen
[ { "from": "system", "value": "Fix to_host_port_tuple to resolve test case issues\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nhyper/common/util\n~~~~~~~~~~~~~~~~~\n\nGeneral utility functions for use with hyper.\n\"\"\"\nfrom hyper.compat import unicode, bytes, imap\n\ndef...
python
chosen
[ { "from": "system", "value": "Fix last.fm bug for users not listening to something.\n\nThe last.fm plugin previously worked only for users not listening to\nanything, and then it was 'fixed' for users listening to something, but\nbroke for users not listening to something. See lastfm.py comments for\nchange...
python
chosen
[ { "from": "system", "value": "Fix missing import, add alias/deactivate method\n" }, { "from": "human", "value": "import json\nimport random\nimport string\n\nfrom flask import Flask, request, jsonify, render_template\nfrom flask.ext.pymongo import PyMongo\nfrom pymongo.errors import DuplicateKey...
python
chosen
[ { "from": "system", "value": "Fix exec command timeout timer bug.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n website.services\n ~~~~~~~~~~~~~~~~\n\n top level services api.\n\n :copyright: (c) 2014 by xiong.xiaox(xiong.xiaox@alibaba-inc.com).\n\"\"\"\n\n\nim...
python
chosen
[ { "from": "system", "value": "Create renderer property for Powerline class\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass Powerline(object):\n\tdef __init__(self, segments):\n\t\t'''Create a new Powerline.\n\n\t\tSegments that aren't filler segments and whose contents aren...
python
chosen
[ { "from": "system", "value": "Update theater view to use get_object_or_404 shortcut\n" }, { "from": "human", "value": "from django.http import Http404\nfrom django.http import HttpResponse\nfrom django.shortcuts import render\nfrom django.template import RequestContext, loader\nfrom .models impo...
python
chosen
[ { "from": "system", "value": "FIX fiscal position no source tax on v7 api\n" }, { "from": "human", "value": "from openerp import models, api, fields\n\n\nclass account_fiscal_position(models.Model):\n\n _inherit = 'account.fiscal.position'\n\n @api.v8 # noqa\n def map_tax(self, taxe...
python
chosen
[ { "from": "system", "value": "Refactor handling of pretty parameter.\n\n\nFormer-commit-id: 04093318dd591d642854485a97109855275c8596" }, { "from": "human", "value": "from falcon.util.uri import parse_query_string\nimport json\nfrom api.actions import pos_tagging\n\nclass ApiResource(object):\n ...
python
chosen
[ { "from": "system", "value": "Convert binhex regression test to PyUnit. We could use a better test\nfor this.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\"\"\"Test script for the binhex C module\n\n Uses the mechanism of the python binhex module\n Roger E. Masse\n\"\"\"\nimp...
python
chosen
[ { "from": "system", "value": "Add tests for role attributes." }, { "from": "human", "value": "from chef import Role\nfrom chef.exceptions import ChefError\nfrom chef.tests import ChefTestCase\n\nclass RoleTestCase(ChefTestCase):\n def test_get(self):\n r = Role('test_1')\n self....
python
chosen
[ { "from": "human", "value": "Create basic user model for auth\n" }, { "from": "gpt", "value": "import datetime\n\nfrom project import db, bcrypt\n\n\nclass User(db.Model):\n\n __tablename__ = \"users\"\n\n id = db.Column(db.Integer, primary_key=True)\n email = db.Column(db.String, uniqu...
python
chosen
[ { "from": "system", "value": "Add log message if data we can't parse appears\n\nIf the datum isn't numeric and doesn't match the 'no data' pattern,\nsomething has gone horribly wrong.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport string\n\n\ndef sanitise_string(messy_str):\n...
python
chosen
[ { "from": "system", "value": "Initialize xmlsec once to prevent SAML auth from hanging.\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ansible, Inc.\n# All Rights Reserved.\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 Ansible, Inc.\n# All Rights Reserved.\n\n# Pytho...
python
chosen
[ { "from": "system", "value": "Fix for insanely silly pip.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nraise ImportError(\"For future use.\")\n\nfrom __future__ import unicode_literals\n\nfrom ..compat import unicode\nfrom .base import Concern, Transform, Attribute\n\n\nclass Primitiv...
python
chosen
[ { "from": "system", "value": "Add test for nesting streamer data-structures.\n" }, { "from": "human", "value": "import mr_streams as ms\nimport unittest\nfrom operator import add\n\n# :::: auxilary functions ::::\ndef add_one(x):\n return x + 1\ndef repeat_n_times(x, n = 1):\n return [x] *...
python
chosen
[ { "from": "system", "value": "Add some more mmap related tests\n" }, { "from": "human", "value": "from . import base\n\nimport os\n\nimport mmstats\n\n\nclass TestMmap(base.MmstatsTestCase):\n\n def test_pagesize(self):\n \"\"\"PAGESIZE > 0\"\"\"\n self.assertTrue(mmstats.PAGESI...
python
chosen
[ { "from": "system", "value": "Change the sort order on prizes won\n" }, { "from": "human", "value": "from django.http import HttpResponse, HttpResponseRedirect\nfrom django.http import Http404\nfrom django.template import loader\nfrom django.shortcuts import render\nfrom django.db.models import ...
python
chosen
[ { "from": "system", "value": "Move version print to logger\n" }, { "from": "human", "value": "from django.utils.version import get_version\nfrom subprocess import check_output, CalledProcessError\n\nVERSION = (0, 0, 3, 'beta', 1)\n\n__version__ = get_version(VERSION)\n\ntry:\n __git_hash__ = ...
python
chosen
[ { "from": "system", "value": "Remove unused line of code\n" }, { "from": "human", "value": "import sqlite3\nfrom datetime import datetime\n\nfrom SenseCells.tts import tts\n\ndef show_all_notes():\n conn = sqlite3.connect('memory.db')\n tts('Your notes are as follows:')\n\n cursor = con...
python
chosen
[ { "from": "system", "value": "Add more info for completions\n" }, { "from": "human", "value": "import bottle\nfrom bottle import response, request\nimport json\nimport jedi\nimport logging\n\n\napp = bottle.Bottle( __name__ )\nlogger = logging.getLogger( __name__ )\n\n\n@app.get( '/healthy' )\nd...
python
chosen
[ { "from": "system", "value": "FIX: Add `analyze` to `expyfun` init" }, { "from": "human", "value": "\"\"\"Experiment control functions\n\"\"\"\n\n__version__ = '1.1.0.git'\n\n# have to import verbose first since it's needed by many things\nfrom ._utils import set_log_level, set_config, \\\n ...
python
chosen
[ { "from": "system", "value": "Debug print each health check\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport requests\n\n\nclass Healthcheck:\n\n def __init__(self):\n pass\n\n def _result(self, site, health, response=None, message=None):\n result = {\n ...
python
chosen
[ { "from": "system", "value": "Add sun and moon to list of interesting objects\n" }, { "from": "human", "value": "import ephem\n\n\nINTERESTING_PLANETS = [\n ephem.Mercury,\n ephem.Venus,\n ephem.Mars,\n ephem.Jupiter,\n ephem.Saturn,\n ephem.Uranus,\n ephem.Neptune,\n]\n\nMI...
python
chosen
[ { "from": "system", "value": "Add extra status codes to HTTPError\n" }, { "from": "human", "value": "try:\n from BaseHTTPServer import BaseHTTPRequestHandler\nexcept ImportError:\n from http.server import BaseHTTPRequestHandler\n\n\nclass HTTPError(Exception):\n\n default_status = 500\n...
python
chosen
[ { "from": "system", "value": "Fix JSONResponse to work without complaints on django 1.6\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.http import HttpResponse\nfrom django.utils import simplejson\n\ndef JSONResponse(data):\n return HttpResponse(simplejson.dumps(dat...
python
chosen
[ { "from": "system", "value": "Use LoginView instead of login\n\nsee https://docs.djangoproject.com/en/dev/releases/1.11/#django-contrib-auth\n" }, { "from": "human", "value": "from django.urls import path\nfrom django.contrib.auth import views as auth_views\n\nfrom . import views\nfrom . import ...
python
chosen
[ { "from": "system", "value": "Add module actions to module list\n" }, { "from": "human", "value": "from django.utils.translation import ugettext as _\nfrom achilles import blocks, tables\n\nimport nazs\n\nregister = blocks.Library('core')\n\n\n@register.block(template_name='web/core/welcome.html...
python
chosen
[ { "from": "system", "value": "Use tacas statusdb module instead\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nfrom statusdb.db import connections as statusdb\n\nif len(sys.argv) == 1:\n sys.exit('Please provide a project name')\nprj = sys.argv[1]\n\npcon = statusdb.P...
python
chosen
[ { "from": "system", "value": "Add link to the online docs in the module desc\n\nNo reason not to have it there. I'm going to start writing test cases now and\nwork on kennethreitz/requests to allow it to take a list of tuples for\nmultipart form encoding (would also allow it to take an OrderedDict). Just\nw...
python
chosen
[ { "from": "system", "value": "Update to the latest way to offer metadata\n" }, { "from": "human", "value": "from ._version import version_info, __version__\n\ndef _jupyter_nbextension_paths():\n return [{\n 'section': 'notebook',\n 'src': 'nbextension/static',\n 'dest': '...
python
chosen
[ { "from": "system", "value": "[Logging] Use the same format everywhere\n" }, { "from": "human", "value": "import argparse\nimport logging\nimport os\nimport sys\nfrom hubbot.bothandler import BotHandler\nfrom newDB import createDB\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentPa...
python
chosen
[ { "from": "system", "value": "Fix IndexError while processing tweets\n" }, { "from": "human", "value": "import datetime\nimport json\nimport requests\nimport telebot\n\nLOKLAK_API_URL = \"http://loklak.org/api/search.json?q={query}\"\n\nbot = telebot.TeleBot(\"162563966:AAHRx_KauVWfNrS9ADn099kjx...
python
chosen
[ { "from": "system", "value": "Handle floating issue numbers better (.5 and .1 issues)\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\nimport sys\nimport re\nfrom collections import defaultdict\nimport args\nARGS=None\nargs.add_argument('--noreboots', '-r', action='store_true',...
python
chosen
[ { "from": "system", "value": "Stats: Fix bug with MySQL Database.\n" }, { "from": "human", "value": "from cStringIO import StringIO\n\nfrom matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas\nfrom matplotlib.figure import Figure\n\nclass GraphToolException(Exception):\n p...
python
chosen
[ { "from": "system", "value": "Conan: Support package in editable mode\n\nAdd a method to the recipe that maps the include path to \"src\" when the package is put into \"editable mode\". See:\nhttps://docs.conan.io/en/latest/developing_packages/editable_packages.html\n" }, { "from": "human", "val...
python
chosen
[ { "from": "system", "value": "Format `message` on multiple lines\n\nSee SublimeLinter/SublimeLinter#1735\nhttps://user-images.githubusercontent.com/8558/78509776-dd4c9100-7790-11ea-899e-420efa677974.png\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checki...
python
chosen
[ { "from": "system", "value": "Use six for correct Python2/3 compatibility\n" }, { "from": "human", "value": "from traitlets.config import LoggingConfigurable\nfrom traitlets.traitlets import Unicode\n\n\nclass NotebookGist(LoggingConfigurable):\n\n oauth_client_id = Unicode(\n '',\n ...
python
chosen
[ { "from": "system", "value": "Remove the Infrastructure panel group\n\nRemove the Infrastructure panel group, and place the panels\ndirectly under the Infrastructure dashboard.\n\nChange-Id: I321f9a84dd885732438ad58b6c62c480c9c10e37\n" }, { "from": "human", "value": "#\n# Licensed under the A...
python
chosen
[ { "from": "system", "value": "Create users when they log in\n" }, { "from": "human", "value": "import hashlib\nimport base64\nfrom datetime import date\n\nfrom bo import *\nfrom database.oldauth import *\n\n\nclass Login(webapp.RequestHandler):\n def get(self):\n if self.request.get('s...
python
chosen
[ { "from": "system", "value": "Fix tests for Django 2.0\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom django.contrib import admin\n\nurlpatterns = [\n url('^admin/', include(admin.site.urls)),\n]\n" }, { "from": "gpt", "value": "from django.conf...
python
chosen
[ { "from": "system", "value": "Modify schema to support only upvotes\n" }, { "from": "human", "value": "import datetime\nfrom flask import url_for\nfrom Simpoll import db\n\n\nclass Poll(db.Document):\n created_at = db.DateTimeField(default=datetime.datetime.now, required=True)\n question =...
python
chosen
[ { "from": "system", "value": "Print error message before exiting in main()\n\nAmends 42af9a9985ec5409f7773d9daf9f8a68df291228\n" }, { "from": "human", "value": "import sys\n\nfrom .config import RawConfig\nfrom .exc import RunCommandsError\nfrom .run import run, partition_argv, read_run_args_fro...
python
chosen
[ { "from": "system", "value": "Convert script to Python 3\n\nChanged print function in main to be Python 3 compatible" }, { "from": "human", "value": "import sys\nfrom datetime import datetime\n\nTEMPLATE = \"\"\"\nTitle: {title}\nDate: {year}-{month}-{day} {hour}:{minute:02d}\nModified: \nAuthor...
python
chosen
[ { "from": "system", "value": "Use the correct urllib for the openid we're using\n" }, { "from": "human", "value": "\"\"\"\nAn OpenID URL fetcher respecting the settings.\n\"\"\"\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfr...
python
chosen
[ { "from": "system", "value": "Use linear models by default\n" }, { "from": "human", "value": "import data\nimport model\nimport numpy as np\nfrom keras import optimizers\n\n\n# Localize data through file system relative indexing method\npath = 'hcp_olivier/102816/MNINonLinear/Results/rfMRI_REST1...
python
chosen
[ { "from": "system", "value": "Fix ordering in string expansion example\n" }, { "from": "human", "value": "\"\"\"Example of expanding and unexpanding string variables in entry fields.\"\"\"\n\nfrom __future__ import print_function\n\nimport bibpy\nimport os\n\n\ndef get_path_for(path):\n retur...
python
chosen
[ { "from": "system", "value": "Add .urban as Urban Dictionary alias.\n" }, { "from": "human", "value": "from plumeria.command import commands, CommandError\nfrom plumeria.util import http\nfrom plumeria.util.ratelimit import rate_limit\n\n\n@commands.register(\"urbandict\", \"urb\", category=\"Se...
python
chosen
[ { "from": "system", "value": "Set the version number to 0.11.wave\n" }, { "from": "human", "value": "from ofxparse import OfxParser, AccountType, Account, Statement, Transaction\n\n__version__ = '0.10'\n" }, { "from": "gpt", "value": "from ofxparse import OfxParser, AccountType, Acco...
python
chosen
[ { "from": "system", "value": "Print list of areas in usage report\n\nThis list is not completely ok, as some usage record types, like\n`StorageObjectCount` can't get area calculated without inducing it\nfrom other records.\n" }, { "from": "human", "value": "import csv\n\n\nif __name__ == \"__mai...
python
chosen
[ { "from": "system", "value": "Make tuple creation from position cleaner.\n" }, { "from": "human", "value": "santaPosition = [0, 0]\nroboSantaPosition = [0, 0]\n\nuniquePositions = set()\n\ninput = open(\"data\", \"r\").read()\nfor index, char in enumerate(input):\n\tposition = []\n\n\tif index %...
python
chosen
[ { "from": "system", "value": "Fix quick union functions issue\n\nMissing counter\nFind function should return position of element\nDecrement counter in union\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nclass WeightedQuickUnion(object):\n\n def __init...
python
chosen
[ { "from": "system", "value": "Remove the IRC bot for now, and also the commented-out code.\n" }, { "from": "human", "value": "from buildbot.status import html, words\nfrom buildbot.status.web.authz import Authz\nfrom buildbot.status.web.auth import BasicAuth\n\n# authz = Authz(\n# forceBuild...
python
chosen
[ { "from": "system", "value": "Put a getStatus() method into the CHPIncident model. That's the right way to do it.\n" }, { "from": "human", "value": "from google.appengine.ext import db\n\nclass CHPIncident(db.Model):\n\tCenterID = db.StringProperty(required=True)\n\tDispatchID = db.StringProper...
python
chosen
[ { "from": "system", "value": "Fix import name from ntm to layers\n" }, { "from": "human", "value": "from . import controllers\nfrom . import heads\nfrom . import init\nfrom . import memory\nfrom . import nonlinearities\nfrom . import ntm\nfrom . import similarities\nfrom . import updates" }, ...
python
chosen
[ { "from": "system", "value": "Update package classifiers and Django minimum version\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\nimport os\n\n__doc__ = \"\"\"\nApp for Django featuring improved form base classes.\n\"\"\"\n\nversion = '1.1...
python
chosen
[ { "from": "system", "value": "Adjust entry_points to fix autoscan\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nname = 'morepath_cerebral_todomvc'\ndescription = (\n 'Morepath example of using React & Cerebral'\n)\nversion = '0.1....
python
chosen
[ { "from": "system", "value": "Update version number to 0.1.4\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nsetup(\n name='ActionCableZwei',\n version='0.1.3',\n license='MIT',\n description='Action Cable Client for Python 3',\n author='Tobias ...
python
chosen
[ { "from": "system", "value": "Make sure to install gpx.xsd in data directory\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(name=\"taggert\",\n\tversion=\"1.0\",\n\tauthor=\"Martijn Grendelman\",\n\tauthor_email=\"m@rtijn.net\",\n\tmaintaine...
python
chosen
[ { "from": "system", "value": "Add rex as a dependency\n" }, { "from": "human", "value": "from distutils.core import setup\nimport subprocess\n\nsetup(\n name='colorguard',\n version='0.01',\n packages=['colorguard'],\n install_requires=[\n 'tracer',\n 'h...
python
chosen
[ { "from": "system", "value": "Add YAML as a dep.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os\n\nsetup(\n name='yamlicious',\n packages=find_packages(),\n scripts=[os.path.join('bin', p) for p in os.listdir('bin')],\n)\n" }, { "from": "gpt"...
python
chosen
[ { "from": "system", "value": "Fix the Operating System classifier, it was invalid\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom suponoff import __version__ as version\n\n\nif __name__ == '__main__':\n with open(\"README.rst\") as f:\n long_descrip...
python
chosen
[ { "from": "system", "value": "Revert previous commit as fuse-python doesn't seem to play nicely with easy_install (at least on Ubuntu).\n\n\ngit-svn-id: fdb8975c015a424b33c0997a6b0d758f3a24819f@14 bfab2ddc-a81c-11dd-9a07-0f3041a8e97c\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*...
python
chosen
[ { "from": "system", "value": "Fix a minor typo in package name" }, { "from": "human", "value": "from distutils.core import setup\nimport glob\n\ndatas = [ \"locale/\" + l.rsplit('/')[-1]+\"/LC_MESSAGES/*.*\" for l in glob.glob(\"pages/locale/*\")]\ndatas.extend([\n 'templates/admin/pages/page...
python
chosen
[ { "from": "system", "value": "Switch capmetrics script to etl function.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport os\nfrom setuptools import setup, find_packages\n\n\ndef get_readme():\n return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()\n\nsetup...
python
chosen
[ { "from": "system", "value": "Change classifier to include python 3 (instead of python 3.5)\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='JekPost',\n version='0.1.0',\n author='Arjun Krishna Babu',\n author_email='arjunkrishnababu96@gmail.com',...
python
chosen
[ { "from": "system", "value": "Fix wrong install requirement name.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding=utf-8\n__author__ = 'kulakov.ilya@gmail.com'\n\nfrom setuptools import setup\n\n\nsetup(name=\"Power\",\n version=\"1.0\",\n description=\"Cross-platform sys...
python
chosen