conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix use of deprecated find_module\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport pkgutil\n\n\ndef test_imports():\n \"\"\"\n This just imports all modules in astropy, making sure they don't have any...
python
chosen
[ { "from": "system", "value": "Allow more than one GitHub repo from the same user\n\nGitHub does not allow the same SSH key to be used for multiple\nrepositories on the same server belonging to the same user, see:\n\nhttp://snipe.net/2013/04/multiple-github-deploy-keys-single-server\n\nThe fix there doesn't ...
python
chosen
[ { "from": "system", "value": "Update original \"Hello, World!\" parser to latest coding, plus runTests\n" }, { "from": "human", "value": "# greeting.py\r\n#\r\n# Demonstration of the pyparsing module, on the prototypical \"Hello, World!\"\r\n# example\r\n#\r\n# Copyright 2003, by Paul McGuire\r\...
python
chosen
[ { "from": "system", "value": "Remove unneeded datetime from view\n" }, { "from": "human", "value": "import datetime\nfrom django.views.generic import ListView\n\nfrom go.scheduler.models import Task\n\n\nclass SchedulerListView(ListView):\n paginate_by = 12\n context_object_name = 'tasks'\...
python
chosen
[ { "from": "system", "value": "Fix emplorrs demo salary db error\n" }, { "from": "human", "value": "from datetime import date\n\nfrom django import forms\nfrom django.utils import timezone\n\nfrom .models import Employee, DeptManager, Title, Salary\n\n\nclass ChangeManagerForm(forms.Form):\n m...
python
chosen
[ { "from": "system", "value": "Fix style issues raised by pep8.\n" }, { "from": "human", "value": "from tastypie.resources import ModelResource, ALL\nfrom .models import Filer, Filing\nfrom .utils.serializer import CIRCustomSerializer\n\n\nclass FilerResource(ModelResource):\n class Meta:\n ...
python
chosen
[ { "from": "system", "value": "Add variant extension in example script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf8 - *-\n\nfrom __future__ import print_function, unicode_literals\n\nfrom cihai.bootstrap import bootstrap_unihan\nfrom cihai.core import Cihai\n\n\nde...
python
chosen
[ { "from": "system", "value": "Sort everything alphabetically on separate lines.\n" }, { "from": "human", "value": "\"\"\"Read resources contained within a package.\"\"\"\n\nimport sys\n\n\n__all__ = [\n 'contents',\n 'is_resource',\n 'open_binary',\n 'open_text',\n 'path',\n 'r...
python
chosen
[ { "from": "system", "value": "Fix for django >= 1.10\n\nThe class django.core.management.NoArgsCommand is removed." }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\n\nfrom avatar.conf import settings\nfrom avatar.models import Avatar\n\n\nclass Command(NoArg...
python
chosen
[ { "from": "system", "value": "Add encoding spec to comply Python 2\n" }, { "from": "human", "value": "from . import formula\n\ndef direction(lat, lng):\n\treturn formula.qibla(lat, lng)\n\ndef direction_dms(lat, lng):\n\treturn _dms(formula.qibla(lat, lng))\n\ndef direction_str(lat, lng, prec=0)...
python
chosen
[ { "from": "system", "value": "Drop unused and dangerous entrypoint `open_fileindex`\n" }, { "from": "human", "value": "#\n# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t...
python
chosen
[ { "from": "system", "value": "Make it possible to step() in a newly created env, rather than throwing AttributeError\n" }, { "from": "human", "value": "from gym import Env\nfrom gym import spaces\nimport numpy as np\n\ndef categorical_sample(prob_n):\n \"\"\"\n Sample from categorical dist...
python
chosen
[ { "from": "system", "value": "Test cut_by_number with words and normal chunk numbers\n" }, { "from": "human", "value": "from lexos.processors.prepare.cutter import split_keep_whitespace, \\\n count_words, cut_by_number\n\n\nclass TestCutByNumbers:\n def test_split_keep_whitespace(self):\n ...
python
chosen
[ { "from": "system", "value": "Add comment to new test\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport numpy\nfrom ...pipeline import Tagger\nfrom ...vectors import Vectors\nfrom ...vocab import Vocab\nfrom ..util import make_tempdir\n\n\ndef test_issue1727():\n...
python
chosen
[ { "from": "system", "value": "Clear the job queue upon kolibri initialization.\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\n\nfrom django.apps import AppConfig\n\n\nclass KolibriTasksConfig(AppConfig):\n name = 'kolibri.tasks'\n ...
python
chosen
[ { "from": "system", "value": "Fix for broken container security test\n" }, { "from": "human", "value": "from tests.base import BaseTest\n\nfrom tenable_io.api.models import ScTestJob\n\n\nclass TestScTestJobsApi(BaseTest):\n\n def test_status(self, client, image):\n jobs = client.sc_te...
python
chosen
[ { "from": "system", "value": "Add account_id as the element of this class\n" }, { "from": "human", "value": "\nimport botocore\nfrom kotocore.session import Session\n\n\nclass KambooConnection(object):\n \"\"\"\n Kamboo connection with botocore session initialized\n \"\"\"\n session ...
python
chosen
[ { "from": "system", "value": "Add missing import to settings\n" }, { "from": "human", "value": "from .defaults import * # noqa\n\nlogger = logging.getLogger(__name__)\n\ntry:\n from .local import * # noqa\nexcept ImportError as error:\n logger.warn('No local.py settings file found')\n" ...
python
chosen
[ { "from": "system", "value": "Fix test for changed SctVerificationResult\n" }, { "from": "human", "value": "from os.path import join, dirname\n\nfrom utlz import flo\n\nfrom ctutlz.sct.verification import verify_signature\n\n\ndef test_verify_signature():\n basedir = join(dirname(__file__), '...
python
chosen
[ { "from": "system", "value": "Revert \"Don't complain about \\r when core.autocrlf is on in Git\"\n\nThis reverts commit 828afaa2fa4cc9e3e53bda0ae3073abfcfa151ca.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys, fileinput, subprocess\n\nerr=0\ncols=78\n\nconfig_proc=subprocess...
python
chosen
[ { "from": "system", "value": "Send location only when printing exception (Avoid leaking ID/UUID)\n" }, { "from": "human", "value": "\"\"\"\nexceptions - Core exceptions\n\"\"\"\n\n\nclass InvalidMembership(Exception):\n \"\"\"\n The membership provided is not valid\n \"\"\"\n pass\n\...
python
chosen
[ { "from": "system", "value": "Fix typo in division operator\n\n" }, { "from": "human", "value": "from ..value import ForeignCloVal\n\n\ndef plus(a: int, b: int) -> int:\n return a + b\n\n\ndef minus(a: int, b: int) -> int:\n return a - b\n\n\ndef times(a: int, b: int) -> int:\n return a...
python
chosen
[ { "from": "system", "value": "Edit view pre-populates with data from user object\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response\nfrom django.contrib.auth.decorators import login_required\nfrom django.template.context import RequestContext\n#from google.appengi...
python
chosen
[ { "from": "system", "value": "Update UserX, with back compatibility" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport hashlib\n\n\nclass BaseX(object):\n @classmethod\n def retrieve_one_by(cls, name, value):\n cls_db_list = cls.query(getattr(cls, name) == value).fetch(1)\n ...
python
chosen
[ { "from": "system", "value": "Rename master branch to main\n" }, { "from": "human", "value": "import re\nimport subprocess\nfrom datetime import datetime\n\n\ndef test_last_review_date():\n statement_file_path = \"app/templates/views/accessibility_statement.html\"\n\n # test local changes ...
python
chosen
[ { "from": "system", "value": "Add basket total to context\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.views.generic import ListView\nfrom longclaw.longclawbasket.models import BasketItem\nfrom longclaw.longclawbasket import utils\n\nclass BasketView(ListVi...
python
chosen
[ { "from": "system", "value": "Increase timeout for test_long_running_job test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nTests for various minion timeouts\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import\nimport os\nimport sys\n\nimport salt.utils.platfo...
python
chosen
[ { "from": "system", "value": "Use assert_allclose so we can see the appveyor failure\n" }, { "from": "human", "value": "from menpodetect.opencv import (load_opencv_frontal_face_detector,\n load_opencv_eye_detector)\nimport menpo.io as mio\n\ntakeo = mio.import_buil...
python
chosen
[ { "from": "system", "value": "Save the observation if the form was valid.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib import messages\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.utils.translation i...
python
chosen
[ { "from": "system", "value": "Include the version-detecting code to allow PyXML to override the \"standard\"\nxml package. Require at least PyXML 0.6.1.\n" }, { "from": "human", "value": "\"\"\"Core XML support for Python.\n\nThis package contains three sub-packages:\n\ndom -- The W3C Document ...
python
chosen
[ { "from": "system", "value": "Return errors in json only\n" }, { "from": "human", "value": "import os\nimport json\nimport httplib as http\n\nimport tornado.web\nimport tornado.ioloop\n\nfrom dinosaurs import api\nfrom dinosaurs import settings\n\n\nclass SingleStatic(tornado.web.StaticFileHandl...
python
chosen
[ { "from": "system", "value": "Apply change of file name\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n__doc__ = '''\nCrawl comment from nicovideo.jp\n\nUsage:\n main_crawl.py [--sqlite <sqlite>] [--csv <csv>]\n\nOptions:\n --sqlite <sqlite> (option...
python
chosen
[ { "from": "system", "value": "Remove unneeded post method from CreateEnvProfile view\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.shortcuts import render_to_response\nfrom django.views.generic import CreateView, UpdateView, DeleteView\nfrom installer_config...
python
chosen
[ { "from": "system", "value": "Change the comment of InterleavingMethod.evaluate\n" }, { "from": "human", "value": "class InterleavingMethod(object):\n '''\n Interleaving\n '''\n def interleave(self, k, a, b):\n '''\n k: the maximum length of resultant interleaving\n ...
python
chosen
[ { "from": "system", "value": "Fix another bug in the authentication\n" }, { "from": "human", "value": "import web\nfrom modules.base import renderer\nfrom modules.login import loginInstance\nfrom modules.courses import Course\n\n#Index page\nclass IndexPage:\n #Simply display the page\n de...
python
chosen
[ { "from": "system", "value": "Make person experience the default tab for ZA\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom pombola.south_africa.views import LatLonDetailView,SAPlaceDetailSub\n\nurlpatterns = patterns('pombola.south_africa.views',\n...
python
chosen
[ { "from": "human", "value": "Make sure test setup is run for subdirectories" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 Openstack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# ...
python
chosen
[ { "from": "system", "value": "Add missing vat alias for Turkey\n" }, { "from": "human", "value": "# __init__.py - collection of Turkish numbers\n# coding: utf-8\n#\n# Copyright (C) 2016 Arthur de Jong\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the term...
python
chosen
[ { "from": "system", "value": "[enh] Use isoformat date RFC 3339" }, { "from": "human", "value": "import logging\nfrom json.encoder import JSONEncoder\nimport datetime\n\nlogger = logging.getLogger('moulinette.utils.serialize')\n\n\n# JSON utilities -----------------------------------------------...
python
chosen
[ { "from": "system", "value": "nrf: Update the PCA10056 example to use new pin naming\n" }, { "from": "human", "value": "import board\nimport digitalio\nimport gamepad\nimport time\n\npad = gamepad.GamePad(\n digitalio.DigitalInOut(board.PA11),\n digitalio.DigitalInOut(board.PA12),\n dig...
python
chosen
[ { "from": "system", "value": "Update closest match adapter docstring.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom fuzzywuzzy import fuzz\n\nfrom .base_match import BaseMatchAdapter\n\n\nclass ClosestMatchAdapter(BaseMatchAdapter):\n \"\"\"\n The ClosestMatchAdapter log...
python
chosen
[ { "from": "system", "value": "Update GOV.UK Frontend/Jinja lib test\n\nCheck both the javascript and python packages, and make sure they're\nboth on our expected versions. If not, prompt the developer to check\nmacros.\n" }, { "from": "human", "value": "import json\n\n\ndef test_govuk_frontend_j...
python
chosen
[ { "from": "system", "value": "Test more edge cases of the highlighting parser\n" }, { "from": "human", "value": "\"\"\"Test suite for our color utilities.\n\nAuthors\n-------\n\n* Min RK\n\"\"\"\n#-----------------------------------------------------------------------------\n# Copyright (C) 201...
python
chosen
[ { "from": "system", "value": "Improve performance @ Measurement Admin\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Measurement\n\nadmin.site.register(Measurement)\n" }, { "from": "gpt", "value": "from django.contrib import admin\nfrom .mode...
python
chosen
[ { "from": "system", "value": "Fix SSL security provider integration tests\n\nThey were running with none provider instead.\n" }, { "from": "human", "value": "from . import base\n\n\nclass SSLTestCase(base.IntegrationTestCase):\n '''RabbitMQ integration test case.'''\n CTXT = {\n 'pl...
python
chosen
[ { "from": "system", "value": "Add end-to-end integration testing for all compression types\n" }, { "from": "human", "value": "import pytest\n\nfrom kafka import KafkaConsumer, KafkaProducer\nfrom test.conftest import version\nfrom test.testutil import random_string\n\n\n@pytest.mark.skipif(not v...
python
chosen
[ { "from": "system", "value": "Change the method of generating content of GUID element\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright: 2011, Grigoriy Petukhov\n# Author: Grigoriy Petukhov (http://lorien.name)\n# License: BSD\nfrom django.contrib.syndication.views import F...
python
chosen
[ { "from": "system", "value": "Update product listing test to use product ids rather than index\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.core.urlresolvers import reverse\nfrom whats_fresh_api.models import *\nfrom django.contrib.gis.db import models\nimport...
python
chosen
[ { "from": "system", "value": "Enable estimation reports for FPBŻ\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n{\n 'name': \"Bestja: FBŻ\",\n 'summary': \"Installation configuration for FPBŻ\",\n 'description': \"Installation configuration for Federacja Polskich Banków Żyw...
python
chosen
[ { "from": "system", "value": "Add apidoc to doc building\n" }, { "from": "human", "value": "import os\n\nfrom invoke.tasks import task\nfrom invoke.runner import run\n\n\ndocs_dir = 'docs'\nbuild = os.path.join(docs_dir, '_build')\n\n\n@task\ndef clean_docs():\n run(\"rm -rf %s\" % build)\n\n...
python
chosen
[ { "from": "system", "value": "Add fields to save question url and annexure links\n\nDetails of each question is in another link and some questions have annexures\n(in English/Hindi), add fields to save all these items\n\nSigned-off-by: Arun Siluvery <66692e34e783869a1e5829b4c5eee5e1a471c4f7@gmail.com>\n" ...
python
chosen
[ { "from": "system", "value": "Add a default value to the header limit\n" }, { "from": "human", "value": "#! /usr/bin/python3\n# -*- coding-utf-8 -*-\n\n\"\"\"\nThis script transform a md into a plain html in the context of a\ndocumentation for Kit&Pack.\n\"\"\"\n\nimport mmap\nimport yaml\n\npri...
python
chosen
[ { "from": "system", "value": "Add auth header to the fixture loader\n\nIt seems to work fine with the unauthenticated es instance\n" }, { "from": "human", "value": "\"\"\" Commands for interacting with Elastic Search \"\"\"\n# pylint: disable=broad-except\n\nfrom os.path import join\n\nimport re...
python
chosen
[ { "from": "system", "value": "Upgrade to a better version \n\nfrom info import __version__ # define __version__ variable ModuleNotFoundError: No module named 'info\r\n\r\nGave error while building \r\nCoz of missing ." }, { "from": "human", "value": "#!/usr/bin/env python2\n\n##\n# fspli...
python
chosen
[ { "from": "system", "value": "Add docs for MissingInputFiles 'message' arg.\n" }, { "from": "human", "value": "class AxisLabelsMismatchError(ValueError):\n \"\"\"Raised when a pair of axis labels tuples do not match.\"\"\"\n\n\nclass ConfigurationError(Exception):\n \"\"\"Error raised when...
python
chosen
[ { "from": "system", "value": "Add simple test for config builder\n\nSigned-off-by: Michal Kuffa <005ee1c97edba97d164343c993afee612ac25a0c@gmail.com>\n" }, { "from": "human", "value": "import io\nimport os\nfrom textwrap import dedent\n\nfrom pg_bawler import bawlerd\n\n\nclass TestBawlerdConfig:...
python
chosen
[ { "from": "system", "value": "Add simple plots of downtown LA wateruse.\n" }, { "from": "human", "value": "\"\"\"\nName: Paul Briant\nDate: 12/11/16\nClass: Introduction to Python\nAssignment: Final Project\n\nDescription:\nCode for Final Project\n\"\"\"\n\nimport pandas\nfrom datetime import da...
python
chosen
[ { "from": "system", "value": "Add catchall fields property to KeyValueSerializer\n\nWith the latest django-restframework, not explicitly setting the\nfields for a serializer causes errors. This explicitly sets the\nfields to those of the model.\n" }, { "from": "human", "value": "from django.core...
python
chosen
[ { "from": "system", "value": "Handle 7 as a factor\n" }, { "from": "human", "value": "def raindrops(number):\n if is_three_a_factor(number):\n return \"Pling\"\n if is_five_a_factor(number):\n return \"Plang\"\n return \"{}\".format(number)\n\ndef is_three_a_factor(number)...
python
chosen
[ { "from": "system", "value": "Use serial instead of ser, DUH\n" }, { "from": "human", "value": "import serial\nimport threading\n\nprint('Starting server...')\n\ntemperature_usb = '/dev/ttyAMA0'\nBAUD_RATE = 9600\ntemperature_ser = ser.Serial(temperature_usb, BAUD_RATE)\n\ndef process_line(line)...
python
chosen
[ { "from": "system", "value": "Print C++ code during parsing\n" }, { "from": "human", "value": "import os\n\nfrom thinglang import utils\nfrom thinglang.execution.execution import ExecutionEngine\nfrom thinglang.lexer.lexer import lexer\nfrom thinglang.parser.analyzer import Analyzer\nfrom thingl...
python
chosen
[ { "from": "system", "value": "Make sure to not leave hanging children processes if the parent is killed\n" }, { "from": "human", "value": "# encoding: utf-8\n'''\nThe main entry point for salt-api\n'''\n# Import python libs\nimport logging\nimport multiprocessing\n\n# Import salt-api libs\nimpor...
python
chosen
[ { "from": "system", "value": "Add carriage return for symmetry\n" }, { "from": "human", "value": "import getpass\nfrom distutils.command import upload as orig\n\n\nclass upload(orig.upload):\n \"\"\"\n Override default upload behavior to obtain password\n in a variety of different ways....
python
chosen
[ { "from": "system", "value": "Set update job timeout back to a more reasonable value\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nfrom redis import StrictRedis\nfrom rq import Queue\nfrom apscheduler.schedulers.blocking i...
python
chosen
[ { "from": "system", "value": "Implement suggested changes in PR review\n" }, { "from": "human", "value": "\"\"\"\nDjango Settings that more closely resemble SAML Metadata.\n\nDetailed discussion is in doc/SETTINGS_AND_METADATA.txt.\n\"\"\"\nfrom django.conf import settings\nfrom django.core.exce...
python
chosen
[ { "from": "system", "value": "Make DeviceGray the default color as it should be\n" }, { "from": "human", "value": "import collections\nfrom .psparser import LIT\n\nimport six #Python 2+3 compatibility\n\n## PDFColorSpace\n##\nLITERAL_DEVICE_GRAY = LIT('DeviceGray')\nLITERAL_DEVICE_RGB = LIT('De...
python
chosen
[ { "from": "system", "value": "Fix fixture encoding on Windows\n" }, { "from": "human", "value": "\"\"\"Test data\"\"\"\nfrom pathlib import Path\n\n\ndef patharg(path):\n \"\"\"\n Back slashes need to be escaped in ITEM args,\n even in Windows paths.\n\n \"\"\"\n return str(path)....
python
chosen
[ { "from": "human", "value": "Update Urls from nora_menu app\n" }, { "from": "gpt", "value": "# -*- encoding: utf-8 -*-\nfrom django.conf.urls import url, include\nfrom django.views.decorators.csrf import csrf_exempt\nfrom .views import CreateMenu,ListMenu,UpdateMenu,CreateSelection,ListSelection...
python
chosen
[ { "from": "system", "value": "Use itertext() to skip children in elements with text\n" }, { "from": "human", "value": "# Namespaces for Scopus XML\nns = {'dtd': 'http://www.elsevier.com/xml/svapi/abstract/dtd',\n 'dn': 'http://www.elsevier.com/xml/svapi/abstract/dtd',\n 'ait': \"http:/...
python
chosen
[ { "from": "system", "value": "Update snapshot query test generation\n" }, { "from": "human", "value": "# coding: utf-8\n\n# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Tests for /query api endpoint.\"\"\"\n\nfrom datetim...
python
chosen
[ { "from": "system", "value": "Put the user agent in the device object\n" }, { "from": "human", "value": "from flask import request\nfrom flask import url_for\nfrom flask import abort\n\nfrom siege.service import app, db\nfrom siege.models import Device\nfrom view_utils import jsonate\n\n\n@app.r...
python
chosen
[ { "from": "system", "value": "Add tests of setting nonterminal, which is not in grammar, as start symbol\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 10.08.2017 23:20\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import TestCas...
python
chosen
[ { "from": "system", "value": "Implement test for help and cli args\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\ndef test_bar_fixture(testdir):\n testdir.tmpdir.join('test_foo.py').write('''\ndef test_a(bar):\n assert bar == \"something\"\n'''\n result = testdir.runpytes...
python
chosen
[ { "from": "system", "value": "Fix setting of custom MPI command" }, { "from": "human", "value": "MPI_COMMAND = 'mpirun -n {n_proc} {executable}'\n\ndef set_mpi_command(command):\n \"\"\"\n Set the MPI Command to use.\n \n This should contain {n_proc} to indicate the number of process...
python
chosen
[ { "from": "system", "value": "Allow for comments in the sql file that do not start the line.\n" }, { "from": "human", "value": "import os.path\n\nfrom django.core.management.commands import syncdb\nfrom django.db import models, connection, transaction\n\ntry:\n from south.management.commands ...
python
chosen
[ { "from": "system", "value": "Increase timeout to 60 sec and make available to external callers.\n" }, { "from": "human", "value": "import json\nimport requests\nfrom requests.utils import get_unicode_from_response\nfrom lxml import html as lxml_html\n\nclass BaseProvider(object):\n # ==== HE...
python
chosen
[ { "from": "system", "value": "Add log message at start of user import\n" }, { "from": "human", "value": "import csv\nimport logging\nimport os\nimport datetime\nfrom rtrss import config\nfrom rtrss.models import User\nfrom rtrss.database import session_scope\n\n\n_logger = logging.getLogger(__na...
python
chosen
[ { "from": "system", "value": "Correct implementation of the while loop" }, { "from": "human", "value": "import pymw\nimport pymw.interfaces\n\nimport artgraph.plugins.infobox\n\nfrom artgraph.node import NodeTypes\nfrom artgraph.node import Node\n\nclass Miner(object):\n nodes = []\n relat...
python
chosen
[ { "from": "system", "value": "Fix on teeny tiny little typo... Also remember to write commit messages in the present tense.\n" }, { "from": "human", "value": "people = 30\ncars = 40\nbuses = 55\n\n\nif cars > people:\n print \"We should take the cars.\"\nelif cars < people:\n print \"We sh...
python
chosen
[ { "from": "system", "value": "Make the step actually do something.\n" }, { "from": "human", "value": "from lettuce import step\nfrom lettuce import world\n\nfrom lettuce_webdriver.util import assert_true\nfrom lettuce_webdriver.util import assert_false\n\nimport logging\nlog = logging.getLogger(...
python
chosen
[ { "from": "system", "value": "Use the more or less new options for importing\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nScript to test the import workflow.\n\nIt will remove an existing Nikola installation and then install from the\npackage directory.\nAfter that it will...
python
chosen
[ { "from": "system", "value": "Add workaround for tests on MSYS2 and MINGW\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import print_function, absolute_import, division\nfrom builtins import map, range, object, zip, sorted\n\nfrom .context imp...
python
chosen
[ { "from": "system", "value": "Fix the use of the moksha.templates.widget template, in one place. This needs to be fixed in many places\n" }, { "from": "human", "value": "from moksha.lib.base import Controller\nfrom moksha.lib.helpers import Category, MokshaApp, Not, not_anonymous, MokshaWidget\...
python
chosen
[ { "from": "system", "value": "Use gaussian pyramid function for collection viewer example\n" }, { "from": "human", "value": "\"\"\"\n=====================\nCollectionViewer demo\n=====================\n\nDemo of CollectionViewer for viewing collections of images. This demo uses\nsuccessively dar...
python
chosen
[ { "from": "system", "value": "Fix yet another 3k issue (stderr not flushing automatically).\n\nSigned-off-by: Thomas Hori <7133b3a0da8e60bd3295f2c8559ef184054a68ed@liddicott.com>\n" }, { "from": "human", "value": "from repugeng.StaticClass import StaticClass\r\nimport sys\r\n\r\nclass Compat3k(S...
python
chosen
[ { "from": "system", "value": "Fix travis issue for v1.13.1 release\n" }, { "from": "human", "value": "import boto3\nimport sys\nimport time\n\n\ndef health_check_tg(client, tg_arn, max_tries):\n if max_tries == 1:\n return False\n else:\n max_tries -= 1\n ...
python
chosen
[ { "from": "system", "value": "Fix cli argument name for repository path\n" }, { "from": "human", "value": "import argparse\nimport sys\n\nfrom .generator import Generator\nfrom .repository import Repository\n\n\ndef run(args=sys.argv[1:]):\n parser = argparse.ArgumentParser()\n parser.add_...
python
chosen
[ { "from": "system", "value": "Store current twist in a global variable\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport rospy\nfrom gazebo_msgs.msg import ModelStates\nfrom geometry_msgs.msg import Twist\n\nfrom constants import DELTA_T, STEPS\nfrom controller import create_con...
python
chosen
[ { "from": "system", "value": "Put SPI slave configurations on Host.\n" }, { "from": "human", "value": "\"\"\"\nCreated on 18 May 2017\n\n@author: Bruno Beloff (bruno.beloff@southcoastscience.com)\n\"\"\"\n\nimport sys\n\nfrom scs_dfe.particulate.opc_n2 import OPCN2\n\nfrom scs_host.bus.i2c impor...
python
chosen
[ { "from": "system", "value": "Remove uses of using() from migrations\n\nThis hardcoded the db_alias fetched from schema_editor and forces django\nto try and migrate any second database you use, rather than routing to\nthe default database. In testing a build from scratch, these do not\nappear needed.\n\nUs...
python
chosen
[ { "from": "system", "value": "Fix ci / package_version.py script to support __version__\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\nimport os.path\nimport sys\n\n\ndef main():\n setup_py = os.path.join(os.path.dirname(os.path.dirname(__file__)),\n ...
python
chosen
[ { "from": "system", "value": "Update import path method to reflect behaviour\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom optparse import make_option\nimport os\nfrom csv import reader\nfrom codecs import BOM_UTF8\n\nimport pickle\n\nfrom django.utils.six impo...
python
chosen
[ { "from": "system", "value": "DOC: Clarify comments on what name and path are\n" }, { "from": "human", "value": "name = \"package-name\" # See https://www.python.org/dev/peps/pep-0008/\npath = name.lower().replace(\"-\", \"_\").replace(\" \", \"_\")\nversion = \"0.1.dev0\" # https://python.org...
python
chosen
[ { "from": "system", "value": "Add a test of the associativity of scalar multiplication\n" }, { "from": "human", "value": "import pytest # type: ignore\nfrom ppb_vector import Vector2\n\n\n@pytest.mark.parametrize(\"x, y, expected\", [\n (Vector2(6, 1), 0, Vector2(0, 0)),\n (Vector2(6, 1),...
python
chosen
[ { "from": "system", "value": "Optimize basic delete import tests\n\nThe dry-run check is now automatically performed on each import and we\ndo not need to duplicate the work in the delete test.\n" }, { "from": "human", "value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apach...
python
chosen
[ { "from": "system", "value": "Rename 'webcam' plugin to OpenCV\n" }, { "from": "human", "value": "info = {\n 'id': 'webcam',\n 'name': 'Webcam',\n 'description': 'Generic webcam driver',\n 'module name': 'Webcam',\n 'class name': 'Webcam',\n 'author': 'Philip Chimento',\n 'c...
python
chosen
[ { "from": "system", "value": "Fix an old-style except: statement\n" }, { "from": "human", "value": "# coding: utf-8\nimport datetime\n\nfrom django.core.management import CommandError\nfrom django.core.management.color import no_style\nfrom django.core.management.sql import sql_delete, sql_all\n...
python
chosen
[ { "from": "system", "value": "Fix for Authentication scenario to correctly use self.clients\n\nScenario has recently been refactored, self.clients in Scenario\nnow takes the name of the CLI client. During the refactoring,\nthe Authenticate scenario was not correctly updated, which\ncauses the authentication...
python
chosen
[ { "from": "system", "value": "Fix database for testing environment\n" }, { "from": "human", "value": "from .base_settings import *\nimport os\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = False\n\nSECRET_KEY = '$1B&VUf$OdUEfMJXd40qdakA36@%2NE_41Dz9tFs6l=z4v_3P-'\n...
python
chosen
[ { "from": "system", "value": "Bump version of python library to 0.14.0\n" }, { "from": "human", "value": "\"\"\"\nCartoDB Services Python Library\n\nSee:\nhttps://github.com/CartoDB/geocoder-api\n\"\"\"\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='cartodb_services',\n\n ...
python
chosen