conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update a test for entering iframes and double-clicking\n" }, { "from": "human", "value": "from seleniumbase import BaseCase\n\n\nclass MyTestClass(BaseCase):\n\n def test_double_click(self):\n self.open(\"https://www.w3schools.com/jsref\"\n ...
python
chosen
[ { "from": "system", "value": "Add some useful read-only properties to Movie class\n" }, { "from": "human", "value": "\"\"\"Movie module for atamaTracker\n\"\"\"\n\nimport cv2\n\n\nclass Movie(object):\n \"\"\"Movie file object.\n \"\"\"\n\n def __init__(self, file_path):\n self._...
python
chosen
[ { "from": "system", "value": "Update the permission helper functions.\n" }, { "from": "human", "value": "def user_can_view_scans(user, moon):\n return (\n user_can_delete_scans(user, moon) or\n user.has_perm('eve_sde.can_view_scans', moon.planet.system) or\n user.has_perm...
python
chosen
[ { "from": "system", "value": "Improve list VMSS public IP example\n" }, { "from": "human", "value": "import azurerm\nimport json\nimport sys\n\n# check for single command argument \nif len(sys.argv) == 3:\n rg = sys.argv[1]\n vmss = sys.argv[2]\nelse:\n sys.exit('Expecting resource...
python
chosen
[ { "from": "system", "value": "Remove UserResource from the API and add ProjectResource.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom tastypie.api import Api\nfrom tracker.api import UserResource, TaskResource, WorkSessionResource, \\\n ApiTokenR...
python
chosen
[ { "from": "system", "value": "Check for an existing handler before registering default host-meta handler.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.db.models.signals import post_save\nimport mimetypes\nimport wellknown\n\n#\n# create default host-meta handler\n...
python
chosen
[ { "from": "system", "value": "Bump version number (so readthedocs picks it up).\n" }, { "from": "human", "value": "\"\"\"\n\"\"\"\n__version__ = '0.1'\n__release__ = '0.1a3'\n\ndef inject_app_defaults():\n \"\"\"\n Automatically inject the default settings for this app.\n \n If setti...
python
chosen
[ { "from": "system", "value": "Set a 1hr timeout for the update job\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nfrom redis import StrictRedis\nfrom rq import Queue\nfrom apscheduler.schedulers.blocking import BlockingSche...
python
chosen
[ { "from": "system", "value": "Fix Travis dependant build trigger\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nfrom click import echo\n\nfrom travispy import travispy\nfrom travispy import TravisPy\n\n\ndef main():\n\n restarted = []\n building = []\n\n for d...
python
chosen
[ { "from": "system", "value": "Order map by modified_at desc in list\n" }, { "from": "human", "value": "from django.views.generic import TemplateView\n\nfrom chickpea.models import Map\n\n\nclass Home(TemplateView):\n template_name = \"youmap/home.html\"\n list_template_name = \"chickpea/ma...
python
chosen
[ { "from": "system", "value": "Move utility function to migration\n" }, { "from": "human", "value": "# Generated by Django 3.0.6 on 2020-06-05 14:35\n\nfrom django.db import migrations\n\nfrom ..utils import get_countries_without_shipping_zone\n\n\ndef assign_countries_in_default_shipping_zone(ap...
python
chosen
[ { "from": "system", "value": "Fix `exitstatus` sometimes not provided\n" }, { "from": "human", "value": "from urllib.request import urlopen, URLError\n\ndef pytest_terminal_summary(terminalreporter, exitstatus): # pylint: disable=unused-argument\n _add_patterns()\n if exitstatus == 0:\n ...
python
chosen
[ { "from": "system", "value": "Add a comment explaining the purpose of the demultiplexer\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport json\nimport os\n\nimport boto3\n\nfrom wellcome_aws_utils import s3_utils, sns_utils\n\n\ndef main(event, _):\n print(f'event = {even...
python
chosen
[ { "from": "system", "value": "Mark rcm test as fast so it executes during build and test\n" }, { "from": "human", "value": "from __future__ import division\nimport numpy as np\nimport climlab\nimport pytest\n\n@pytest.fixture()\ndef rcm():\n # initial state (temperatures)\n state = climlab...
python
chosen
[ { "from": "system", "value": "Update gzip output for Python 3.8.2\n\nPython 3.8.2 includes a fix for https://bugs.python.org/issue39389.\nPreviously, the extra flags byte was always set to 0x02, claiming\nmaximum compression. It now reflects the actual compression setting.\nSince our default is neither fast...
python
chosen
[ { "from": "system", "value": "Remove prematurely inserted 'ready' method\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.apps import AppConfig\n\nfrom worker.utils import LircListener\n\n\nclass WorkerConfig(AppConfig):\n name = 'worker'\n\n def re...
python
chosen
[ { "from": "system", "value": "Insert customizable docstring at the beginning of settings file\n" }, { "from": "human", "value": "import collections\n\n\nclass Settings(object):\n def __init__(self):\n self._settings = collections.OrderedDict()\n\n def __setattr__(self, name, value):...
python
chosen
[ { "from": "system", "value": "Make the syft invocation only log the full output at spew level instead\nof debug.\n\nThe syft json output for very large images can be 100s of MB and\ncause the analyzer to be unusable due to the logging itself. This\nchanges that call to only dump output at \"spew\" level log...
python
chosen
[ { "from": "system", "value": "Add basic validation of ui state.\n" }, { "from": "human", "value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\n\nfrom PySide import QtGui\n\nfrom .selector import SelectorWidget\nfrom .options import...
python
chosen
[ { "from": "system", "value": "Add django_jenkins to installed apps\n" }, { "from": "human", "value": "from base import * # noqa\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': ':memory:',\n }\n}\nDEBUG = False\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Change cancel_invited_user client to not return anything.\n" }, { "from": "human", "value": "\nfrom notifications_python_client.base import BaseAPIClient\nfrom app.notify_client.models import User\n\n\nclass InviteApiClient(BaseAPIClient):\n def __init__(self, ba...
python
chosen
[ { "from": "system", "value": "Remove a reference to search.update\n" }, { "from": "human", "value": "import unittest\n\nfrom amqp import Message\nfrom mock import patch\nfrom sir.amqp.message import (InvalidMessageContentException,\n Message as PMessage,\n ...
python
chosen
[ { "from": "system", "value": "Fix typo resulting in NameError\n" }, { "from": "human", "value": "from functools import wraps\nimport subprocess\n\n\n_SELECTIONS = {\n '+': 'clipboard',\n '*': 'primary',\n}\n\n\ndef _store_selection(data, selection):\n with subprocess.Popen(['xclip',\n ...
python
chosen
[ { "from": "system", "value": "Use TAB instead of ;\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport sys\nimport serial\nimport datetime\n\nif __name__=='__main__':\n\ttry:\n\t\tser = serial.Serial('COM1', 115200, timeout=1)\n\t\tprint(\"opened \" + ser.portstr)\n\texcept serial....
python
chosen
[ { "from": "system", "value": "Test for sets, not dicts.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nThis module defines substantial HPACK integration tests. These can take a very\nlong time to run, so they're outside the main test suite, but they need to be\nrun before ev...
python
chosen
[ { "from": "system", "value": "Remove a test for removed features\n" }, { "from": "human", "value": "# Copyright 2013 Donald Stufft\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 copy ...
python
chosen
[ { "from": "system", "value": "Use num_leaves function in tests\n" }, { "from": "human", "value": "from viridis import tree\nfrom six.moves import range\n\nimport pytest\n\n@pytest.fixture\ndef base_tree():\n t = tree.Ultrametric(list(range(6)))\n t.merge(0, 1, 0.1)\n t.merge(6, 2, 0.2)\...
python
chosen
[ { "from": "system", "value": "Remove tests for response_time, update variable names\n" }, { "from": "human", "value": "import unittest\nfrom performance.web import Request, RequestTypeError, RequestTimeError\n\n\nclass RequestTestCase(unittest.TestCase):\n def setUp(self):\n self.url =...
python
chosen
[ { "from": "system", "value": "Remove config handling from threadmanager (was unused)\n" }, { "from": "human", "value": "import Queue\nimport signal\nimport threading\nimport time\n\n\nclass ThreadManager():\n \"\"\"Knows how to manage dem threads\"\"\"\n quit = False\n quitting = False\...
python
chosen
[ { "from": "system", "value": "Remove jtui blueprint specific error handler\n" }, { "from": "human", "value": "import logging\nfrom flask import Blueprint, current_app, jsonify\n\nfrom tmserver.error import register_http_error_classes\n\njtui = Blueprint('jtui', __name__)\n\nlogger = logging.getL...
python
chosen
[ { "from": "system", "value": "Support python3 and PEP8 rules.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# dp for Tornado\n# YoungYong Park (youngyongpark@gmail.com)\n# 2015.03.09\n#\n\n\nimport os\nimport sys\nimport inspect\nimport importlib\n\n\npath = os.path.d...
python
chosen
[ { "from": "system", "value": "Fix accidental import from other branch\n" }, { "from": "human", "value": "from .api import api\nfrom .auth import auth\nfrom .iiif import iiif\nfrom .view import view\n\n__all__ = [api, auth, iiif, view]\n" }, { "from": "gpt", "value": "from .api import...
python
chosen
[ { "from": "system", "value": "Remove remixmail from hosts for now\n" }, { "from": "human", "value": "# This file contains python variables that configure Lamson for email processing.\nimport logging\nimport pymongo\n\nhostnames = ['kasm.clayadavis.net', 'openkasm.com', 'remixmail.com']\n# You ma...
python
chosen
[ { "from": "system", "value": "Remove an import that deprecated and unused\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nfrom tabledata import (\n DataError,\n...
python
chosen
[ { "from": "system", "value": "Add message to user ban migration\n" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 1d91199c02c5\nRevises:\nCreate Date: 2017-05-01 23:02:26.034481\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision identifiers, used by A...
python
chosen
[ { "from": "system", "value": "Call the right method on the send_weekly_emails Command.\n" }, { "from": "human", "value": "# This file is part of OpenHatch.\n# Copyright (C) 2010 OpenHatch, Inc.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of th...
python
chosen
[ { "from": "system", "value": "Fix to make sanitize_examples() be able to sort tokens\n" }, { "from": "human", "value": "class Tokenizer:\n pass\n\n\nclass Token:\n def __init__(self, text, offset, data=None):\n self.offset = offset\n self.text = text\n self.end = offse...
python
chosen
[ { "from": "system", "value": "Fix import of error classes\n" }, { "from": "human", "value": "from functools import wraps\nfrom bs4 import BeautifulSoup as bs\n\nfrom errors import XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError,\n AlphanameError, TextError, In...
python
chosen
[ { "from": "system", "value": "Test average speed calculation by tracking sum and count separately\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport sys\nimport json\n\n# Count average speeds for links\n\ndef main(locationdata_dictionary_file):\n\n locationdata = {}\n with open(l...
python
chosen
[ { "from": "system", "value": "Add tests for rendering cms admin" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom djedi.tests.base import ClientTest\n\n\nclass PanelTest(ClientTest):\n\n def test_admin_panel(self):\n url = reverse('index')\n res...
python
chosen
[ { "from": "system", "value": "Add method to build a query string to every class\n" }, { "from": "human", "value": "class Base:\n\tdef __init__(self, client):\n\t\tself.client = client\n" }, { "from": "gpt", "value": "class Base:\n\tdef __init__(self, client):\n\t\tself.client = clien...
python
chosen
[ { "from": "system", "value": "Set default_app_config to point to the correct AppConfig\n" }, { "from": "human", "value": "import pkg_resources\n\n\n__version__ = pkg_resources.get_distribution(\"pinax-invitations\").version\n" }, { "from": "gpt", "value": "import pkg_resources\n\n\n_...
python
chosen
[ { "from": "system", "value": "Add some access function to inverted index\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# -*- coding: utf8 -*-\n\n# import\n\nclass InvertedIndex:\n\n def __init__(self):\n self.index = dict()\n\n def add_mail(self, mail):\n for k...
python
chosen
[ { "from": "system", "value": "Allow users to directly do from yubico_client import Yubico.\n" }, { "from": "human", "value": "__version__ = (1, 6, 3)\n" }, { "from": "gpt", "value": "__version__ = (1, 6, 3)\n\n__all__ = [\n 'Yubico'\n]\n\nfrom yubico_client.yubico import Yubico\n"...
python
chosen
[ { "from": "system", "value": "Update an example that uses the \":contains()\" selector\n" }, { "from": "human", "value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass ContainsSelectorTests(BaseCase):\r\n def test_contains_selector(self):\r\n self.open(\"https://xkcd.com/2207/\")\...
python
chosen
[ { "from": "system", "value": "Correct clearing of fanart cache\n" }, { "from": "human", "value": "import os,mc\nimport xbmc, xbmcgui\n\ndef fanart_function():\n if mc.ShowDialogConfirm(\"Clear fanart cache\", \"Are you sure you want to clear the fanart cache?\", \"Cancel\", \"OK\"):\n ...
python
chosen
[ { "from": "system", "value": "Make sure port is an int\n" }, { "from": "human", "value": "import socket\nimport os\n\ntry:\n from django.conf import settings\nexcept ImportError:\n settings = None\n\nfrom client import StatsClient\n\n\n__all__ = ['StatsClient', 'statsd']\n\nVERSION = (0, 4...
python
chosen
[ { "from": "system", "value": "Add two more arguments with function\n" }, { "from": "human", "value": "# File: prime_factors.py\n# Purpose: Compute the prime factors of a given natural number.\n# Programmer: Amal Shehu\n# Course: Exercism\n# Date: Monday 26 September 2016,...
python
chosen
[ { "from": "system", "value": "Change to use short flag for 2.4\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport warnings\nwarnings.filterwarnings('ignore', category=DeprecationWarning)\n\n\ndef test_for_version(filename):\n stdin, stdout = os.popen4('%s --version' %...
python
chosen
[ { "from": "system", "value": "Add dics to init for beamformer module\n" }, { "from": "human", "value": "\"\"\"Beamformers for source localization\n\"\"\"\n\nfrom ._lcmv import lcmv, lcmv_epochs, lcmv_raw\nfrom ._dics import dics_epochs\n" }, { "from": "gpt", "value": "\"\"\"Beamforme...
python
chosen
[ { "from": "system", "value": "Change to reflect recent API changes.\n" }, { "from": "human", "value": "\"\"\"\nEstimate pi using a Monte Carlo method with distarray.\nUsage:\n $ python pi_distarray.py <number of points>\n\"\"\"\nimport sys\nfrom distarray.client import RandomModule, Context\n...
python
chosen
[ { "from": "system", "value": "Make sure correct functions are imported\n" }, { "from": "human", "value": "from .configparser import JSONConfigParser\nfrom .utils import convert_input, dict_, list_, fieldtypes\nfrom .commands import view, add_file, add_field, delete, edit\n\nversion = '0.0.1'\n" ...
python
chosen
[ { "from": "system", "value": "Test suite seems to require ContentType to exist\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom os.path import dirname, abspath\n\nfrom django.conf import settings\n\nif not settings.configured:\n settings.configure(\n DATABASE_...
python
chosen
[ { "from": "system", "value": "Handle scientific notation in response\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport re\nfrom urllib import urlopen\n\n\napi = 'http://www.google.com/ig/calculator?hl=en&q={}{}=?{}'\n\n\ndef convert(value, src_units, dst_units):\n ...
python
chosen
[ { "from": "system", "value": "Drop H5 suffix for exceptions\n" }, { "from": "human", "value": "\n# Cython has limits on what you can declare inside control structures. This\n# native-Python module is a shim to allow things like dynamic class\n# definitions and functional closures.\n\ndef genera...
python
chosen
[ { "from": "system", "value": "Use run_module_suite instead of deprecated NumpyTest.\n\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@5310 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "import numpy as np\nfrom numpy.testing import *\n\nimport scipy.ndimage as nd...
python
chosen
[ { "from": "system", "value": "Add handling for duplicate keys in set; fix bug in hash function (was calling ord on key instead of character); change name of class to HashTable from Hash\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''Implementation of a simple hash table.\nThe tab...
python
chosen
[ { "from": "system", "value": "Add the python example ObjectDict\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom __future__ import absolute_import, unicode_literals, print_function, division\n\nimport sys\n\nif sys.version_info[0] < 3:\n PY3, Unicode, Bytes ...
python
chosen
[ { "from": "system", "value": "Add argparse for info on hb command\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .homebrew import HomeBrew\n\n\ndef main():\n HomeBrew().log_info()\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport argparse\n\nfrom ....
python
chosen
[ { "from": "system", "value": "Use a WORKSPACE to make life easier in Jenkins." }, { "from": "human", "value": "# Copyright (c) 2009-2012 Simplistix Ltd\n#\n# See license.txt for more details.\n\nfrom doctest import REPORT_NDIFF,ELLIPSIS\nfrom glob import glob\nfrom manuel import doctest, capture...
python
chosen
[ { "from": "system", "value": "Check that the priority order is respected if QT_API or USE_QT_API are not specified." }, { "from": "human", "value": "import os\n\n\ndef test_qt_api():\n \"\"\"\n If QT_API is specified, we check that the correct Qt wrapper was used\n \"\"\"\n\n from qt...
python
chosen
[ { "from": "system", "value": "Add import of with_setup that got lost in the numpy testing merge.\n\ngit-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@1236 ead46cd0-7350-4e37-8683-fc4c6f79bf00\n" }, { "from": "human", "value": "\"\"\"Simple utility to pull in all the testing functions we're li...
python
chosen
[ { "from": "system", "value": "Fix TZ-dependent return values from time_in_seconds()\n\ntime.mktime assumes that the time tuple is in local time, rather than UTC. Use\ncalendar.timegm instead for consistency.\n" }, { "from": "human", "value": "\"\"\"\nrandom utility functions\n\"\"\"\nimport date...
python
chosen
[ { "from": "system", "value": "Clean up API for main module\n" }, { "from": "human", "value": "from argparse import ArgumentParser\n\nfrom . import app\nfrom . import build\n\n\nparser = ArgumentParser()\nparser.add_argument('action', nargs='?', default='build',\n choices=['bui...
python
chosen
[ { "from": "system", "value": "Set name of stored file\n" }, { "from": "human", "value": "# sudo apt-get install python-scapy\nfrom scapy.all import *\n# sudo pip install scapy_http\nfrom scapy.layers import http\nfrom scapy.layers.http import HTTPResponse\nimport sys\n\npackets = rdpcap(\"task07...
python
chosen
[ { "from": "system", "value": "[Telemetry] Increase Kraken timeout to allow it to pass on Android.\n\nBUG=163680\nTEST=tools/perf/run_multipage_benchmarks --browser=android-content-shell kraken tools/perf/page_sets/kraken.json\n\n\nReview URL: https://chromiumcodereview.appspot.com/11519015\n\ngit-svn-id: de...
python
chosen
[ { "from": "system", "value": "Improve a script to test\n" }, { "from": "human", "value": "import unittest\nimport os\nimport time\nimport shutil\nimport filecmp\nimport base64\nimport glob\nimport json\n\nclass ScreenShotTest(unittest.TestCase):\n def test_screenshots(self):\n generate...
python
chosen
[ { "from": "system", "value": "Modify service_providers for dynamic columns\n\nRefs SH-64\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 li...
python
chosen
[ { "from": "system", "value": "Use smaller data sets for Kittydar.\n" }, { "from": "human", "value": "import sys, socket, time, logging\nimport shlex, subprocess\nfrom hdfs import *\n\nlogging.basicConfig()\n\nif len(sys.argv) < 4:\n print \"usage: napper_kittydar <job name> <worker ID> <executa...
python
chosen
[ { "from": "system", "value": "Delete wav files after processions\n" }, { "from": "human", "value": "import os\nimport logging\nimport gevent\nfrom flask import Flask, render_template, url_for, redirect\nfrom flask_sockets import Sockets\nimport io\nimport string\nimport random\n\napp = Flask(__n...
python
chosen
[ { "from": "system", "value": "Send SMS, only if there are notifications\n" }, { "from": "human", "value": "import sys,requests,configparser\n\ngithub_username = ''\ngithub_token = ''\nfree_user = ''\nfree_pass = ''\ndef loadConfig():\n config = configparser.ConfigParser()\n config.read('co...
python
chosen
[ { "from": "system", "value": "Add a warning about future versions dropping Py2 support\n\nRefs #64\n" }, { "from": "human", "value": "import logging\n\nimport click\n\nfrom valohai_cli.plugin_cli import RecursiveHelpPluginCLI\nfrom valohai_cli.table import TABLE_FORMATS, TABLE_FORMAT_META_KEY\n\...
python
chosen
[ { "from": "system", "value": "Add test templatetag image_url return\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom mock import patch\nfrom unittest import TestCase\nfrom django.template import Template, Context\n\n\nclass TestThumborURLTTagMock(TestCase):...
python
chosen
[ { "from": "system", "value": "Fix test not working on OS X.\n\ntest_run_in_directory_executes_command_in_directory() didn't take into account\nthat the directory returned by tempfile.mkdtemp() might be a symlink.\n" }, { "from": "human", "value": "import piquant.process as ps\nimport os.path\nim...
python
chosen
[ { "from": "system", "value": "Restructure transUnit class for better readibility\n" }, { "from": "human", "value": "#from lxml import etree as ET\n\n\nclass TransUnit(object):\n\n \"Container for XLIFF trans-unit element\"\n\n def __init__(self, argument):\n self.origin_unit = argum...
python
chosen
[ { "from": "system", "value": "Add quotes around date and time for python 2\n" }, { "from": "human", "value": "from django.db.backends.mysql.schema import DatabaseSchemaEditor \\\n as BaseDatabaseSchemaEditor\nimport sys\n\n\nclass DatabaseSchemaEditor(BaseDatabaseSchemaEditor):\n def execu...
python
chosen
[ { "from": "system", "value": "Add test for package commit\n" }, { "from": "human", "value": "from matador.commands import CreateTicket, CreatePackage\nfrom dulwich.repo import Repo\nfrom pathlib import Path\n\n\ndef test_add_to_git(project_repo):\n pass\n\n\ndef test_create_ticket(session, pr...
python
chosen
[ { "from": "system", "value": "Change booster default version (BO.V02)\n" }, { "from": "human", "value": "import os as _os\nfrom . import LI_V00\nfrom . import TB_V01\nfrom . import BO_V901\nfrom . import BO_V02\nfrom . import TS_V01\nfrom . import SI_V12\n\nfrom . import coordinate_system\n\nwit...
python
chosen
[ { "from": "system", "value": "[Discord] Use string methods for encode and decode caesar functions\n\nTo determine (in)valid characters to encode and decode\n" }, { "from": "human", "value": "\ndef encode_caesar(message, key):\n\tencoded_message = \"\"\n\tfor character in message:\n\t\tif not ('a...
python
chosen
[ { "from": "system", "value": "Add metadata to assignment notebook\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"nbcollate combines a set of Jupyter notebooks into a single notebook.\n\nCommand-line interface for nbcollate.\n\"\"\"\n\nimport argparse\nimport logging\nimport os\n...
python
chosen
[ { "from": "system", "value": "Sort datasets for index of HDF5 files\n" }, { "from": "human", "value": "import csv\nimport h5py\nimport sys\n\ndef hdf5_datasets(grp):\n \"\"\"Print CSV data of all datasets in an HDF5 file.\n\n path, shape, dtype\n \"\"\"\n writer = csv.writer(sys.stdo...
python
chosen
[ { "from": "system", "value": "Add comments summarizing changes in this version\n" }, { "from": "human", "value": "# __init__.py\n#__version__ = \"0.2.1\" # Initial version with installation package\n#__version__ = \"0.2.2\" # Updated README documentation for PyPI page\n#__version__ =...
python
chosen
[ { "from": "system", "value": "Add more roads on map\n" }, { "from": "human", "value": "import os\nimport sys\n\nPROJECT_ROOT = os.path.dirname(__file__)\nsys.path.insert(0, os.path.join(PROJECT_ROOT, 'vroom'))\n\nimport pygame\nimport math\n\nfrom world import Universe\n\n\n# Initialize pygame\n...
python
chosen
[ { "from": "system", "value": "CUDA: Fix simulator by adding missing USE_NV_BINDING to simulator\n" }, { "from": "human", "value": "'''\nMost of the driver API is unsupported in the simulator, but some stubs are\nprovided to allow tests to import correctly.\n'''\n\n\ndef device_memset(dst, val, s...
python
chosen
[ { "from": "system", "value": "Add clint to import paths\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom clint.arguments import Args\nfrom clint.textui import puts, colored\n\nall_args = Args().grouped\n\nfor item in all_args:\n if item is not '_':\n ...
python
chosen
[ { "from": "system", "value": "Create index mappings independently of index, just update settings?\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\n\nfrom elasticutils import get_es\nfrom pyelasticsearch.exceptions import IndexAlreadyExistsError, ElasticHt...
python
chosen
[ { "from": "system", "value": "Set action rules kind to 'on_time'" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2014 HBEE (http://www.hbee.eu)\n# @author: Paulius Sladkevičius <p...
python
chosen
[ { "from": "system", "value": "Add needed_reads method to avoid magic numbers\n" }, { "from": "human", "value": "from accelerator.tests.factories import (\n CriterionFactory,\n CriterionOptionSpecFactory,\n)\nfrom accelerator.tests.contexts.judge_feedback_context import (\n JudgeFeedback...
python
chosen
[ { "from": "system", "value": "Make talk status editale from the talk list overview\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom wafer.talks.models import Talk\n\n\nclass TalkAdmin(admin.ModelAdmin):\n list_display = ('corresponding_author', 'title', 'status')\n\...
python
chosen
[ { "from": "system", "value": "Add a from_message static method to StoredMessage, also an incomplete field\n" }, { "from": "human", "value": "import json\n\nfrom bot.action.core.command import UnderscoredCommandBuilder\nfrom bot.action.extra.messages import analyzer\nfrom bot.api.domain import Ap...
python
chosen
[ { "from": "system", "value": "Remove annoying logging in Router\n" }, { "from": "human", "value": "from threading import Thread\n\nimport zmq\nfrom logbook import Logger\n\n\nclass Router(Thread):\n \"\"\"Thread waiting for a request by another Driver and responding to\n it with the chunke...
python
chosen
[ { "from": "system", "value": "Fix boolean conversion of StackedObjectProxy in Python 3\n" }, { "from": "human", "value": "\nfrom paste.registry import StackedObjectProxy as PasteSOP\n\n\nclass StackedObjectProxy(PasteSOP):\n\n # override b/c of\n # http://trac.pythonpaste.org/pythonpaste/t...
python
chosen
[ { "from": "system", "value": "Add __contains__ for proper lookup in cache Engines class.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#-----------------------\n# Name: cache_engine.py\n# Python Library\n# Author: Raymond Wagner\n# Purpose: Base cache engine ...
python
chosen
[ { "from": "system", "value": "Implement rudimentary unit tests for logger class\n" }, { "from": "human", "value": "import pytest\nfrom mugloar import dragon, logger\n\n\n@pytest.fixture\ndef log_instance():\n \"\"\"Returns a Logger instance\"\"\"\n return logger.Logger()\n\n\n@pytest.fixtu...
python
chosen
[ { "from": "system", "value": "Make /home point to /.\n" }, { "from": "human", "value": "from flask import Module\n\nfrom cadorsfeed.views.util import render_file\n\nabout = Module(__name__)\n\n@about.route('/')\ndef homepage():\n return render_file('index.html')\n\n@about.route('/disclaimer')...
python
chosen
[ { "from": "system", "value": "Add Response class for unsupported media\n" }, { "from": "human", "value": "from django.http import HttpResponse\n\nclass HttpResponseCreated(HttpResponse):\n status_code = 201\n\nclass HttpResponseNoContent(HttpResponse):\n status_code = 204\n\nclass HttpResp...
python
chosen
[ { "from": "system", "value": "Check weakrefs to porst before using in destructor.\n\nPrevent raise of exception in case of connect deletion after block.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport ioport\nimport weakref\n\nclass Connection(object):\n \"\"\" Connection...
python
chosen
[ { "from": "system", "value": "Include one tank on player 1 on game creation\n" }, { "from": "human", "value": "import Queue\nimport json\n\nimport EBQP\n\nfrom . import world\n\n\nclass GameRequestHandler:\n def __init__(self):\n self.world = None\n self.responses = {\n ...
python
chosen
[ { "from": "system", "value": "Set default limit to 20 objects\n" }, { "from": "human", "value": "class Settings:\n ENDPOINT_URL = u'http://api.nasjonalturbase.no/'\n LIMIT = 50\n" }, { "from": "gpt", "value": "class Settings:\n ENDPOINT_URL = u'http://api.nasjonalturbase.no/...
python
chosen
[ { "from": "system", "value": "admin_upload: Delete old files when modified\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom django.contrib.auth.models import User\nfrom django.contrib import admin\nfrom Instanssi.kompomaatti.models import Event\nim...
python
chosen