conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add helpers to the dashboard code to generate OAuth keys\n" }, { "from": "human", "value": "from binascii import hexlify\nimport os\n\n\ndef generate_api_token():\n key = hexlify(os.urandom(30)).decode()\n dashes_key = \"\"\n for idx, char in enumerate(key)...
python
chosen
[ { "from": "system", "value": "Migrate from deprecated imp to importlib\n" }, { "from": "human", "value": "\"\"\"\nautomatically maintains the latest git tag + revision info in a python file\n\n\"\"\"\n\nimport imp\nimport os\nimport subprocess\n\n\ndef get_project_version(version_file):\n ver...
python
chosen
[ { "from": "system", "value": "Add package version to rst_prolog.\n" }, { "from": "human", "value": "import os\n\nimport sdv\n\nproject = u'stix-validator'\ncopyright = u'2015, The MITRE Corporation'\nversion = sdv.__version__\nrelease = version\n\nextensions = [\n 'sphinx.ext.autodoc',\n '...
python
chosen
[ { "from": "system", "value": "[xwalkdriver] Update activity name for crosswalk android package rule changed\n" }, { "from": "human", "value": "\nimport ConfigParser\nimport json\nimport os\nimport unittest\n\nfrom webserver import Httpd\nfrom network import get_lan_ip\n\nfrom selenium import web...
python
chosen
[ { "from": "system", "value": "Fix bug TypeError, not exist values (json) is dict None\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*\nimport json\nfrom django import forms\nfrom django.template.loader import render_to_string\n\nfrom .models import Field, Option,...
python
chosen
[ { "from": "system", "value": "Fix Copyright application, YACOWS to Opps Projects\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nVERSION = (0, 1, 4)\n\n__version__ = \".\".join(map(str, VERSION))\n__status__ = \"Development\"\n__description__ = u\"Poll App fo...
python
chosen
[ { "from": "system", "value": "Make event search actually useful\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sentry.api.base import DocSection\nfrom sentry.api.bases import GroupEndpoint\nfrom sentry.api.serializers import serialize\nfrom sentry.api.paginator...
python
chosen
[ { "from": "system", "value": "Fix path for designer directory with ui files\n" }, { "from": "human", "value": "import os\nfrom qtpy.uic import loadUi\n\ndef load_ui(ui_filename, baseinstance):\n ui_filename = os.path.split(ui_filename)[-1]\n\n # directory containing this file\n filename...
python
chosen
[ { "from": "system", "value": "Correct chat message event name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom socketIO_client import SocketIO, LoggingNamespace\n\n\ndef on_bbb_response(*args):\n print('on_bbb_response', args)\n\n\ndef on_chat_message_response(*args):\n p...
python
chosen
[ { "from": "system", "value": "Correct app label of ostinato_blog\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nclass OstinatoBlogConfig(AppConfig):\n name = 'ostinato.blog'\n label = 'ost_blog'\n verbose_name = 'Ostinato Blog Engine'\n\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Add required overrides to osfstorage.NodeSettings\n" }, { "from": "human", "value": "import logging\n\nfrom addons.base.models import BaseNodeSettings, BaseStorageAddon\n\nlogger = logging.getLogger(__name__)\n\nclass NodeSettings(BaseStorageAddon, BaseNodeSettings)...
python
chosen
[ { "from": "system", "value": "Add 'requests_encoding' parameter\nAllows user to override Requests' 'educated guess' about encoding of a response. Useful when loading a remote CSV that has a BOM that has been served with a 'text/csv' content-type, which Requests guesses needs a 'ISO-8859-1' encoding.\n" },...
python
chosen
[ { "from": "system", "value": "Allow sharing db connection across threads\n\n" }, { "from": "human", "value": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import scoped_session, sessionmaker\nfrom sqlalchemy.ext.declarative import declarative_base\n\n# Database\nengine = create_engi...
python
chosen
[ { "from": "system", "value": "Remove projections methods for now\n" }, { "from": "human", "value": "import asyncio\nimport uuid\nimport json\n\nimport requests\nfrom requests.exceptions import HTTPError\n\nfrom pyeventstore.events import (get_all_events,\n start_s...
python
chosen
[ { "from": "system", "value": "Revert \"make the uwsgi spooler code also work with the fallback\"\n\nThis reverts commit 84ab847b444fbd41b9cc17e5c79a609efdcdf6cf.\n" }, { "from": "human", "value": "# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n#\n# This Source...
python
chosen
[ { "from": "system", "value": "Modify runTwirc.py to accept system arguments\n" }, { "from": "human", "value": "from TwircBot import TwircBot as tw\n\nbot = tw(\"config/sampleConfig.sample\")\nbot.print_config()\nbot.connect()\n" }, { "from": "gpt", "value": "from TwircBot import Twir...
python
chosen
[ { "from": "system", "value": "Add interface for source+label pertubation\n" }, { "from": "human", "value": "from transformations.BackTranslation import BackTranslation\nfrom transformations.ButterFingersPerturbation import ButterFingersPerturbation\nfrom transformations.ChangeNamedEntities impor...
python
chosen
[ { "from": "system", "value": "Write information from test.html to csv file\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\n\n#uses beautiful soup to parse html file\n#finds the correct span tag\n#Gets the percentage of ink left in the printer\nsoup = BeautifulSoup(open(\"test/t...
python
chosen
[ { "from": "system", "value": "Check away status of the target, not user, of USERHOST\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom twisted.words.protocols import irc\nfrom txircd.module_interface import Command, ICommand, IModuleData, ModuleData\nfrom zope.interface...
python
chosen
[ { "from": "system", "value": "Set DEBUG = False in production\n" }, { "from": "human", "value": "from local_settings import *\n\nALLOWED_HOSTS = ['uchicagohvz.org']\n\n# Database\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psyco...
python
chosen
[ { "from": "system", "value": "Disable pickle5 use in cloudpickle\n" }, { "from": "human", "value": "import sys\n\n\nif sys.version_info < (3, 8):\n try:\n import pickle5 as pickle # noqa: F401\n from pickle5 import Pickler # noqa: F401\n except ImportError:\n import ...
python
chosen
[ { "from": "human", "value": "Copy over tests from aospy-obj-lib\n" }, { "from": "gpt", "value": "import numpy as np\nimport pytest\nimport xray\n\nfrom aospy_user import SpharmInterface\n\n\n@pytest.fixture\ndef compute_vrtdiv(u, v):\n sphint = SpharmInterface(u, v)\n sphint.make_vectorwin...
python
chosen
[ { "from": "system", "value": "Test compatibility with older Django versions.\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass TestModel(models.Model):\n\n name = models.CharField(max_length=63, unique=True, verbose_name='Name')\n image = models.ImageField(verbose_...
python
chosen
[ { "from": "system", "value": "downloads: Remove unnecessary usage of functools.partial\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom functools import partial\n\nfrom problems.models import UserSolution\n\nfrom .views import download_protected_file\n\nurlpatt...
python
chosen
[ { "from": "system", "value": "Remove a semicolon that didn't need to be there\n" }, { "from": "human", "value": "from _botan import *\n\ninit = LibraryInitializer()\n\ndef Filter(name, key = None, iv = None, dir = None):\n if key != None and iv != None and dir != None:\n return make_fi...
python
chosen
[ { "from": "system", "value": "TEST - some real_sph_harm tests\n" }, { "from": "human", "value": "\"\"\" Testing qball \n\n\"\"\"\n\nimport numpy as np\n\nimport dipy.core.qball as qball\n\nfrom nose.tools import assert_true, assert_false, \\\n assert_equal, assert_raises\n\nfrom numpy.testin...
python
chosen
[ { "from": "system", "value": "Handle instance where we get multiple IP addresess in the response\n" }, { "from": "human", "value": "from app import app, \\\n cors_header\nfrom flask import request, \\\n make_response, \\\n send_from_directory\nimp...
python
chosen
[ { "from": "system", "value": "Clean up some imports in the package app's template_tags.py file.\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom datetime import datetime\n\nfrom django import template\n\nfrom github2.client import Github\n\nfrom package.models import Packa...
python
chosen
[ { "from": "system", "value": "Change str() of Category for easier form handling\n" }, { "from": "human", "value": "from django.db import models\nfrom django.conf import settings\n\nclass Category(models.Model):\n\tuser = models.ForeignKey(settings.AUTH_USER_MODEL)\n\tname = models.CharField(max_...
python
chosen
[ { "from": "system", "value": "Use user.get_username() instead of user.username\n\nTo support custom User models\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.core.management.base import BaseCommand\n\nfrom ...settings import ge...
python
chosen
[ { "from": "system", "value": "Revert \"Add compile_to_json invocation in Myrial test fixture\"\n\nThis reverts commit ceb848021d5323b5bad8518ac7ed850a51fc89ca.\n" }, { "from": "human", "value": "\nimport collections\nimport math\nimport unittest\n\nimport raco.fakedb\nimport raco.myrial.interpre...
python
chosen
[ { "from": "system", "value": "Make the _array_api submodule install correctly\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('numpy', parent_pack...
python
chosen
[ { "from": "system", "value": "Make help accessible for logged-in non-admin users\n\nSigned-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>\n\nReviewed-by: Johannes Keyser <187051b70230423a457adbc3e507f9e4fff08d4b@posteo.de>\n" }, { "from": "human", "value": "#\n# This file is part of ...
python
chosen
[ { "from": "system", "value": "Update Google boilerplate test. (Logo frequently changes)\n" }, { "from": "human", "value": "'''\nGoogle.com testing example\n'''\n\nfrom seleniumbase import BaseCase\nfrom google_objects import HomePage, ResultsPage\n\n\nclass GoogleTests(BaseCase):\n\n def test...
python
chosen
[ { "from": "system", "value": "Add default for debug in conf template\n" }, { "from": "human", "value": "\nflickrKey = \"\"\nflickrSecret = \"\"\n\nrecaptchaEnabled = False\nrecaptchaKey = \"\"\nrecaptchaSecret = \"\"\n\n" }, { "from": "gpt", "value": "\nflickrKey = \"\"\nflickrSecret...
python
chosen
[ { "from": "system", "value": "Convert percentage to a value between 0 and 1\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport psutil\nimport os\nimport time\n\ndef create_bar(filled):\n low = '.'\n high = '|'\n if filled > 1:\n low = str(int(filled))\n high ...
python
chosen
[ { "from": "system", "value": "Use LOG_LEVEL to enable/disable request logging\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport logging\n\nfrom flask import Blueprint, current_app, request\n\napi_v1_blueprint = Blueprint(\"api_v1\", __name__, url_prefix='/api/v1')\n\nlog = loggi...
python
chosen
[ { "from": "system", "value": "Change docstrong to reflect actual endpoint\n" }, { "from": "human", "value": "from django.http import (HttpResponse,\n HttpResponseNotFound)\nfrom django.contrib.gis.measure import D\nfrom working_waterfronts.working_waterfronts_api.models i...
python
chosen
[ { "from": "system", "value": "Load the command handler before the commands\n" }, { "from": "human", "value": "\"\"\"\nCreated on Feb 28, 2018\n\n@author: StarlitGhost\n\"\"\"\n\nfrom twisted.plugin import IPlugin\nfrom desertbot.moduleinterface import IModule, BotModule\nfrom zope.interface impo...
python
chosen
[ { "from": "system", "value": "Use django.contrib.staticfiles when running locally\n\nso that the admin interface uses the proper css when running on the\ndev machine\n" }, { "from": "human", "value": "from settings_common import *\n\nPACKAGE_VERSION = \"0.5\"\n\nDEBUG = TEMPLATE_DEBUG = True\n\n...
python
chosen
[ { "from": "system", "value": "Handle redirect_url in demo login bypass.\n" }, { "from": "human", "value": "\"\"\"View overrides for demo mode.\n\"\"\"\n\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth import login\nfrom django.http import HttpResponseRedirect\n\n\ndef log...
python
chosen
[ { "from": "system", "value": "Add email settings example to localsettings\n" }, { "from": "human", "value": "DEBUG = True\n\nADMINS = (\n ('Zaphod Beeblebrox', 'hoopyfrood@heartofgold.com'),\n)\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = '^lkajsdlfkjaoi...
python
chosen
[ { "from": "system", "value": "Add originally raised exception value to pytest error message\n" }, { "from": "human", "value": "import re\nimport py.code\nimport pytest\n\n\ndef pytest_namespace():\n return {'raises_regexp': raises_regexp}\n\n\nclass raises_regexp(object):\n def __init__(se...
python
chosen
[ { "from": "system", "value": "Fix return type of hello\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\ndef fib(number: int) -> int:\n '''\n >>> fib(10)\n 55\n '''\n if number < 2:\n return number\n else:\n return fib(number-1...
python
chosen
[ { "from": "system", "value": "Add missed changes for the previous commit.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nimport json\n\ndef render(json_data, env='', sls='', **kws):\n if not isinstance(json_data, basestring):\n json_data = json_data.read()\n...
python
chosen
[ { "from": "system", "value": "Return table name not model object name.\n" }, { "from": "human", "value": "#!/usr/bin/python\n#\n# Copyright 2013 Rackspace Australia\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the ...
python
chosen
[ { "from": "system", "value": "Rewrite body generation and add reverse option\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\nclass millipede:\n def __init__(self, size, comment=None):\n self._millipede = \"\"\n if comment:\n self._millipede = comment + ...
python
chosen
[ { "from": "system", "value": "Define subprocesses in the context of the root process. Maybe this is more readable?\n" }, { "from": "human", "value": "from simpy import Simulation, InterruptedException\n\ndef test_simple_process():\n def pem(ctx, result):\n while True:\n resu...
python
chosen
[ { "from": "system", "value": "Make logger sort by date\n" }, { "from": "human", "value": "import sys\nimport os\nimport logging\nimport time\n\nif not os.path.exists(os.path.expanduser(\"~/.chatserver\")):\n os.makedirs(os.path.expanduser(\"~/.chatserver\"))\nlogging.basicConfig(filename=os.p...
python
chosen
[ { "from": "system", "value": "Move special frontpage name to variable.\n" }, { "from": "human", "value": "from urllib import quote\n\nfrom pylons import c, g\n\nfrom r2.lib.pages import Ads as BaseAds\nfrom r2.models.subreddit import DefaultSR\n\n\nclass Ads(BaseAds):\n def __init__(self):\n ...
python
chosen
[ { "from": "system", "value": "Allow for lazy translation of message tags\n" }, { "from": "human", "value": "from django import template\nfrom django.contrib.messages.utils import get_level_tags\n\n\nLEVEL_TAGS = get_level_tags()\n\nregister = template.Library()\n\n\n@register.simple_tag()\ndef g...
python
chosen
[ { "from": "system", "value": "Use shared_task instead of task.\n" }, { "from": "human", "value": "from .models import FileImport\nfrom .importers import ImportFailure\nfrom django.db import transaction\nimport celery\n\n\nassuming_failure_message = '{0} did not return True. Assuming failure.'\n\...
python
chosen
[ { "from": "system", "value": "Switch import from contrast to all\n\nChange import from contrast.py in\naugmenters/__init__.py to * instead of\nselective, as * should not import private\nmethods anyways.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom imgaug.augmen...
python
chosen
[ { "from": "system", "value": "Fix giant bug: crash when don't config all modules\n\nthat's bacause you import all the modules\n> from .middleware import github, keybase, medium\nwhile each module need to get configurations from modules.json, e.g.\n> config = Config.modules['modules']['github']\nbut can't ge...
python
chosen
[ { "from": "system", "value": "Add QWidget to the mock Qt\n" }, { "from": "human", "value": "has_qt = True\n\ntry:\n from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets\nexcept ImportError:\n try:\n from matplotlib.backends.qt4_compat import QtGui, QtCore\n QtWi...
python
chosen
[ { "from": "system", "value": "Remove redundant Scan ID printing (there is another one elsewhere)\n" }, { "from": "human", "value": "import logging\n\n# metadata set at startup\nRE.md['owner'] = 'xf11id'\nRE.md['beamline_id'] = 'CHX'\n# removing 'custom' as it is raising an exception in 0.3.2\n# ...
python
chosen
[ { "from": "system", "value": "Call Experiment.publish in run method\n" }, { "from": "human", "value": "import traceback\n\nfrom laboratory.observation import Observation, Test\nfrom laboratory import exceptions\n\n\nclass Experiment(object):\n\n def __init__(self, name='Experiment', raise_on_...
python
chosen
[ { "from": "system", "value": "[nostalgia] Remove conan Qt, as it is currently being ignored\n" }, { "from": "human", "value": "from conans import ConanFile, CMake\n\nclass NostalgiaConan(ConanFile):\n settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n requires = \"jsoncpp/1.9.2\",...
python
chosen
[ { "from": "system", "value": "Rename instance to dashboard in DashboardAdmin\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom lemon import extradmin as admin\nfrom lemon.dashboard import views\nfrom lemon.dashboard.base import dashboard, Widget\n\n\nclass DashboardAdmi...
python
chosen
[ { "from": "system", "value": "Include full path to original files\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\n\ndef linkJS(target_fn, file_list_fn, source_base, prologue=\"\", module_dirs=[]):\n with open(target_fn, \"wb\") as target:\n target.write(prologu...
python
chosen
[ { "from": "system", "value": "Reduce sleep duration in PluginManager.stop() test\n" }, { "from": "human", "value": "import socket\nimport time\nfrom unittest import TestCase\nfrom PluginManager import PluginManager\n\nclass TestPluginManager(TestCase):\n def test_stop(self):\n class Pl...
python
chosen
[ { "from": "system", "value": "Create object MenuItem that wraps functions to create a call stack\n" }, { "from": "human", "value": "class Menu(object):\n def __init__(self, dialog, items, title, caller = None):\n self.d = dialog\n self.caller = caller\n\n self.entries = [...
python
chosen
[ { "from": "system", "value": "Fix unicode source code on py3\n" }, { "from": "human", "value": "import json\nfrom . import _dukpy\n\ntry:\n from collections.abc import Iterable\nexcept ImportError:\n from collections import Iterable\n\ntry: # pragma: no cover\n unicode\n string_type...
python
chosen
[ { "from": "system", "value": "Update ES server config to make use of environment variables\n" }, { "from": "human", "value": "\n# A list of ES hosts\nES_HOSTS = ['https://c3d581bfab179c1101d5b7a9e22a5f95.us-east-1.aws.found.io:9243']\nES_HTTP_AUTH = (\"elastic:u3Mk8jjADYJ4NzUmPTn15MNx\")\n" },...
python
chosen
[ { "from": "system", "value": "Fix encoding for python 2.x\n" }, { "from": "human", "value": "from enum import Enum\nfrom collections import Counter\nfrom yargy.interpretation import InterpretationObject\n\n\nclass PersonObject(InterpretationObject):\n\n class Attributes(Enum):\n\n Firs...
python
chosen
[ { "from": "system", "value": "Extend cd context manager to decorator.\n" }, { "from": "human", "value": "\nimport os\nimport subprocess\n\n\nclass cd:\n \"\"\"Context manager for changing the current working directory.\"\"\"\n def __init__(self, new_path):\n self.new_path = os.path....
python
chosen
[ { "from": "system", "value": "Add template and remove company from insurance_us imports\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: Dave Lasley <dave@laslabs.com>\n# Copyright: 2015...
python
chosen
[ { "from": "system", "value": "Add unit tests for filtering Twitterbot and Slack.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sentry.filters.web_crawlers import WebCrawlersFilter\nfrom sentry.testutils import TestCase\n\n\nclass WebCrawlersFilterTest(TestCase...
python
chosen
[ { "from": "system", "value": "Front: Remove reference to nonexistent file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.\n#\n# This source code is licensed under the AGPLv3 license found in ...
python
chosen
[ { "from": "system", "value": "Fix service instance API class name\n" }, { "from": "human", "value": "# coding: utf-8\n\"\"\"\nPublic endpoint to import API classes\n\nInstead of importing each module individually (eg.\n``from pysuru.apps import AppsAPI``), import from this module.\n\"\"\"\nfrom ...
python
chosen
[ { "from": "system", "value": "Delete unused value extractor attribute.\n" }, { "from": "human", "value": "from webapp_health_monitor import errors\n\n\nclass Verificator(object):\n verificator_name = None\n\n def __init__(self, **kwargs):\n pass\n\n def run(self):\n raise ...
python
chosen
[ { "from": "system", "value": "Add synchronization directory observer and handler" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Synchronization core module for Storj GUI Client #\n\n\nclass StorjFileSynchronization():\n def start_sync_thread(self):\n return 1\n\n def re...
python
chosen
[ { "from": "system", "value": "Replace unicode character for RPM build.\n\nTo make building RPMs of package easier when using ascii by\ndefault.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"OpenAPI core module\"\"\"\nfrom openapi_core.shortcuts import (\n create_spec, vali...
python
chosen
[ { "from": "system", "value": "Fix broken diagnostic dashboard with new sync progress values\n" }, { "from": "human", "value": "from django import template\nimport json\nregister = template.Library()\n\n\n@register.filter(name=\"format_meters\")\ndef meters_to_kms(value):\n try:\n retur...
python
chosen
[ { "from": "system", "value": "Add function to ResourceLoader for listing all block models\n\nxxx only lists Vanilla models. haven't looked at mods with models yet.\n" }, { "from": "human", "value": "\"\"\"\n ${NAME}\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, un...
python
chosen
[ { "from": "system", "value": "Exit with the proper value.\n\ngit-svn-id: a26c1b3dc012bc7b166f1b96505d8277332098eb@265 9ffc3505-93cb-cd4b-9e5d-8a77f6415fcf\n" }, { "from": "human", "value": "# Copyright 2007 Pompeu Fabra University (Computational Imaging Laboratory), Barcelona, Spain. Web: www.ci...
python
chosen
[ { "from": "system", "value": "Fix missing dependencies on core\n" }, { "from": "human", "value": "__author__ = 'Gareth Coles'\n\nimport weakref\n\n\nclass Info(object):\n\n data = None\n\n core = None\n info = None\n\n def __init__(self, yaml_data, plugin_object=None):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Add retry to celery task\n\nMessages do not always get delivered. Built in a retry when message is not sent.\r\nMax retry count could also be a setting." }, { "from": "human", "value": "from celery.task import task\nfrom .models import MailerMessage\n\n@task(name=\"...
python
chosen
[ { "from": "system", "value": "Write PID to a file\n" }, { "from": "human", "value": "from __future__ import (absolute_import, print_function, division)\nfrom itertools import repeat\nfrom mitmproxy.main import mitmdump\nimport os\n\nfrom . import (cli, proxyswitch, say)\n\ndef main():\n parse...
python
chosen
[ { "from": "system", "value": "Add proper banner to dev launch script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n # # #### ##### # # ##### # # # #\n # # # # # ## ## # # # ## # #\n ### #### #### # # # # # ...
python
chosen
[ { "from": "system", "value": "Remove empty line before class docstring\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Ethan Zimmerman\n# Copyright (c) 2014 Ethan Zimmerman\n#\n# License: MIT\n#\n\n\"\"...
python
chosen
[ { "from": "system", "value": "Remove oddity marker, it's been resolved in zeit.find now\n" }, { "from": "human", "value": "# Copyright (c) 2013 gocept gmbh & co. kg\n# See also LICENSE.txt\n\nimport grokcore.component as grok\nimport zeit.cms.browser.preview\nimport zeit.magazin.interfaces\n\n\n...
python
chosen
[ { "from": "system", "value": "Remove 'thunk' jargon from PythonExecutor\n" }, { "from": "human", "value": "import itertools\nfrom functools import partial\nimport math\n\nfrom typing import Any, Callable, Iterable\n\nfrom rechunker.types import CopySpec, StagedCopySpec, Executor\n\n\nThunk = Cal...
python
chosen
[ { "from": "system", "value": "Add a google search option\n" }, { "from": "human", "value": "from django.views import debug\n\n\ndef _patch_django_debug_view():\n\n new_data = \"\"\"\n <h3 style=\"margin-bottom:10px;\">\n <a href=\"http://stackoverflow.com/search?q=[python] o...
python
chosen
[ { "from": "system", "value": "Remove deprecated context client test\n" }, { "from": "human", "value": "from indra.databases import context_client\n\ndef test_get_protein_expression():\n res = context_client.get_protein_expression('EGFR', 'BT20_BREAST')\n assert(res is not None)\n assert...
python
chosen
[ { "from": "system", "value": "Simplify validate method in FormField." }, { "from": "human", "value": "from django.db import models\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom .backends import detect_backend, UnknownIdException, \\\n UnknownBacken...
python
chosen
[ { "from": "system", "value": "Add an exception to throw when a document does have the expected structure\n" }, { "from": "human", "value": "\"\"\"Extensions of standard exceptions for PyWXSB events.\n\nYeah, I'd love this module to be named exceptions.py, but it can't\nbecause the standard libra...
python
chosen
[ { "from": "system", "value": "Add pylint indentation check to sanity and fix existing indentation\nChange: 132840696\n" }, { "from": "human", "value": "# Copyright 2016 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may...
python
chosen
[ { "from": "system", "value": "Print something at the start\n" }, { "from": "human", "value": "from twisted.internet.endpoints import TCP4ServerEndpoint\nfrom twisted.internet import reactor\n\nimport editorFactory\n\nif __name__ == \"__main__\":\n server = editorFactory.EditorFactory()\n T...
python
chosen
[ { "from": "system", "value": "Update test and import errors\n" }, { "from": "human", "value": "import pytest\nimport numpy\n\nfrom ...neural._classes.model import Model\n\n\n\ndef test_mismatched_shapes_raise_ShapeError():\n X = numpy.ones((3, 4))\n model = Model(10, 5)\n with pytest.ra...
python
chosen
[ { "from": "system", "value": "Swap IndexError for AttributeError as a result of the swap from HVAD to MT\n" }, { "from": "human", "value": "__copyright__ = \"Copyright 2017 Birkbeck, University of London\"\n__author__ = \"Martin Paul Eve & Andy Byers\"\n__license__ = \"AGPL v3\"\n__maintainer__ ...
python
chosen
[ { "from": "system", "value": "Use custom decorator to allow ratelimiting only on successful POST - prevents blocking form errors\n" }, { "from": "human", "value": "__author__ = 'jvc26'\n" }, { "from": "gpt", "value": "from functools import wraps\n\nfrom ratelimit.exceptions import Ra...
python
chosen
[ { "from": "system", "value": "Add some nose.tools to testing imports." }, { "from": "human", "value": "\"\"\"The testing directory contains a small set of imaging files to be used\nfor doctests only. More thorough tests and example data will be stored in\na nipy-data-suite to be created later a...
python
chosen
[ { "from": "system", "value": "Fix email case issues when restoring user pointers.\n\n(imported from commit 84d3288dffc1cb010d8cd2a749fe71aa2a4d0df3)\n" }, { "from": "human", "value": "from optparse import make_option\nfrom django.core.management.base import BaseCommand\nfrom zephyr.models import...
python
chosen
[ { "from": "system", "value": "Enforce Python >= 3.4 on import of the package\n\nPython 3.4 is required for the pathlib module\n" }, { "from": "human", "value": "from .ignitiondelayexp import ExperimentalIgnitionDelay\nfrom .compare_to_sim import CompareToSimulation\nfrom .volume_trace import Vol...
python
chosen
[ { "from": "system", "value": "Remove unnecessary argument in test\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport pytest\n\nfrom ...symbols import POS, VERB, VerbForm_inf\nfrom ...tokens import Doc\nfrom ...vocab import Vocab\nfrom ...lemmatizer import Lemmatiz...
python
chosen
[ { "from": "system", "value": "Handle the case where the savefile already exists by moving it out of the way\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport randspectra as rs\nimport sys\nimport os.path as path\n\nsnapnum=sys.argv[1]\nsim=sys.argv[2]\n#base=\"/n/hernquistfs1/mv...
python
chosen
[ { "from": "system", "value": "Make fakefile a mock instead of an io object\n\nMakes it possible to mutate attributes, e.g. the name,\nfor tests\n" }, { "from": "human", "value": "\"\"\"Project-wide test configuration, including fixutres that can be\nused by any module.\n\nExample test: ::\n\n ...
python
chosen
[ { "from": "system", "value": "Add a context processor that adds the UserProfile to each context.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.sites.models import Site\nfrom settings import DeploymentType\n\ndef default(request):\n context = {}\n ...
python
chosen
[ { "from": "system", "value": "Test for property ten as well\n" }, { "from": "human", "value": "\"\"\"Test praw.util.cache.\"\"\"\n\nfrom .. import UnitTest\n\nfrom praw.util.cache import cachedproperty\n\n\nclass TestCachedProperty(UnitTest):\n class Klass:\n @cachedproperty\n d...
python
chosen