conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix the one measly test\n" }, { "from": "human", "value": "def test_ensure_authority(manager_transaction):\n authority1 = manager_transaction.ensure_authority(\n name='Test Authority',\n rank=0,\n cardinality=1234\n )\n assert authority...
python
chosen
[ { "from": "system", "value": "Add in array or tuple of pins\n" }, { "from": "human", "value": "import RPi.GPIO as gpio\nimport time\n\n#use board numbering on the pi\n\ngpio.setmode(gpio.BOARD)\n\ngpio.setup(40, gpio.OUT)\ngpio.setup(38, gpio.OUT)\n\n#true and 1 are the same\ngpio.output(40, Tru...
python
chosen
[ { "from": "system", "value": "Annotate return types of Model properties\n" }, { "from": "human", "value": "import _pybinding\nfrom scipy.sparse import csr_matrix as _csrmatrix\n\n\nclass Model(_pybinding.Model):\n def __init__(self, *params):\n super().__init__()\n self.add(*par...
python
chosen
[ { "from": "system", "value": "Use a different method to override the url in SA\n\nThis is not an ideal solution, but seems to do the job. The problem with\nthe way it was previously was that it the /organisation/all route way\ngetting skipped as the /organisation/:slug route was always matching.\n" }, {...
python
chosen
[ { "from": "system", "value": "Add a huge hack to treat Decimals like floats\n\nThis commit provided to you by highly trained professional stuntmen,\ndo not try to reproduce any of this at home!\n" }, { "from": "human", "value": "from decimal import Decimal\nfrom django.http import HttpResponse\n...
python
chosen
[ { "from": "system", "value": "Fix sublime icon pathing by using \"/\" instead of os.path.join\n" }, { "from": "human", "value": "import sublime\n\nfrom os import path\n\n\n_plugin_name = \"Git Conflict Resolver\"\n_icon_folder = path.join(_plugin_name, \"gutter\")\n_icons = {\n \"ours\": \"ou...
python
chosen
[ { "from": "system", "value": "Remove unnecessary backslashes in parse_json_items\n" }, { "from": "human", "value": "import json\nimport ijson\n\n\nclass TimeSeriesJSON:\n\n def __init__(self, f=None, fn=None, tag='item'):\n \"\"\"\n :param f: file object (_io.TextIOWrapper)\n ...
python
chosen
[ { "from": "system", "value": "Fix bustage for script calls\n" }, { "from": "human", "value": "import argparse\nimport os\nimport json\nimport sys\n\ndef parse_args(argv):\n parser = argparse.ArgumentParser(\"Test\")\n parser.add_argument(\"--port\", \"-p\", type=int, default=8080, help=\"S...
python
chosen
[ { "from": "system", "value": "Add logic and code for database operations (untested)\n" }, { "from": "human", "value": "import discord\nfrom modules.botModule import BotModule\n\nclass Karma(BotModule):\n name = 'karma'\n\n description = 'Monitors messages for reactions and adds kar...
python
chosen
[ { "from": "system", "value": "Use proper q learning for agent.\n" }, { "from": "human", "value": "\"\"\"This is the agent which currently takes the action with highest immediate reward.\"\"\"\n\nimport env\nimport time\nenv.make(\"pygame\")\n\nfor episode in range(10):\n env.reset()\n epis...
python
chosen
[ { "from": "system", "value": "Update Graph class for loading saved models\nRequires renaming operations in models -> re-train them\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nLoading and using trained models from tensorflow\n\"\"\"\nimport tensorflow as tf\n\nclass Graph(...
python
chosen
[ { "from": "system", "value": "Add exception for interrupt data process\n" }, { "from": "human", "value": "\nclass DlstatsException(Exception):\n \n def __init__(self, *args, **kwargs):\n self.provider_name = kwargs.pop(\"provider_name\", None)\n self.dataset_code = kwargs.pop...
python
chosen
[ { "from": "system", "value": "Remove Request and Response classes\n" }, { "from": "human", "value": "def init(name, data_format_class, data_format_options, handler_class,\n handler_options):\n transport_class_name = '%sTransport' % name.title()\n transport_module = __import__('devi...
python
chosen
[ { "from": "system", "value": "Update to load dynamically the module selected by user.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n#-*- coding: utf-8 -*-\n\"\"\" This script is the launcher of the daemon.\n\"\"\"\n\nimport sys\nimport threading\n\nfrom core.daemonargs import parse_...
python
chosen
[ { "from": "system", "value": "Use the new links for websites (with odoo) and for the prestashop\nconnector\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: David BEAL, Copyright Akretion, 2...
python
chosen
[ { "from": "system", "value": "Fix how we calculate total to really account for deleted objects\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.core.exceptions import ValidationError\nfrom django.forms import BaseInlineFormSet, ModelForm\nfrom django.utils.transla...
python
chosen
[ { "from": "system", "value": "Fix order in icon preview.\n" }, { "from": "human", "value": "import os\nimport bpy\nimport bpy.utils.previews\nfrom .. import util\n\nasset_previews = bpy.utils.previews.new()\n\ndef load_previews(lib, start=0):\n global asset_previews\n enum_items = []\n\n ...
python
chosen
[ { "from": "system", "value": "Update redirect test to status 308\n" }, { "from": "human", "value": "from .helpers import BaseApplicationTest, BaseAPIClientMixin\n\n\nclass DataAPIClientMixin(BaseAPIClientMixin):\n data_api_client_patch_path = 'app.main.views.marketplace.data_api_client'\n\n\n...
python
chosen
[ { "from": "system", "value": "Add vgg16 trained_data to download\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom jsk_data import download_data\n\n\ndef main():\n PKG = 'jsk_apc2016_common'\n\n download_data(\n pkg_name=PKG,\n path='trained_data/vgg16_96000.ch...
python
chosen
[ { "from": "system", "value": "Add pre-release git paver task\n" }, { "from": "human", "value": "from paver.easy import *\n\n@task\ndef release_unix():\n sh('python setup.py clean')\n sh('rm -f h5py_config.pickle')\n sh('python setup.py build --hdf5-version=1.8.4 --mpi=no')\n sh('pyth...
python
chosen
[ { "from": "system", "value": "Use literals in tests instead of code ;)\n" }, { "from": "human", "value": "import unittest\nfrom square_grid import SquareGrid\n\nclass TestSquareGrid(unittest.TestCase):\n def setUp(self):\n a = [0] * 3\n b = [1] * 3\n c = [2] * 3\n ...
python
chosen
[ { "from": "system", "value": "Update status when stopping experiments\n" }, { "from": "human", "value": "from django.core.management import BaseCommand\n\nfrom experiments.models import Experiment\nfrom spawner import scheduler\nfrom spawner.utils.constants import ExperimentLifeCycle\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Address review comment: Just pass through fields we aren't changing.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nThis module defines the Eliot log events emitted by the API implementation.\n\"\"\"\n\n__a...
python
chosen
[ { "from": "system", "value": "Fix uniqueness for voting systems\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\nclass GlobalSettings(models.Model):\n\tDOMAIN_NAME = 'FQDN'\n\tFORCE_HTTPS = 'HTTPS'\n\tADMIN_MAIL = 'ADM_MAIL'\n\tADMIN_NAME = 'ADM_NA...
python
chosen
[ { "from": "system", "value": "Use compat.NUM_TYPES due to removal of long in py3k\n" }, { "from": "human", "value": "import statsd\nimport decimal\n\n\nclass Gauge(statsd.Client):\n '''Class to implement a statsd gauge\n\n '''\n\n def send(self, subname, value):\n '''Send the dat...
python
chosen
[ { "from": "system", "value": "Use the annotated steps from the dart dir\n\nTBR=whesse\n\nReview URL: https://codereview.chromium.org/352223009\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@280292 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "value": "#!/usr/bin/env pyt...
python
chosen
[ { "from": "system", "value": "Fix Sieve of Eratosthenes Overview header\n" }, { "from": "human", "value": "\"\"\"\n sieve_eratosthenes.py\n\n Implementation of the Sieve of Eratosthenes algorithm.\n\n Depth First Search Overview:\n ------------------------\n Is a simple, ancient a...
python
chosen
[ { "from": "system", "value": "Fix bad import on gauth_sql\n" }, { "from": "human", "value": "from djangae.contrib.gauth.common.backends import BaseAppEngineUserAPIBackend\n\n\nclass AppEngineUserAPIBackend(BaseAppEngineUserAPIBackend):\n pass\n" }, { "from": "gpt", "value": "from ...
python
chosen
[ { "from": "system", "value": "Stop auto creation of shm database\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# NAZS\n# Copyright (C) 2014 Carlos Pérez-Aradros Herce <exekias@gmail.com>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under t...
python
chosen
[ { "from": "system", "value": "Add a bit more info into the example plugin.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom client import slack_client as sc\n\nfor user in sc.api_call(\"users.list\")[\"members\"]:\n print(user[\"name\"], user[\"id\"])\n" }, ...
python
chosen
[ { "from": "system", "value": "Add queryset, but debate if better options\n" }, { "from": "human", "value": "from apis.betterself.v1.events.serializers import SupplementEventSerializer\nfrom apis.betterself.v1.utils.views import BaseGenericListCreateAPIViewV1\nfrom events.models import Supplement...
python
chosen
[ { "from": "system", "value": "Add files via upload\nRebase\n" }, { "from": "human", "value": "\"\"\"Utilities for asyncio-friendly file handling.\"\"\"\nfrom .threadpool import open\n\n__version__ = \"0.7.0dev0\"\n\n__all__ = [\"open\"]\n" }, { "from": "gpt", "value": "\"\"\"Utilitie...
python
chosen
[ { "from": "system", "value": "Change particle restart test to check for output on stderr rather than checking the return status.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom subprocess import Popen, STDOUT, PIPE\n\npwd = os.path.dirname(__file__)\n\ndef setup(): \n...
python
chosen
[ { "from": "system", "value": "Use only md5 to hash passwords when running tests\n" }, { "from": "human", "value": "# These settings will always be overriding for all test runs\n\nEMAIL_FROM_ADDRESS = 'doesnt@matter.com'\n" }, { "from": "gpt", "value": "# These settings will always be...
python
chosen
[ { "from": "system", "value": "Add a helper for retrieving the newest Tip.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Defines the model 'layer' for PyTips.\"\"\"\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import absolute...
python
chosen
[ { "from": "system", "value": "Throw Empty exception if BRPOP returns None.\nAdd priority argument so it works with the latest version.\n" }, { "from": "human", "value": "from Queue import Empty\n\nfrom redis import Redis\nfrom ghettoq.backends.base import BaseBackend\n\nDEFAULT_PORT = 6379\nDEFA...
python
chosen
[ { "from": "system", "value": "Add start of hook for extra jsbox endpoints.\n" }, { "from": "human", "value": "from go.vumitools.conversation.definition import (\n ConversationDefinitionBase, ConversationAction)\n\n\nclass ViewLogsAction(ConversationAction):\n action_name = 'view_logs'\n ...
python
chosen
[ { "from": "system", "value": "Implement the operating_system() method for Windows\n" }, { "from": "human", "value": "\"\"\"\nWindows platform support for running the application as a detached process.\n\n\"\"\"\nimport subprocess\nimport sys\n\nDETACHED_PROCESS = 8\n\n\nclass Daemon(object):\n ...
python
chosen
[ { "from": "system", "value": "Use the site that has scheme also input.\n" }, { "from": "human", "value": "try:\n from urllib.request import urlopen\nexcept ImportError:\n from urllib import urlopen\nimport datetime\nimport multiprocessing\n\nfrom django.conf import settings\nfrom django.co...
python
chosen
[ { "from": "system", "value": "Fix getClient bugs found by smoketest\n" }, { "from": "human", "value": "#\n# Copyright (c) 2008 rPath, Inc.\n#\n# This program is distributed under the terms of the Common Public License,\n# version 1.0. A copy of this license should have been distributed with this...
python
chosen
[ { "from": "system", "value": "flask: Configure webassets environment from app.config\n" }, { "from": "human", "value": "from flask import Flask, g\nfrom flask.ext.babel import Babel\nfrom flask.ext.assets import Environment\nfrom webassets.loaders import PythonLoader\nfrom skylines.lib import he...
python
chosen
[ { "from": "system", "value": "Add django backend for test settings" }, { "from": "human", "value": "import django.conf.global_settings as DEFAULT_SETTINGS\n\n\nSECRET_KEY = 'highlightjsisawesome'\n\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME...
python
chosen
[ { "from": "system", "value": "Add tests for pbias and nashsutcliffe\n" }, { "from": "human", "value": "import unittest\nfrom spotpy import objectivefunctions as of\nimport numpy as np\n\n#https://docs.python.org/3/library/unittest.html\n\nclass TestObjectiveFunctions(unittest.TestCase):\n\n #...
python
chosen
[ { "from": "system", "value": "Add stubs for handling requests to server.\n" }, { "from": "human", "value": "import json\nimport threading\nimport socket\nimport SocketServer\n\nfrom orderbook import match_bid, offers, asks\n\nmessages = []\n\n\nclass ThreadedTCPRequestHandler(SocketServer.BaseRe...
python
chosen
[ { "from": "system", "value": "Add decrypt helper to Entry\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom uuidfield import UUIDField\n\nfrom keybar.utils.crypto import encrypt, get_salt\n\n\nclass Entry(models.Model):...
python
chosen
[ { "from": "system", "value": "Fix indents for minimized JSON\n\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport abc\n\nfrom typing import Any\n\nfrom aiohttp import web\n\nfrom il2fb.ds.airbridge import json\n\n\nclass RESTResponse(web.Response, abc.ABC):\n detail = None\n\n @p...
python
chosen
[ { "from": "system", "value": "Add timeout to all tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright © Spyder Project Contributors\n# Licensed under the terms of the MIT License\n#\n\n\"\"\"\nFile for running tests programmatically.\n\"\"\"\n\n# Third party imports\n...
python
chosen
[ { "from": "system", "value": "Use bitwise operators on ordinals to reduce code size\n\nThe ASCII standard neatly organizes the characters in such a way\nthat it is easy to manipulate and classify them using bitwise\noperators.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\ndef shift(...
python
chosen
[ { "from": "system", "value": "Use transaction.atomic in batch uploader.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom pyaavso.formats.visual import V...
python
chosen
[ { "from": "system", "value": "Fix a derp on argparse\n" }, { "from": "human", "value": "__author__ = 'admiral0'\n\nfrom . import *\nfrom .Exceptions import JsonNotValid\nimport argparse\nimport os.path as path\n\n\ndef is_mod_repo(x):\n if path.isdir(x):\n return x\n raise argparse....
python
chosen
[ { "from": "system", "value": "[AC-5622] Move some code around because code climate said so\n" }, { "from": "human", "value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom impact.v1.views.base_list_view import BaseListView\nfrom impact.v1.views.post_mixin import PostMixin\nfrom...
python
chosen
[ { "from": "system", "value": "QtPrintSupport: Add tests for aliased methods\n" }, { "from": "human", "value": "import pytest\nfrom qtpy import QtPrintSupport\n\n\ndef test_qtprintsupport():\n \"\"\"Test the qtpy.QtPrintSupport namespace\"\"\"\n assert QtPrintSupport.QAbstractPrintDialog is...
python
chosen
[ { "from": "system", "value": "Sort languages by English name\n" }, { "from": "human", "value": "import subprocess\nimport re\nfrom collections import defaultdict\n\nauthors_by_locale = defaultdict(set)\n\nfile_listing = subprocess.Popen('find ../wagtail -iname *.po', shell=True, stdout=subproces...
python
chosen
[ { "from": "system", "value": "[tfdbg] Support enable_check_numerics() and enable_dump_debug_info() callback on TPUs\n\n- Skip a set of TPU compilation-specific ops from tfdbg's op callbacks.\n\nPiperOrigin-RevId: 281836861\nChange-Id: Ic7ff59a32eba26d5bb3ee2ac4f5f9166c78928c8\n" }, { "from": "human"...
python
chosen
[ { "from": "system", "value": "Update Solid pattern for refactor\n" }, { "from": "human", "value": "import blinkypattern\n\nclass Solid(blinkypattern.BlinkyPattern):\n def __init__(self, blinkytape, solid_color):\n super(Solid, self).__init__(blinkytape)\n self._pixels = [solid_c...
python
chosen
[ { "from": "system", "value": "Add regression test of warm fractions calculation\n" }, { "from": "human", "value": "import numpy as np\nfrom ..dark_model import dark_temp_scale\n\ndef test_dark_temp_scale():\n scale = dark_temp_scale(-10., -14)\n assert np.allclose(scale, 0.70)\n\n scale...
python
chosen
[ { "from": "system", "value": "Fix junit utf-8 output to file\n" }, { "from": "human", "value": "import json\nfrom junit_xml import TestSuite, TestCase\n\n\nclass JunitFormatter(object):\n\n def __init__(self, project_cfg, project_result):\n \"\"\"Initialize the stuff\"\"\"\n sel...
python
chosen
[ { "from": "system", "value": "Update \"Basic Instructions\" after feed change\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Basic Instructions...
python
chosen
[ { "from": "system", "value": "Add reply checks to the spam client too\n" }, { "from": "human", "value": "import socket\nimport sys\nimport time\n\nSERVER_HOST = 'localhost'\nSERVER_PORT = 40404\n\nsockets = []\nmsg = b'first message'\n\nfor i in range(20):\n sock = socket.socket(socket.AF_INE...
python
chosen
[ { "from": "system", "value": "Update command to save version in finstance\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom onadata.apps.fsforms.models import FInstance\n\n\nclass Command(BaseCommand):\n help = 'Set version in FInstance for given use...
python
chosen
[ { "from": "system", "value": "Fix typo in options serializer.\n" }, { "from": "human", "value": "from rest_framework import serializers\n\n\ndef validate_options(options, attributes):\n fields = {}\n\n for name, option in options.items():\n field_type = option.get('type', '')\n\n ...
python
chosen
[ { "from": "system", "value": "TEST - added more explicit tests for directory read\n" }, { "from": "human", "value": "\"\"\" Testing reading DICOM files\n\n\"\"\"\n\nimport numpy as np\n\nfrom .. import dicomreaders as didr\n\nfrom .test_dicomwrappers import (EXPECTED_AFFINE,\n ...
python
chosen
[ { "from": "system", "value": "Use NTv2 transform for Pyproj\n" }, { "from": "human", "value": "import numpy as np\nfrom pyproj import Proj, transform\n\n# London bounding box\nN = 51.691874116909894\nE = 0.3340155643740321\nS = 51.28676016315085\nW = -0.5103750689005356\n\nosgb36 = Proj(init='ep...
python
chosen
[ { "from": "system", "value": "Fix sorting of rooms in schedule\n" }, { "from": "human", "value": "from django.db.models import Case\nfrom django.db.models import IntegerField\nfrom django.db.models import Value\nfrom django.db.models import When\nfrom django.template import RequestContext\nfrom ...
python
chosen
[ { "from": "system", "value": "Add password handling to default factory.\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.test import TestCase\nimport factory\n\nfrom .models import Profile\n\n\nclass UserFactory(factory.Factory):\n FACTORY_FOR = User...
python
chosen
[ { "from": "system", "value": "Add smoke test for trim_spectrogram\n" }, { "from": "human", "value": "\"\"\"Test the utility function from spectral.\"\"\"\n\nimport numpy as np\nfrom numpy.testing import assert_equal\n\nfrom neurodsp.spectral.utils import *\n\n####################################...
python
chosen
[ { "from": "system", "value": "Add methods to change the beat and volume of tone\n" }, { "from": "human", "value": "from flask import Flask, url_for\napp = Flask(__name__)\n\n@app.route('/')\ndef api_root():\n\treturn 'Welcome'\n\n# Deprecated\n\n# @app.route('/toggle')\n# def api_toggle():\n# ...
python
chosen
[ { "from": "system", "value": "Load SVM pickle and print metrics\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nLoad a neural network model from a data frame\n\"\"\"\n\nimport pickle\n\nimport numpy as np\nimport pandas as pd\nfrom lasagne import nonlinearities\nfrom lasagne....
python
chosen
[ { "from": "system", "value": "Add default template creation into migration script\n" }, { "from": "human", "value": "\"\"\"Add templates\n\nRevision ID: 2b0edcfa57b4\nRevises: 24be36b8c67\nCreate Date: 2015-11-24 17:50:13.280722\n\n\"\"\"\n\nimport sqlalchemy as sa\nfrom alembic import op\n\n\n#...
python
chosen
[ { "from": "system", "value": "Make it possible to load questions\n" }, { "from": "human", "value": "def main():\n pass\n\nif __name__ == '__main__':\n main()\n\n" }, { "from": "gpt", "value": "from __future__ import with_statement\nimport yaml\n\ndef load_file(source):\n wit...
python
chosen
[ { "from": "system", "value": "Refactor timeline method call to use kwargs\n" }, { "from": "human", "value": "from __future__ import division, print_function\n\nimport datetime\n\nimport timeline\n\nfrom collections import *\n\ndef describe( data ):\n if len(data) == 0:\n print( \"Datas...
python
chosen
[ { "from": "system", "value": "Put CWD at start of sys.path\n" }, { "from": "human", "value": "\"\"\"\nPython testing for humans.\n\nUsage: pspec [<path>...]\n\nOptions:\n -h --help show this\n\"\"\"\n\nfrom attest.hook import AssertImportHook\nfrom docopt import docopt\nimport os\nimport sys...
python
chosen
[ { "from": "system", "value": "Add equality operator to FWInfo\n" }, { "from": "human", "value": "\"\"\"FW records\n\n\"\"\"\n\nclass FWInfo(object):\n \"\"\"Object to hold device-reported SPI flash table\"\"\"\n\n def __str__(self):\n return \"%s | %s | %s | %s | %s\" % (self.slot, ...
python
chosen
[ { "from": "system", "value": "Revert \"Declare scipy as dep\"\n\nThis reverts commit 1e8bc12e0a6ea2ffefe580b63133b88f4db045a7.\n" }, { "from": "human", "value": "\n\"\"\"\nCartoDB Spatial Analysis Python Library\nSee:\nhttps://github.com/CartoDB/crankshaft\n\"\"\"\n\nfrom setuptools import setup...
python
chosen
[ { "from": "system", "value": "Make python2-urllib2 compatible with more Python 2.7 versions\n\nTry to catch ssl.CertificateError only if CertificateError is\ndefined. Otherwise bail out by effectively doing a dummy\n\"catch ():\".\n" }, { "from": "human", "value": "import sys\nimport ssl\nimport...
python
chosen
[ { "from": "system", "value": "Add function to run rfsearch on the cluster\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2019] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance wit...
python
chosen
[ { "from": "system", "value": "tests/negation: Replace with an Hypothesis test\n" }, { "from": "human", "value": "import pytest\n\nfrom ppb_vector import Vector2\n\n\nnegation_data = (\n (Vector2(1, 1), Vector2(-1, -1)),\n (Vector2(2, -3), Vector2(-2, 3)),\n (Vector2(-4, 18), Vector2(4, ...
python
chosen
[ { "from": "system", "value": "Add logger to env loader\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# MIT Licensed, Copyright (c) 2016 Ryan Scott Brown <sb@ryansb.com>\n\nfrom dotenv import load_dotenv, get_key, set_key, unset_key\n\nfrom cfn_detect import load_cfn_outputs\n\ndef ...
python
chosen
[ { "from": "system", "value": "Fix endpoint for clone operation\n" }, { "from": "human", "value": "from fuelclient.commands import base\nfrom fuelclient.commands import environment as env_commands\nfrom fuelclient.common import data_utils\n\n\nclass EnvClone(env_commands.EnvMixIn, base.BaseShowCo...
python
chosen
[ { "from": "system", "value": "Fix sdk module all declaration\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom ddsc.sdk.client import Client\n__all__ = [Client]\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom ddsc.sdk.client...
python
chosen
[ { "from": "system", "value": "Remove obsolete aliases and imports\n" }, { "from": "human", "value": "from types import TracebackType\nfrom typing import \\\n Callable, Tuple, Dict, Any, Iterable, Sequence, Mapping, Optional, Type\n\nfrom werkzeug.wrappers import Request\n\n# (name, value)\nHe...
python
chosen
[ { "from": "system", "value": "Update for Python 3 encoding\n\nFixes https://github.com/cranklin/crankycoin/issues/12" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport hashlib\nfrom getpass import getpass\nimport sys\nfrom Cryptodome.Cipher ...
python
chosen
[ { "from": "system", "value": "Add automated 'gm compare' invocation\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os;\nimport glob;\nimport re as regex;\n\ntestDirectory = \"./test/\";\n\ndef readMarkupFile(markupFilename):\n f = open(markupFilename, 'r');\n markup = f.read(...
python
chosen
[ { "from": "system", "value": "Fix a formatting error in print_error_and_die().\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nimport os, shutil\n\ndef print_warning(message, *args, **kwargs):\n import colortext\n if args or kwargs: message = message.format(*args, **kwargs)\n ...
python
chosen
[ { "from": "system", "value": "Add geodata parsing to sample city file\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\n\n# The URL for the page where the parking lots are listed\ndata_url = \"http://example.com\"\n\n# Name of the city, just in case it contains umlauts which this...
python
chosen
[ { "from": "system", "value": "Add non-dangerous debugging option to config\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport urllib\n\n\n# -----------------------------\n# RENAME THIS FILE TO config.py\n# -----------------------------\n\n\n# Flask debug mode. Always set False on...
python
chosen
[ { "from": "system", "value": "Use a Mixin for Admin inlines; less code duplication.\n" }, { "from": "human", "value": "import warnings\n\nfrom django.contrib import admin\n\nfrom .forms import TranslationFormSet\nfrom . import settings\n\n\nclass TranslationStackedInline(admin.StackedInline):\n ...
python
chosen
[ { "from": "system", "value": "Add group list command to docs\n" }, { "from": "human", "value": "import argparse\n\nfrom boarbot.common.log import LOGGER\n\nclass GroupsParserException(Exception): pass\n\nclass GroupsParser(argparse.ArgumentParser):\n def exit(self, status=0, message=None):\n ...
python
chosen
[ { "from": "system", "value": "Fix exception type in a test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom blox.file import File\nfrom pytest import raises_regexp\n\n\nclass TestFile(object):\n def test_mode(self, tmpfile):\n raises_regexp(ValueError, 'invalid mode',...
python
chosen
[ { "from": "system", "value": "Update samples creation for intent rename\n\nUpdate intent --> task, code comment" }, { "from": "human", "value": "# Download the helper library from https://www.twilio.com/docs/python/install\nfrom twilio.rest import Client\n\n# Your Account Sid and Auth Token from...
python
chosen
[ { "from": "system", "value": "Use `exec` instead of `execfile`.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"Wrapper to run setup.py using setuptools.\"\"\"\n\ni...
python
chosen
[ { "from": "system", "value": "Fix verdict field max length\n" }, { "from": "human", "value": "from models.basemodel import BaseModel\nfrom peewee import CharField, DateTimeField\n\nALLOWED_VERDICTS = (\n 'NOT_AN_EXPL',\n 'VIOLATION',\n 'NOT_IMPRESSED',\n 'GOOD',\n 'EXACT',\n)\n\n\...
python
chosen
[ { "from": "system", "value": "Set resu dir and data dir\n" }, { "from": "human", "value": "import synthetic_data_experiments as sde\nimport logging\n\nif __name__ == \"__main__\":\n args = sde.get_integrous_arguments_values()\n\n" }, { "from": "gpt", "value": "import synthetic_dat...
python
chosen
[ { "from": "system", "value": "Add OAuth authentication and config settings load/save\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\nfrom __future__ import print_function\nimport os\nimport sys\nimport argparse\nimport logging\n" }, { "from": "gpt", "value": "#!/usr/bin/...
python
chosen
[ { "from": "system", "value": "Fix tests for new deployment\n" }, { "from": "human", "value": "import requests\nimport unittest\nfrom flask_app import app\nfrom config import configobj\n\nclass TestCase(unittest.TestCase):\n def setUp(self):\n super(TestCase, self).setUp()\n self...
python
chosen
[ { "from": "system", "value": "Fix RuleTestCase -> tests passing\n" }, { "from": "human", "value": "import unittest\nfrom framework.routing import Rule\n\n\nclass RuleTestCase(unittest.TestCase):\n\n def _make_rule(self, **kwargs):\n def vf():\n return {}\n\n return Ru...
python
chosen
[ { "from": "system", "value": "Add comment to prompt changing of pepper\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2015, 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ...
python
chosen
[ { "from": "system", "value": "Put a blank line before section headings, courtesy spiv.\n" }, { "from": "human", "value": "\"\"\"Formatters for creating documents.\n\nA formatter is an object which accepts an output stream (usually a file or\nstandard output) and then provides a structured way fo...
python
chosen
[ { "from": "system", "value": "Change over to local email server in production\n" }, { "from": "human", "value": "from local_settings import *\n\nDEBUG = False\n\nALLOWED_HOSTS = ['uchicagohvz.org']\n\nADMINS = (\n ('Administrator', 'admin@uchicagohvz.org'),\n)\nSERVER_EMAIL = 'noreply@uchicag...
python
chosen
[ { "from": "system", "value": "Add a message with a socket on server start\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport subprocess\nimport sys\n\n\ndef main():\n ip = '127.0.0.1'\n port = 5000\n workers_count = 4\n if len(sys.argv) > 1:\n for arg in sys.arg...
python
chosen