conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Read test data files from a remote URL.\n\nChanged\n-------\n* Instead of reading test netcdf files from a data directory in the repository, fetch them from a URL.\n" }, { "from": "human", "value": "import unittest\nimport os\n\nfrom cmt.printers.nc.read import fiel...
python
chosen
[ { "from": "system", "value": "Update view function to keep working even when moved to a package project structure\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask, send_file\napp = Flask(__name__)\n\n\n@app.route(\"/hello\")\ndef hello():\n return \"Hello World from Fla...
python
chosen
[ { "from": "system", "value": "Comment out t_shadow, t_stats, and t_circuitbreaker, at Flynn's behest\n" }, { "from": "human", "value": "from kat.harness import Runner\n\nfrom abstract_tests import AmbassadorTest\n\n# Import all the real tests from other files, to make it easier to pick and choos...
python
chosen
[ { "from": "system", "value": "Add Address model creation test case\n" }, { "from": "human", "value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n\"\"\...
python
chosen
[ { "from": "system", "value": "Make abnormal_exit docstring be in the imperative mood - pydocstyle\n" }, { "from": "human", "value": "\"\"\"Write data out to console.\"\"\"\n\nfrom __future__ import print_function\nimport sys\n\n\ndef abnormal_exit():\n \"\"\"Exits program under abnormal condi...
python
chosen
[ { "from": "system", "value": "Revert \"trying to fix statics issue\" - id didnt work\n\nThis reverts commit c1a0d920491358716315a8c6aeaa6ec475b37709.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom .base import * # noqa: ignore=F403\n\n\n# dev overrides\nDEBUG = ...
python
chosen
[ { "from": "system", "value": "admin_store: Remove deprecated fields from form\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder\nfrom Instanssi...
python
chosen
[ { "from": "system", "value": "Use placeholder for account sid :facepalm:\n" }, { "from": "human", "value": "# Download the Python helper library from twilio.com/docs/python/install\nfrom twilio.rest import Client\n\n# Your Account Sid and Auth Token can be found at https://www.twilio.com/console...
python
chosen
[ { "from": "system", "value": "Update client to receive packets larger than buffer\n" }, { "from": "human", "value": "import socket\nimport sys\n\n\ndef client(msg):\n client_socket = socket.socket(\n socket.AF_INET,\n socket.SOCK_STREAM,\n socket.IPPROTO_IP)\n client_s...
python
chosen
[ { "from": "system", "value": "Add without_fields method to API objects\n\nHelps with unit-testing Backslash - allowing more percise comparisons\n" }, { "from": "human", "value": "\nclass APIObject(object):\n\n def __init__(self, client, json_data):\n super(APIObject, self).__init__()\n...
python
chosen
[ { "from": "system", "value": "Fix mypy error: circular inheritance\n\nCloses #832, #833\n" }, { "from": "human", "value": "\nfrom ..filters import *\nfrom ..widgets import BooleanWidget\n\n\nclass BooleanFilter(BooleanFilter):\n def __init__(self, *args, **kwargs):\n kwargs.setdefault(...
python
chosen
[ { "from": "system", "value": "Update to make sure the auth date is on utc for time zone support on devices\n" }, { "from": "human", "value": "from django.contrib.auth.models import *\nfrom django.contrib.auth.backends import ModelBackend\nfrom django.utils.translation import ugettext_lazy as _\n...
python
chosen
[ { "from": "system", "value": "Read gray scale image with alpha channel\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# simple script to publish a image from a file.\nimport rospy\nimport cv2\nimport sensor_msgs.msg\n\n#change these to fit the expected topic names\nIMAGE_MESSAGE_TOPIC...
python
chosen
[ { "from": "system", "value": "Use search.rnacentral.org as the sequence search endpoint\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 ...
python
chosen
[ { "from": "system", "value": "Use agnostic protocol urls to support both http/https.\n" }, { "from": "human", "value": "# http://robohash.org/\n\nfrom django import template\nfrom md5 import md5\n\n\nregister = template.Library()\n\n\n@register.inclusion_tag(\"robotars/robotar.html\")\ndef robot...
python
chosen
[ { "from": "system", "value": "Update URL patterns for Django >= 1.8\n" }, { "from": "human", "value": "# pylint: disable=no-value-for-parameter\n\nfrom django.conf import settings\nfrom django.conf.urls import patterns, url, include\nfrom django.contrib import admin\nfrom django.views.generic im...
python
chosen
[ { "from": "system", "value": "Fix an error in production.\n" }, { "from": "human", "value": "import json\nimport requests\nimport subprocess\n\nfrom flask import Flask\nfrom flask import render_template\n\napp = Flask(__name__)\nconfig = {}\n\n\ndef shell_handler(command, **kwargs):\n return_...
python
chosen
[ { "from": "system", "value": "Handle error on download command\n" }, { "from": "human", "value": "# Copyright 2017-2018 TensorHub, Inc.\n#\n# 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 ...
python
chosen
[ { "from": "system", "value": "io: Add table of available plugins to module docstring.\n" }, { "from": "human", "value": "\"\"\"Utilities to read and write images in various formats.\"\"\"\n\nfrom _plugins import load as load_plugin\nfrom _plugins import use as use_plugin\nfrom _plugins import av...
python
chosen
[ { "from": "system", "value": "Update spectrogram plot file size\n" }, { "from": "human", "value": "from scikits.audiolab import Sndfile\nimport matplotlib.pyplot as plt\nimport os\n\ndt = 0.05\nFs = int(1.0/dt)\n\ncurrent_dir = os.path.dirname(__file__)\n\nfor (dirpath, dirnames, filenames) in o...
python
chosen
[ { "from": "system", "value": "Use the version number in pyproject.toml as the single source of truth\n\nFrom Python 3.8 on we can use importlib.metadata.version('package_name')\nto get the current version.\n" }, { "from": "human", "value": "\"\"\"Rename audio files from metadata tags.\"\"\"\n\ni...
python
chosen
[ { "from": "system", "value": "Add version check for incompatible Python 3.x/virtualenv 1.11 combination\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom __future__ import (absolute_import, division, print_function...
python
chosen
[ { "from": "system", "value": "Make cv path class attribute\n" }, { "from": "human", "value": "import os\n\nimport yaml\nfrom git import Repo\n\n\nclass GitCv:\n def __init__(self, cv_path, repo_path):\n self._cv = self._load_cv(cv_path)\n self._repo_path = os.path.join(repo_path...
python
chosen
[ { "from": "system", "value": "Fix quotation mark in docstring\n\nChange-Id: Ie9501a0bce8c43e0316d1b8bda7296e859b0c8fb\n" }, { "from": "human", "value": "# Copyright (c) 2015 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except...
python
chosen
[ { "from": "system", "value": "[IMP] sale_margin: Use odoo instead of openerp\n\nCloses #23451\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Part of Odoo. See LICENSE file for full copyright and licensing details.\n\nfrom functools import partial\nimport openerp\nfrom openerp impo...
python
chosen
[ { "from": "system", "value": "Remove unnesessary comments for learners\n" }, { "from": "human", "value": "# left out assignment for types_of_people mentioned in intro\ntypes_of_people = 10\n# change variable from 10 to types_of_people\nx = f\"There are {types_of_people} types of people.\"\n\nbin...
python
chosen
[ { "from": "system", "value": "Raise DRF ValidationError to get APIException base\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom apps.approval.models import CommitteeApplication, CommitteePriority\n\n\nclass CommitteeSerializer(serializers.ModelSerializer):\n ...
python
chosen
[ { "from": "system", "value": "Fix imports in tip migration script\n" }, { "from": "human", "value": "from gratipay.wireup import db, env\nfrom gratipay.models.team import migrate_all_tips\n\ndb = db(env())\n\nif __name__ == '__main__':\n migrate_all_tips(db)\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Fix formatting of error in venv_hook" }, { "from": "human", "value": "\"\"\"\nThis file serves as a hook into virtualenvs that do NOT have sitetools\ninstalled.\n\nIt is added to the $PYTHONPATH by the `dev` command so that new virtualenvs\ncan refer to the sitetool...
python
chosen
[ { "from": "system", "value": "Add simple unittest to test computer's strategy.\n" }, { "from": "human", "value": "from random import choice\n\nclass RPSGame:\n shapes = ['rock', 'paper', 'scissors']\n draws = [('rock', 'rock'), ('paper', 'paper'), ('scissors', 'scissors')]\n first_wins ...
python
chosen
[ { "from": "system", "value": "Add error if missing root\n" }, { "from": "human", "value": "import argparse\n\nfrom app import app\n\nparser = argparse.ArgumentParser()\nparser.add_argument('-d', '--debug', action='store_true', dest='debug', default=False)\nparser.add_argument('-p', '--port', act...
python
chosen
[ { "from": "system", "value": "Change keyword val to num" }, { "from": "human", "value": "# @file Contains Duplicate\n# @brief Given array of integers, find if array contains duplicates\n\n# https://leetcode.com/problems/contains-duplicate/\n\n'''\nGiven an array of integers, find if the array c...
python
chosen
[ { "from": "system", "value": "Remove the Ternary class from cgen wrapper\n\nThis is no longer required since we are not using preprocessor macros\nany more\n" }, { "from": "human", "value": "from cgen import *\nfrom codeprinter import ccode\nimport ctypes\n\n\nclass Ternary(Generable):\n def ...
python
chosen
[ { "from": "system", "value": "Remove test for not passing figure.\n\nThis will trigger matplotlib's backend detection, which won't work well\nfor us on Travis.\n" }, { "from": "human", "value": "import tempfile\nimport numpy as np\nfrom matplotlib.figure import Figure\nfrom matplotlib.backends.b...
python
chosen
[ { "from": "system", "value": "Fix repr to include args as kwargs.\n\nIt's a weird signature.\n" }, { "from": "human", "value": "class Stack(object):\n def __init__(self, stack=None):\n self.stack = stack if stack else []\n\n def push_frame(self, function_name, *args):\n self....
python
chosen
[ { "from": "system", "value": "Make fuzzer params somewhat more realistic (not so high)\n" }, { "from": "human", "value": "switch_failure_rate = 0.0\nswitch_recovery_rate = 0.0\ndataplane_drop_rate = 0.3\ncontrolplane_block_rate = 0.0\ncontrolplane_unblock_rate = 1.0\nofp_message_receipt_rate = 1...
python
chosen
[ { "from": "system", "value": "Add own hostname to /etc/hosts\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport os\n\nhostnames = eval(os.environ['hostnames'])\naddresses = eval(os.environ['addresses'])\n\ndef write_hosts(hostnames, addresses, file):\n f.write('DO NOT EDIT! THIS FILE ...
python
chosen
[ { "from": "system", "value": "Change file type to .roamer\n" }, { "from": "human", "value": "\"\"\"\nargh\n\"\"\"\n\nimport tempfile\nimport os\nfrom subprocess import call\n\nEDITOR = os.environ.get('EDITOR', 'vim')\n\nif EDITOR in ['vim', 'nvim']:\n EXTRA_EDITOR_COMMAND = '+set backupcopy=y...
python
chosen
[ { "from": "system", "value": "Enhance the habitica reset pipeline to reset all users\n\nAlso reset the last timestamp since we have deleted all points so we need to\nrestore all points.\nAlso restore their points with an optional argument. This is useful when the trips/sections are correct but the habitica ...
python
chosen
[ { "from": "system", "value": "Change class definitions from old style to new style\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import unicode_literals\n\nfrom ipaddress import ip_addr...
python
chosen
[ { "from": "system", "value": "Allow cookies and headers in response\n" }, { "from": "human", "value": "from functools import partial\n\n\ndef response(callback, method, url, body, status=200):\n from stubilous.config import Route\n callback(Route(method=method, path=url, body=body, status=...
python
chosen
[ { "from": "system", "value": "Fix plan details test name\n" }, { "from": "human", "value": "from changes.testutils import APITestCase\n\n\nclass PlanIndexTest(APITestCase):\n def test_simple(self):\n project1 = self.create_project()\n project2 = self.create_project()\n\n ...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Modify copy method into inherit\n" }, { "from": "human", "value": "from openerp import models, fields\n\n\nclass Course(models.Model):\n _name = 'openacademy.course'\n\n name = fields.Char(string='Title', required=True)\n description = fi...
python
chosen
[ { "from": "system", "value": "Update 'Bizarro' crawler to use msn.no instead of start.no\n" }, { "from": "human", "value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Bizarro'\n language = 'no...
python
chosen
[ { "from": "system", "value": "Call an update method to manage incoming jobs\n" }, { "from": "human", "value": "# Import third party libs\nimport urwid\n\n# Import sconsole libs\nimport sconsole.cmdbar\nimport sconsole.static\nimport sconsole.jidtree\n\nFOOTER = [\n ('title', 'Salt Console...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.2.4 with performance improvements in transmissivity code.\n" }, { "from": "human", "value": "__version__ = '0.2.3'\n\n# This list defines all the modules that will be loaded if a user invokes\n# from climLab import *\n\n# totally out...
python
chosen
[ { "from": "system", "value": "Fix tests to use httpbin.org, return always 200\n" }, { "from": "human", "value": "import unittest\nimport http.client\nimport time\n\nclass TestStringMethods(unittest.TestCase):\n\n def test_404NoConfig(self):\n connRouter = http.client.HTTPConnection(\"l...
python
chosen
[ { "from": "system", "value": "Add unittest for dashboard redirection and template\n\nTest that checks template rendered by /dashboard endpoint.\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.urls import resolve\n\n\nclass HomePageTest(TestCase):\n fixtures = ...
python
chosen
[ { "from": "system", "value": "Add new boolean field MetaBase.active\n" }, { "from": "human", "value": "import datetime as dt\n\nfrom comics.core.models import Comic\n\nclass MetaBase(object):\n # Required values\n name = None\n language = None\n url = None\n\n # Default values\n ...
python
chosen
[ { "from": "system", "value": "Use LRU cache to further improve search response times\n" }, { "from": "human", "value": "from flask import Flask, render_template, jsonify\n\n\napp = Flask(__name__)\n\n# Read in the entire wordlist at startup and keep it in memory.\n# Optimization for improving se...
python
chosen
[ { "from": "system", "value": "Add EscapeHtml function (need to change it to a class)\n" }, { "from": "human", "value": "\"\"\"Utilities for general operations.\"\"\"\n\n\ndef IsNumeric(num_str):\n try:\n val = int(num_str)\n except ValueError:\n return False\n else:\n ...
python
chosen
[ { "from": "system", "value": "Fix skip logic in SecureTransport tests" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport contextlib\nimport socket\nimport ssl\n\nimport pytest\n\ntry:\n from urllib3.contrib.securetransport import (\n WrappedSocket, inject_into_urllib3, ex...
python
chosen
[ { "from": "system", "value": "Remove unused UI event pipe\n" }, { "from": "human", "value": "import multiprocessing as mp\n\n\nclass UI:\n\n def __init__(self, game):\n parent_conn, child_conn = mp.Pipe(duplex=False)\n self.ui_event_pipe = parent_conn\n self.game = game\n...
python
chosen
[ { "from": "system", "value": "Add code to handle exception\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport click\nimport json\nimport sys\n\nfrom gblinks import Gblinks\n\ndef check_broken_links(gblinks):\n broken_links = gblinks.check_broken_links()\n\n if broken_link...
python
chosen
[ { "from": "system", "value": "Fix a bug in the tests.\n" }, { "from": "human", "value": "import StringIO\nimport unittest\n\nfrom testdoc.formatter import WikiFormatter\n\n\nclass WikiFormatterTest(unittest.TestCase):\n def setUp(self):\n self.stream = StringIO.StringIO()\n self...
python
chosen
[ { "from": "system", "value": "Replace url() with re_path() available in newer Django\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom django.contrib import admin\nfrom django.http import HttpResponse\n\n\nurlpatterns = [\n url(r'^$', lambda request, *args, **kwargs: H...
python
chosen
[ { "from": "system", "value": "Use regex rather than string match for Note:\n\nPer suggestion from @tadhg-ohiggins\n" }, { "from": "human", "value": "from regparser.tree.depth import markers as mtypes, optional_rules\nfrom regparser.tree.struct import Node\nfrom regparser.tree.xml_parser import (...
python
chosen
[ { "from": "system", "value": "Fix indentation to pass the tests\n" }, { "from": "human", "value": "import numpy as np\nimport glfw\n\ndef step_env(env, max_path_length=100, iterations=1):\n \"\"\"Step env helper.\"\"\"\n for _ in range(iterations):\n env.reset()\n for _ in ra...
python
chosen
[ { "from": "system", "value": "Use a better example error message\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"These JSON-formatted views require authentication.\"\"\"\n\nfrom flask import Blueprint, jsonify, request, current_app, g\nfrom werkzeug.exceptions import NotFound\n...
python
chosen
[ { "from": "system", "value": "Change euler integrator to return list, not array\n\nThe state of the system is a heterogeneous data type for some\napplications, so the array isn't appropriate.\n" }, { "from": "human", "value": "\"\"\"Code for manipulating expressions in matrix form\n\n .. modu...
python
chosen
[ { "from": "system", "value": "feature/oop-api-refactoring: Remove unused imports and `pass` keywords\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom typing import Union, Optional, Tuple\nfrom pathlib import Path\nfrom abc import ABC, abstractmethod\n\nfrom sklearn_porter.enums...
python
chosen
[ { "from": "system", "value": "Use with to open file in read_stru\n" }, { "from": "human", "value": "\"\"\"Theses functions read the legacy DISCUS stru file format in ASE Atoms.\"\"\"\n\nfrom __future__ import absolute_import\nfrom ase.atoms import Atoms\nfrom javelin.utils import unit_cell_to_ve...
python
chosen
[ { "from": "system", "value": "Remove an unnecessary blank line\n" }, { "from": "human", "value": "import foauth.providers\n\n\nclass MySpace(foauth.providers.OAuth1):\n # General info about the provider\n provider_url = 'http://www.myspace.com/'\n docs_url = 'http://developerwiki.myspac...
python
chosen
[ { "from": "system", "value": "Update tests for new default globals\n" }, { "from": "human", "value": "\nimport unittest\nimport cbs\n\n\nclass MySettings(cbs.GlobalSettings):\n PROJECT_NAME = 'tests'\n\n @property\n def TEMPLATE_LOADERS(self):\n return super(MySettings, self).TEM...
python
chosen
[ { "from": "system", "value": "Update parent package and version\n" }, { "from": "human", "value": "# fmt: off\n__title__ = \"spacy\"\n__version__ = \"3.0.0.dev14\"\n__release__ = True\n__download_url__ = \"https://github.com/explosion/spacy-models/releases/download\"\n__compatibility__ = \"https...
python
chosen
[ { "from": "system", "value": "Fix the runner test where it wasn't setting outdir.\n" }, { "from": "human", "value": "# Copyright (c) 2014, Matt Layman\n\nimport tempfile\nimport unittest\n\nfrom tap import TAPTestRunner\nfrom tap.runner import TAPTestResult\n\n\nclass TestTAPTestRunner(unittest....
python
chosen
[ { "from": "system", "value": "Make flake8 ignore the bg image.\n" }, { "from": "human", "value": "# from subtlepatterns.com\nbg = \"\"\"\\\niVBORw0KGgoAAAANSUhEUgAAABIAAAANCAMAAACTkM4rAAAAM1BMVEXy8vLz8/P5+fn19fXt7e329vb4+Pj09PTv7+/u7u739/fw8PD7+/vx8fHr6+v6+vrs7Oz2LjW2AAAAkUlEQVR42g3KyXHAQAwDQYAQ...
python
chosen
[ { "from": "system", "value": "Copy and call in-toto's check_usable_gpg function\n\nSet environment variable in test aggregate script that may be\nused to skip tests if gpg is not available on the test system.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\n<Program Name>\n a...
python
chosen
[ { "from": "system", "value": "Remove unneeded field specifier from EditPage form to make Django 1.8 happy\n" }, { "from": "human", "value": "from django.http import Http404\nfrom django.core.exceptions import PermissionDenied\nfrom django.views.generic import DetailView, TemplateView, UpdateView...
python
chosen
[ { "from": "system", "value": "Fix unit tests for CommandContainer\n" }, { "from": "human", "value": "import unittest\n\nimport MockMockMock\n\nfrom InteractiveCommandLine import *\n\nclass CommandLineCommandExecution( unittest.TestCase ):\n def setUp( self ):\n self.command = Command()...
python
chosen
[ { "from": "system", "value": "Add CBO column to cnes professional\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, String, func\nfrom app import db\n\nclass CnesProfessional(db.Model):\n __tablename__ = 'cnes_professional'\n year = Column(Integer, primary...
python
chosen
[ { "from": "system", "value": "Update the message in the default Python3.7 app\n\nto show Python3.7 instead of Python3.6\n" }, { "from": "human", "value": "def application(env, start_response):\n start_response('200 OK', [('Content-Type', 'text/html')])\n return [b\"Hello World from a defau...
python
chosen
[ { "from": "system", "value": "Improve custom appstats path normalization.\n" }, { "from": "human", "value": "\"\"\"Configuration.\"\"\"\n\nimport logging\nimport os\nimport re\n\nfrom google.appengine.ext.appstats import recording\n\nlogging.info('Loading %s from %s', __name__, __file__)\n\n# Cu...
python
chosen
[ { "from": "system", "value": "Fix import resources command line wrapper\n" }, { "from": "human", "value": "\"\"\"Import/create resources into the system.\n\nThis is registered as console script 'import_resources' in setup.py.\n\n\"\"\"\n# pragma: no cover\n\nimport argparse\nimport inspect\nimpo...
python
chosen
[ { "from": "system", "value": "Fix for old numpy versions without cbrt\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"A small module for computing the smoothing length of a Gadget/Arepo simulation.\"\"\"\n\nimport numpy as np\n\ndef get_smooth_length(bar):\n \"\"\"Figures ou...
python
chosen
[ { "from": "system", "value": "Add docstrings and fix failures\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\n\nfrom numba import types, typing\n\n\ndef is_signature(sig):\n return isinstance(sig, (str, tuple))\n\n\ndef normalize_signature(...
python
chosen
[ { "from": "system", "value": "Remove unused import in the example.\n" }, { "from": "human", "value": "from txpostgres import txpostgres\n\nfrom twisted.internet import reactor\nfrom twisted.python import log, util\n\n# connect to the database\nconn = txpostgres.Connection()\nd = conn.connect('db...
python
chosen
[ { "from": "system", "value": "Add a basic command line test\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport unittest\nimport pep438\n\n\nif __name__ == '__main__':\n unittest.main()\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport unittest\nimport sy...
python
chosen
[ { "from": "system", "value": "Add tasks and remove log from deployment serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import PRDeployment\n\n\nclass PRDeploymentSerializer(serializers.ModelSerializer):\n\n class Meta:\n model = PRDe...
python
chosen
[ { "from": "system", "value": "Add usage tests for check-ufo-sources and check-specification\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nimport pytest\n\n\ndef test_list_subcommands_has_all_scripts():\n \"\"\"Tests if the output from running `fontbakery --list-subcommand...
python
chosen
[ { "from": "system", "value": "Delete database support for repeated events.\n\nEvents already support multiple occurences, and we will create an\nAPI to automatically add occurences in a repeating manner (every week,\nevery month).\n\nIncluding event repeat data in database would make things a lot more\ncomp...
python
chosen
[ { "from": "system", "value": "Increment minor version to 0.8\n" }, { "from": "human", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.8a0'\n" }, { "from": "gpt", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebr...
python
chosen
[ { "from": "system", "value": "signals: Document the weird unused import for signal registration.\n" }, { "from": "human", "value": "\nimport logging\nfrom typing import Any, Dict\n\nfrom django.apps import AppConfig\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom dja...
python
chosen
[ { "from": "system", "value": "Add support for y field of a pv\n" }, { "from": "human", "value": "''' Representation of an element\n@param element_type: type of the element\n@param length: length of the element\n'''\nimport pkg_resources\nfrom rml.exceptions import ConfigException\npkg_resources....
python
chosen
[ { "from": "system", "value": "Fix default region feature computation plugin\n" }, { "from": "human", "value": "from pluginsystem import object_feature_computation_plugin\nimport vigra\nfrom vigra import numpy as np\n\nclass StandardObjectFeatures(object_feature_computation_plugin.ObjectFeatureCo...
python
chosen
[ { "from": "system", "value": "Add automatic searching capability.\nNote that camera may return different capabilities depending on its mode dial.\n" }, { "from": "human", "value": "import pysony\nimport fnmatch\n\ncamera = pysony.SonyAPI()\n#camera = pysony.SonyAPI(QX_ADDR='http://192.168.122.1:...
python
chosen
[ { "from": "system", "value": "Disable end-to-end tests for debugging (will re-enable later!)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# ----------------------------------------------------------------------------------------------\n# Created by: Lee & Matt\n#\n# Description: C...
python
chosen
[ { "from": "system", "value": "Use next to get the zone\n" }, { "from": "human", "value": "import os\nimport types\nfrom unittest import TestCase\n\nfrom yoconfigurator.base import read_config\nfrom yoconfig import configure_services\n\nfrom pycloudflare.services import CloudFlareService\n\napp_d...
python
chosen
[ { "from": "system", "value": "Handle just the zip file name when splitting\n\nThis fixes a bug where the zip file name isn't correctly handled when\nsplitting on the '.'. This causes a failure if passing a relative path\n(e.g '../'). Would also be a problem if directories had periods in their\nname.\n" },...
python
chosen
[ { "from": "system", "value": "Add links field and related methods to link to a given provider's preprints from the preprint provider serializer\n" }, { "from": "human", "value": "from rest_framework import serializers as ser\n\nfrom api.base.serializers import JSONAPISerializer\n\n\nclass Prepri...
python
chosen
[ { "from": "system", "value": "Fix Python 3 version detection in bunch\n" }, { "from": "human", "value": "import platform\n\n_IS_PYTHON_3 = (platform.version() >= '3')\n\nidentity = lambda x : x\n\n# u('string') replaces the forwards-incompatible u'string'\nif _IS_PYTHON_3:\n u = identity\nels...
python
chosen
[ { "from": "system", "value": "Fix test failure on Numpy 1.9 and Python 3.5\n\nThe \"@\" operator between arrays is only supported by Numpy 1.10+.\n" }, { "from": "human", "value": "import sys\n\ntry:\n import scipy.linalg.cython_blas\n has_blas = True\nexcept ImportError:\n has_blas = F...
python
chosen
[ { "from": "system", "value": "Use t=0.2 instead of t=0 for static widget output.\n" }, { "from": "human", "value": "\n\"\"\"\nAlternative interact function that creates a single static figure that can\nbe viewed online, e.g. on Github or nbviewer, or for use with nbconvert.\n\"\"\"\n\nfrom __fut...
python
chosen
[ { "from": "system", "value": ":bug: Set default ID field to AutoField\n\nResolves #168\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nclass AddressConfig(AppConfig):\n \"\"\"\n Define config for the member app so that we can hook in signals.\n \"\"\"\n\n na...
python
chosen
[ { "from": "system", "value": "Fix the admin creation command\n" }, { "from": "human", "value": "from freeposte import manager, db\nfrom freeposte.admin import models\n\n\n@manager.command\ndef flushdb():\n \"\"\" Flush the database\n \"\"\"\n db.drop_all()\n\n\n@manager.command\ndef ini...
python
chosen
[ { "from": "system", "value": "Replace partial with a function definition\n\nFix indentation, as well." }, { "from": "human", "value": "from chatty import create\nimport config\n\nfrom tornado.ioloop import PeriodicCallback, IOLoop\nfrom functools import partial\n\n\nif __name__ == \"__main__\":\...
python
chosen
[ { "from": "system", "value": "Convert run uuid to string\n" }, { "from": "human", "value": "import sys\nimport os\nimport uuid\nfrom time import sleep\n\nif len(sys.argv) != 3:\n print \"Wrong number of args\"\n exit(1)\n \nworkflow_name = sys.argv[1]\nnum_runs = int(sys.argv[2])\n\nfor...
python
chosen
[ { "from": "system", "value": "Test Post-Authentication Hook Process Works\n\nThis is my second system level test, and it's currently failing. My\nnext steps are to work on the integration test, followed by a slew\nof unit tests to start testing driving the final design of the\nprogram to handle this second,...
python
chosen
[ { "from": "system", "value": "FIx house meeting schema spring evals\n" }, { "from": "human", "value": "from flask import Blueprint\nfrom flask import render_template\nfrom flask import request\n\nspring_evals_bp = Blueprint('spring_evals_bp', __name__)\n\n@spring_evals_bp.route('/spring_evals/')...
python
chosen
[ { "from": "system", "value": "Change child_name to related field.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\r\n##############################################################################\r\n#\r\n# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)\r\n# Releas...
python
chosen