conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update config variable name of HDB in celery worker\n" }, { "from": "human", "value": "from app import celery\nfrom app import create_app\n\napp = create_app(config_override={'BDB_READONLY': True})\ncelery\n" }, { "from": "gpt", "value": "from app import...
python
chosen
[ { "from": "system", "value": "Update basic_nest for new API\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport collections\nimport os\nimport os.path\nimport sys\nfrom nestly import nestly\n\nwd = os.getcwd()\ninput_dir = os.path.join(wd, 'inputs')\n\nctl = collections.OrderedDic...
python
chosen
[ { "from": "system", "value": "Move the open outside the try, since the finally is only needed once the file is successfully opened.\n" }, { "from": "human", "value": "\"\"\"Execute files of Python code.\"\"\"\n\nimport imp, os, sys\n\ndef run_python_file(filename, args):\n \"\"\"Run a python ...
python
chosen
[ { "from": "system", "value": "Add utils tests. Rework pull.\n" }, { "from": "human", "value": "\n\nimport pytest\n\n\ndef test_scrub_doi():\n from vdm.utils import scrub_doi\n d = 'http://dx.doi.org/10.1234'\n scrubbed = scrub_doi(d)\n assert(scrubbed == '10.1234')\n\n d = '10.12...
python
chosen
[ { "from": "system", "value": "Remove accidentally committed test code\n" }, { "from": "human", "value": "from django.http import HttpResponse\n\nfrom djproxy.views import HttpProxy\n\nDOWNSTREAM_INJECTION = lambda x: x\n\n\nclass LocalProxy(HttpProxy):\n base_url = \"http://sitebuilder.qa.yol...
python
chosen
[ { "from": "system", "value": "Fix module name to import.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '2.0.0'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__maintainer__ = 'Pierre Cazenave'\n_...
python
chosen
[ { "from": "system", "value": "Use python version dependent import\n\nChange-Id: Iae6bc0cc8d526162b91d0c18cf1fba1461aa9f98\n" }, { "from": "human", "value": "import inspect\nimport python2.httplib2 as httplib2\nglobals().update(inspect.getmembers(httplib2))\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "WIP: Add sample loading logic to Robot.\n" }, { "from": "human", "value": "from ophyd import Device, EpicsSignal, EpicsSignalRO\nfrom ophyd import Component as C\n\n\nclass Robot(Device):\n robot_sample_number = C(EpicsSignal, 'ID:Tgt-SP')\n robot_load_cmd = C...
python
chosen
[ { "from": "system", "value": "Drop table for device report logs.\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\nfrom celery.schedules import crontab\nfrom celery.task import periodic_task\nfrom django.conf import settings\nfrom phonelog.models import DeviceReportEnt...
python
chosen
[ { "from": "system", "value": "Update test for new column naming rules. Remove '' as a name and call column 'C1'\n" }, { "from": "human", "value": "import sys\nsys.path.insert(1, \"../../../\")\nimport h2o\n\ndef cupMediumGBM(ip,port):\n # Connect to h2o\n h2o.init(ip,port)\n\n train = h2o.im...
python
chosen
[ { "from": "system", "value": "Return a list of messages in echo encoder and add mypy type hints\n" }, { "from": "human", "value": "class Encoder(object):\n @staticmethod\n def encode(msg):\n \"\"\"\n Don't change the message at all\n :param msg:\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Add pylint to disable redefined variable.\n" }, { "from": "human", "value": "\"\"\"Compatibility routines.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport sys\n\ntry:\n import Image # pylint: disable=import-error,unused-import\nexcept ImportError:\n ...
python
chosen
[ { "from": "system", "value": "tests: Remove SALADIR from environment if present\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nfrom optparse import OptionParser\nfrom subprocess import Popen\nimport os\nimport sys\n\n\ndef run_command(cmdline...
python
chosen
[ { "from": "system", "value": "Send just plaintext name if curl is used\n" }, { "from": "human", "value": "import os\nfrom flask import Flask, render_template\nfrom names import get_full_name\n\n\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef index():\n return render_template('index.html',...
python
chosen
[ { "from": "system", "value": "Use the right bash command based on platform\n" }, { "from": "human", "value": "import os\nfrom synthtool import shell\nfrom pathlib import Path\n\n# Parent of the script is the API-specific directory\n# Parent of the API-specific directory is the apis directory\n# ...
python
chosen
[ { "from": "system", "value": "Test what get_repo() does for unsupported repos\n" }, { "from": "human", "value": "from django.test import TestCase\n\nclass TestRepoHandlers(TestCase):\n def test_repo_registry(self):\n from package.handlers import get_repo, supported_repos\n g = g...
python
chosen
[ { "from": "system", "value": "Fix description for contact mixin\n" }, { "from": "human", "value": "from apps.contacts.models import BaseContact\n\n\nclass ContactMixin(object):\n \"\"\"\n Would be used for adding contacts functionality to models with contact data.\n \"\"\"\n\n def ge...
python
chosen
[ { "from": "system", "value": "Make ps shell-out Mac and debian compliant.\n" }, { "from": "human", "value": "import os\nimport sys\n\ndef get_mem_usage():\n \"\"\"returns percentage and vsz mem usage of this script\"\"\"\n pid = os.getpid()\n psout = os.popen( \"ps -p %s u\"%pid ).read(...
python
chosen
[ { "from": "system", "value": "Use now 'oop' method from creating principal object, prevent 'path handling error' with baikal caldav server\n" }, { "from": "human", "value": "import logging\nimport caldav\nfrom dateutil.relativedelta import relativedelta\n\nlog = logging.getLogger(__file__)\n\n\n...
python
chosen
[ { "from": "system", "value": "Change the name for end-to-end numscons tests" }, { "from": "human", "value": "import os\nimport os.path\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('tests',parent_packag...
python
chosen
[ { "from": "system", "value": "Use six instead of sys.version_info\n" }, { "from": "human", "value": "import sys\n\nfrom .log import log_input, log_output\n\n\ndef open(*args, **kwargs):\n \"\"\"Built-in open replacement that logs input and output\n\n Workaround for issue #44. Patching `__b...
python
chosen
[ { "from": "system", "value": "Add autoincrement for jump in the future\n" }, { "from": "human", "value": "class BytecodeBase:\n def __init__(self):\n # Eventually might want to add subclassed bytecodes here\n # Though __subclasses__ works quite well\n pass\n\n def exec...
python
chosen
[ { "from": "system", "value": "Fix up regex for path matching\n" }, { "from": "human", "value": "from __future__ import print_function, absolute_import, division\n\nfrom numba.cuda.testing import unittest, SerialMixin, skip_on_cudasim\nfrom numba import cuda, config\n\n\nclass MyError(Exception):...
python
chosen
[ { "from": "system", "value": "Add common CLI invocation test stubs.\n\nDoesn't go into positional args.\n" }, { "from": "human", "value": "import os\n\nfrom spec import eq_\n\nfrom invoke import run\n\nfrom _utils import support\n\n\n# Yea, it's not really object-oriented, but whatever :)\nclass...
python
chosen
[ { "from": "system", "value": "Reset to upstream master instead of rebasing during deployment\n" }, { "from": "human", "value": "from fabric.api import * # noqa\n\n\nenv.hosts = [\n '104.131.30.135',\n]\nenv.user = \"root\"\nenv.directory = \"/home/django/api.freemusic.ninja\"\nenv.deploy_pat...
python
chosen
[ { "from": "system", "value": "Update doc upload task w/ static hostname\n" }, { "from": "human", "value": "from fabric.api import task, sudo, env, local\nfrom fabric.contrib.project import rsync_project\nfrom fabric.contrib.console import confirm\n\n\n@task\ndef upload_docs():\n target = \"/v...
python
chosen
[ { "from": "system", "value": "Fix typo in comment (the module is now called _testcapi, not _test).\n" }, { "from": "human", "value": "# Run the _testcapi module tests (tests for the Python/C API): by defn,\n# these are all functions _test exports whose name begins with 'test_'.\n\nimport sys\ni...
python
chosen
[ { "from": "system", "value": "Update genfromtxt skip_header for numpy 1.10+\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\nReader for XVISTA .prof tables.\n\"\"\"\n\nimport numpy as np\nfrom astropy.table import Table\nfrom astropy.io import registry\n\n\nde...
python
chosen
[ { "from": "system", "value": "8: Create documentation of DataSource Settings \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christoph....
python
chosen
[ { "from": "system", "value": "Use get_or_create correctly on Order\n" }, { "from": "human", "value": "import copy, json\n\nfrom django.conf import settings\nfrom django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.decorators.http import requir...
python
chosen
[ { "from": "system", "value": "Return a 404 if the package was not found\n" }, { "from": "human", "value": "\"\"\"Package blueprint.\"\"\"\nimport os\n\nimport magic\nfrom flask import Blueprint, current_app, make_response, render_template\n\nblueprint = Blueprint('packages', __name__, url_prefix...
python
chosen
[ { "from": "system", "value": "Remove last_page not needed anymore.\n" }, { "from": "human", "value": "import math\nfrom django import template\nfrom ..conf import settings\n\nregister = template.Library()\n\n\n@register.inclusion_tag('googlesearch/_pagination.html', takes_context=True)\ndef show...
python
chosen
[ { "from": "system", "value": "Add sigma0 and alpha AMR parameters to the function.\n" }, { "from": "human", "value": "import dolfin as df\n\ndef amr(mesh, m, DirichletBoundary, g, d):\n V = df.FunctionSpace(mesh, \"CG\", 1)\n\n # Define boundary condition\n bc = df.DirichletBC(V, g, Dir...
python
chosen
[ { "from": "system", "value": "Fix ZeroLazyVariable size returned by white noise kernel" }, { "from": "human", "value": "import torch\nfrom . import Kernel\nfrom gpytorch.lazy import DiagLazyVariable, ZeroLazyVariable\n\n\nclass WhiteNoiseKernel(Kernel):\n def __init__(self, variances):\n ...
python
chosen
[ { "from": "system", "value": "Add Docstrings and fix basic model" }, { "from": "human", "value": "\"\"\"\nmodels.py\n\nApp Engine datastore models\n\n\"\"\"\n\n\nfrom google.appengine.ext import ndb\n\n\nclass ExampleModel(ndb.Model):\n \"\"\"Example Model\"\"\"\n example_name = ndb.String...
python
chosen
[ { "from": "system", "value": "Update API to look at one folder and return processor\n" }, { "from": "human", "value": "\"\"\"\nThis module provides a simplified API for invoking the Geneways input processor\n, which converts extracted information collected with Geneways into INDRA\nstatements.\n...
python
chosen
[ { "from": "system", "value": "Rename navigation config key name to label and add support for links to external sites over the url key name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n flask-rstblog\n ~~~~~~~~~~~~~\n\n :copyright: (c) 2011 by Christoph Heer.\n ...
python
chosen
[ { "from": "system", "value": "Make host field raw ID instead of select\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import SponsoredEvent\n\n\n@admin.register(SponsoredEvent)\nclass SponsoredEventAdmin(admin.ModelAdmin):\n fields = [\n 'host', 'ti...
python
chosen
[ { "from": "system", "value": "Remove unnecessary log from random agent\n" }, { "from": "human", "value": "import random\nimport sys\n\nimport acpc_python_client as acpc\n\n\nclass KuhnRandomAgent(acpc.Agent):\n def __init__(self):\n super().__init__()\n\n def on_game_start(self, gam...
python
chosen
[ { "from": "system", "value": "Use staticfiles instead of staticmedia\n" }, { "from": "human", "value": "from django import forms\nfrom django.utils import simplejson as json\nimport staticmedia\n\nclass JSONWidget(forms.Textarea):\n def render(self, name, value, attrs=None):\n if value...
python
chosen
[ { "from": "system", "value": "Replace solve with solveset in sympy.calculus\n" }, { "from": "human", "value": "from sympy.solvers import solve\nfrom sympy.simplify import simplify\n\n\ndef singularities(expr, sym):\n \"\"\"\n Finds singularities for a function.\n Currently supported fun...
python
chosen
[ { "from": "system", "value": "Fix webdriver user creation bug\n" }, { "from": "human", "value": "from apps.webdriver_testing.webdriver_base import WebdriverTestCase\nfrom apps.webdriver_testing import data_helpers\nfrom apps.webdriver_testing.data_factories import UserFactory\n\nclass WebdriverT...
python
chosen
[ { "from": "system", "value": "Test settings which don't depend on local ones\n\nBy overriding local settings we were cargo-culting things we didn't\nwant. Prefer explicit settings (still using the `base.py` environment as\na starting point)\n" }, { "from": "human", "value": "from __future__ impo...
python
chosen
[ { "from": "system", "value": "Add some more unit tests for get_sql_date_from_epoch()\n" }, { "from": "human", "value": "from mediawords.util.sql import *\n\nimport time\nimport datetime\n\n\ndef test_get_sql_date_from_epoch():\n assert get_sql_date_from_epoch(int(time.time())) == datetime.dat...
python
chosen
[ { "from": "system", "value": "Remove redundant xorg command test\n" }, { "from": "human", "value": "import os\n\nimport testinfra.utils.ansible_runner\n\ntestinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(\n os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')\n\n\ndef test_com...
python
chosen
[ { "from": "system", "value": "Fix display of page after score override.\n" }, { "from": "human", "value": "\"\"\"\nSerializers are created to ensure models do not have to be accessed outside the\nscope of the ORA2 APIs.\n\"\"\"\nfrom rest_framework import serializers\nfrom openassessment.workflo...
python
chosen
[ { "from": "system", "value": "Test to make sure we're outputting kwargs on the user.delete documentation.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n tests.integration.shell.call\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: © 2012 UfSoft.org - :email:`Pedro Al...
python
chosen
[ { "from": "system", "value": "Use more prefered exc_info inspection technique\n" }, { "from": "human", "value": "import pytest\nfrom conftest import (POSITIVE_HOST_PATTERNS, NEGATIVE_HOST_PATTERNS)\n\n\n@pytest.mark.parametrize(\"host_pattern, num_hosts\", POSITIVE_HOST_PATTERNS)\ndef test_len(h...
python
chosen
[ { "from": "system", "value": "Revert the version string fix, so the proper fix can be merged without\nconflict\n" }, { "from": "human", "value": "from distutils.version import StrictVersion\n__version__ = \"5.0.5a1\"\nStrictVersion(__version__)\n__DOI__ = \"Zenodo, DOI:10.5281/zenodo.4467703\"\n...
python
chosen
[ { "from": "system", "value": "Change the way used to read the testing information\n" }, { "from": "human", "value": "import sys\nsys.path.append(\"../ideascaly\")\n\nfrom ideascaly.auth import AuthNonSSO\nfrom ideascaly.api import API\n\nimport ConfigParser\nimport unittest\n\nconfig = ConfigPar...
python
chosen
[ { "from": "system", "value": "Set the column count value based on size of header list.\n" }, { "from": "human", "value": "import unittest\n\nimport manifest\nimport plow\n\nclass StaticModuletests(unittest.TestCase):\n\n def testFindJobs(self):\n plow.findJobs()\n\n\nif __name__ == \"_...
python
chosen
[ { "from": "system", "value": "Fix so we can do :5000 queries from api container\n" }, { "from": "human", "value": "import os\nimport re\n\n\nclass SetBaseEnv(object):\n \"\"\"\n Figure out which port we are on if we are running and set it.\n\n So that the links will be correct.\n Not...
python
chosen
[ { "from": "system", "value": "Use 'with ... as ...' for file opening. Standardize variable names.\n" }, { "from": "human", "value": "\"\"\"\nSending a message:\n Encrypt your plaintext with encrypt_message\n Your id will serve as your public key\nReading a message\n Use decrypt_message ...
python
chosen
[ { "from": "system", "value": "Change comments to make sense" }, { "from": "human", "value": "import sys\nfrom tweepy.streaming import StreamListener\nfrom tweepy import OAuthHandler\nfrom tweepy import Stream\nimport tweepy\n\n#Get Hashtag to track\nargTag = sys.argv[1]\n\n#Class for listening t...
python
chosen
[ { "from": "system", "value": "Adjust path to GAE DSK\n" }, { "from": "human", "value": "from paver.easy import *\nimport paver.doctools\nfrom paver.setuputils import setup\n\n@task\ndef dumpdb():\n print \"Downloading data from App Engine\"\n sh(\"python2.5 ../../google_appengine/bulkloade...
python
chosen
[ { "from": "system", "value": "Add typecheck to Parameter function\n" }, { "from": "human", "value": "import numpy\n\nfrom chainer import function\n\n\nclass Parameter(function.Function):\n\n \"\"\"Function that outputs its weight array.\n\n This is a parameterized function that takes no in...
python
chosen
[ { "from": "system", "value": "Add --feedvaldiator option to validator\n" }, { "from": "human", "value": "\"\"\"Validate GTFS\"\"\"\nimport os\n\nimport mzgtfs.feed\nimport mzgtfs.validation\n\nimport task\n\nclass FeedEaterValidate(task.FeedEaterTask):\n def run(self):\n # Validate feeds\n ...
python
chosen
[ { "from": "system", "value": "Allow running tasks even if roledefs.pickle is missing\n\nSigned-off-by: Samuli Seppänen <be49b59234361de284476e9a2215fb6477f46673@openvpn.net>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Generic Fabric-commands which should be usable without f...
python
chosen
[ { "from": "system", "value": "Add corporation task in celery data\n\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nimport config\nimport logging\n\nfrom celery.schedules import crontab\nfrom lazyblacksmith.app import create_app\nfrom lazyblacksmith.extension.celery_app import cele...
python
chosen
[ { "from": "system", "value": "Update settings example for tpl directories and other stuff\n" }, { "from": "human", "value": "DEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n # ('Your Name', 'your_email@example.com'),\n)\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.back...
python
chosen
[ { "from": "system", "value": "Check for status code of 200 in sample app.\n" }, { "from": "human", "value": "import pytest\n\n\n@pytest.fixture\ndef app():\n import sys\n sys.path.append('.')\n\n from sample_app import create_app\n\n return create_app()\n\n\n@pytest.fixture\ndef clie...
python
chosen
[ { "from": "system", "value": "Comment out problematic test for now\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nimport os\nimport sys\n\nimport pytest\nfrom mock import MagicMock\n\n\n# At the moment it is not possible to have PyQt5 and P...
python
chosen
[ { "from": "system", "value": "Change v3 active branches to [master]\n\nExtend the list when it becomes relevant.\nThe old platform shall use the legacy branch.\n" }, { "from": "human", "value": "CURRENT_MIN_VERSION = 'v3.0'\nCURRENT_MAX_VERSION = 'v3.1'\n\nACTIVE_REMOTE_BRANCHES = ['master', 'st...
python
chosen
[ { "from": "system", "value": "Change form field to URLField.\n\nsee #31\n" }, { "from": "human", "value": "\"\"\"Radicale extension forms.\"\"\"\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy\n\nfrom modoboa.lib import form_utils\nfrom modoboa.parameters import f...
python
chosen
[ { "from": "system", "value": "Switch from python2 to python3\n\nCloses #6\n" }, { "from": "human", "value": "#!/usr/bin/env python2\nimport sys, subprocess\nimport re\n\nif __name__ == '__main__':\n p = subprocess.Popen(sys.argv[1:], stderr=subprocess.PIPE)\n (stdout, stderr) = p.communica...
python
chosen
[ { "from": "system", "value": "Add ordering to queryset in reindex admin command\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nfrom bulbs.content.models import Content\n\n\nclass Command(NoArgsCommand):\n help = 'Runs Content.index on all content.'\n...
python
chosen
[ { "from": "system", "value": "Fix URL scheme for OpenWeatherMap.\n" }, { "from": "human", "value": "\"\"\"\nImplementation of the OpenWeatherMap API.\n\"\"\"\n__author__ = 'ajay@roopakalu.com (Ajay Roopakalu)'\n\nOPEN_WEATHER_MAP_URL = 'api.openweathermap.org/data/2.5'\nWEATHER_URL = '/weather'\...
python
chosen
[ { "from": "system", "value": "Check input dimensions of pretrained model and input file\n" }, { "from": "human", "value": "import numpy as np\n\nfrom .network import autoencoder, get_encoder\nfrom .io import read_records, load_model\n\n\ndef encode(input_file, output_file, log_dir):\n X = rea...
python
chosen
[ { "from": "system", "value": "Add enabled field to teacher model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext as _\nfrom Django.contrib.auth.models import User\n\nFEMALE = 'F'\nMALE = 'M'\n\n\nclass Teacher(models.Model):\n \"\...
python
chosen
[ { "from": "system", "value": "scripts: Fix the manual upload trigger script\n\nSigned-off-by: Sayan Chowdhury <5f0367a2b3b757615b57f51d912cf16f2c0ad827@gmail.com>\n" }, { "from": "human", "value": "#!/bin/env python\n# -*- coding: utf8 -*-\n\n\"\"\" Triggers an upload process with the specified ...
python
chosen
[ { "from": "system", "value": "Prepare data with the new fiields and prompts\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\n\"\"\"\n\nimport os\nimport sys\nimport csv\nimport json\nimport html\n\ndef do_command(args):\n assert os.path.exists(args.i...
python
chosen
[ { "from": "system", "value": "Use the Tumblr API to get Marx quotes\n" }, { "from": "human", "value": "from errbot import BotPlugin, botcmd, webhook\n\n\nclass MarxBot(BotPlugin):\n \"\"\"Your daily dose of Marx\"\"\"\n min_err_version = '1.6.0'\n\n @botcmd(split_args_with=None)\n de...
python
chosen
[ { "from": "system", "value": "Update call method in test client\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Echo client program\nimport socket\nimport sys\nfrom RemoteFunctionCaller import *\nfrom SocketNetworker import SocketNetworker\n\nHOST = 'localhost' # The remote host\n...
python
chosen
[ { "from": "system", "value": "Update with name of app\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n ...
python
chosen
[ { "from": "system", "value": "Add ImageFileCollection to ccdproc namespace\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThe ccdproc package is a collection of code that will be helpful in basic CCD\nprocessing. These steps will allow...
python
chosen
[ { "from": "system", "value": "Return chained iterators instead of only first of multiple iterators\n" }, { "from": "human", "value": "from lxml import etree\nfrom app import formatting\n\n\ndef get_namespace_from_top(fn, key='xmlns'):\n ac, el = next(etree.iterparse(fn))\n return {'xmlns':...
python
chosen
[ { "from": "system", "value": "Update slicing so that array sizes match\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nTest the MPS class\n\"\"\"\nimport unittest\nimport numpy as np\n\nimport parafermions as pf\n\nclass Test(unittest.TestCase):\n\n def test_pe_degeneracy(...
python
chosen
[ { "from": "system", "value": "Check if an anetry already exists before adding it\n" }, { "from": "human", "value": "\"\"\"\r\nModule for adding new entries\r\n\"\"\"\r\nimport re\r\nimport api\r\nimport conf\r\n\r\n\r\ndef add(target_url, title=None, star=False, read=False):\r\n conf.load()\r...
python
chosen
[ { "from": "system", "value": "Include teh name of the backend in the error message\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at...
python
chosen
[ { "from": "system", "value": "Remove quota testing from notestest since API change == quotas broken\n\n" }, { "from": "human", "value": "import json\nimport os\nimport sys\n\nsys.path.append('..')\nfrom skytap.Quotas import Quotas # noqa\n\nquotas = Quotas()\n\n\ndef test_quota_count():\n as...
python
chosen
[ { "from": "system", "value": "Ch03: Define Post model related fields. [skip ci]\n\n https://docs.djangoproject.com/en/1.8/ref/models/fields/#manytomanyfield\n\nBlog Posts may be about multiple Startups, just as Startups may be\nwritten about multiple times. Posts may also be categorized by multiple\nTags...
python
chosen
[ { "from": "human", "value": "Check that PostgreSQL is 9.4 or higher on initialization\n" }, { "from": "gpt", "value": "from distutils.version import StrictVersion\n\nfrom django.db import connection\n\n\n# NetBox v2.2 and later requires PostgreSQL 9.4 or higher\nwith connection.cursor() as curso...
python
chosen
[ { "from": "system", "value": "Update tests to reflect removal of springfield_mongo Entity.\n" }, { "from": "human", "value": "from springfield_mongo.entities import Entity as MongoEntity\nfrom springfield_mongo import utils\nfrom springfield import fields\nfrom bson.objectid import ObjectId\n\n\...
python
chosen
[ { "from": "system", "value": "test: Format test-only's kernel_version to avoid mistakes\n\nI often try to start test-only builds with e.g.:\n\n test-only --kernel_version=4.19 --focus=\"...\"\n\nThat fails because our tests expect \"419\". We can extend the Python\nscript used to parse argument to recogn...
python
chosen
[ { "from": "system", "value": "Add comment to explain the choice in dynamic dispatcher\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport importlib\n\nfrom simpleflow.activity import Activity\n\nfrom .exceptions import DispatchError\n\n\nclass Dispatcher(object):\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Use the login manager and set a default app secret key\n" }, { "from": "human", "value": "# Main application file\n#\n# Copyright (c) 2015, Alexandre Hamelin <alexandre.hamelin gmail.com>\n\n\nfrom flask import Flask\napp = Flask(__name__)\n\n# Import anything that ...
python
chosen
[ { "from": "system", "value": "Make sure we do not try to convert None\n" }, { "from": "human", "value": "from cgi import escape\nimport dbus\nfrom utils import is_string\n\n\n\nITEM = \"org.freedesktop.Notifications\"\nPATH = \"/org/freedesktop/Notifications\"\nINTERFACE = \"org.freedesktop.Noti...
python
chosen
[ { "from": "system", "value": "Print the Nagare version number\n\n--HG--\nextra : convert_revision : svn%3Afc25bd86-f976-46a1-be41-59ef0291ea8c/trunk%4076\n" }, { "from": "human", "value": "#--\n# Copyright (c) 2008, 2009 Net-ng.\n# All rights reserved.\n#\n# This software is licensed under the B...
python
chosen
[ { "from": "system", "value": "Use the new auth keyword set by Ligonier. We're working now.\n" }, { "from": "human", "value": "import unittest\nfrom bluefin.dataretrieval.clients import V1Client\nfrom bluefin.dataretrieval.exceptions import V1ClientInputException, V1ClientProcessingException\nfro...
python
chosen
[ { "from": "system", "value": "Add new update command that updates efselab dependencies.\n\n\nFormer-commit-id: 6cfed1b9af9c0bbf34b7e58e3aa8ac3bada85aa7" }, { "from": "human", "value": "import os\nimport argparse\nparser = argparse.ArgumentParser()\nparser.add_argument('--run', action=\"store_tru...
python
chosen
[ { "from": "system", "value": "Migrate phone numbers to E.164 format\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport two_factor.models\n\n\nclass Migration(migrations.Migration):\n\n depende...
python
chosen
[ { "from": "system", "value": "Fix overshadowed tests by giving test functions unique names\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom byceps.services.shop.order.models.order import Paymen...
python
chosen
[ { "from": "system", "value": "Mark the \"with_statement\" __future__ feature as no-op since it's always on.\n" }, { "from": "human", "value": "def _get_feature(name):\n import __future__\n # fall back to a unique fake object for earlier Python versions or Python 3\n return getattr(__fut...
python
chosen
[ { "from": "system", "value": "Normalize by the size of the library\n" }, { "from": "human", "value": "## Copyright (C) 2012-2013 Dimitrios V. Vavoulis\n## Computational Genomics Group (http://bioinformatics.bris.ac.uk/)\n## Department of Computer Science\n## University of Bristol\n\n############...
python
chosen
[ { "from": "system", "value": "Fix Bugs: Cannot Backup Scan Task Queue\n" }, { "from": "human", "value": "#--coding:utf-8--\nfrom __init__ import *\nimport json\nimport Queue\n\nopen('Chinese.bak.json', 'ab').write('[')\nopen('Foreigner.bak.json', 'ab').write('[')\nopen('Student.bak.json', 'ab')....
python
chosen
[ { "from": "system", "value": "Fix relative import of models\n" }, { "from": "human", "value": "\"\"\"\nDefine custom transformations.\n\nSee class Transformation in models.py for the base class Transformation. This\nfile stores a list of all the subclasses of Transformation made available by\nde...
python
chosen
[ { "from": "system", "value": "Improve col reporting for unused imports\n" }, { "from": "human", "value": "from SublimeLinter.lint import PythonLinter\n\n\nclass Pyflakes(PythonLinter):\n cmd = 'pyflakes'\n regex = r'''(?x)\n ^(?P<filename>[^:\\n]+):(?P<line>\\d+):((?P<col>\\d+):)?\\...
python
chosen
[ { "from": "system", "value": "Undo change that did not fix issue\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nThis module is used to manage optional dependencies.\n\nExample usage::\n\n from birdy.dependencies import ipywidgets as widgets\n\"\"\"\n\nimport warnings\nf...
python
chosen
[ { "from": "system", "value": "Fix bug in username uniqueness.\n" }, { "from": "human", "value": "import uuid\n\nfrom django.contrib.auth.models import User\n\n\nclass UserTestsMixin(object):\n \"\"\" Mixin base class for tests requiring users. \"\"\"\n\n def create_user(self, username=None...
python
chosen
[ { "from": "system", "value": "Improve basic checks of distarray export." }, { "from": "human", "value": "import unittest\nimport distarray as da\nfrom distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError\n\n\nclass TestDistributedArrayProtocol(unittest.TestCase):\n\n def set...
python
chosen