conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Test Case for testing COMPOUNDS for singular_noun\n" }, { "from": "gpt", "value": "import unittest\r\nimport inflect\r\n\r\nclass test(unittest.TestCase):\r\n\tdef test_compound_1(self):\r\n\t\tself.assertEqual(p.singular_noun('hello-out-there'),'hello-out-there')\r\...
python
chosen
[ { "from": "human", "value": "Add init var opps package\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nVERSION = (0, 0, 1)\n\n__version__ = \".\".join(map(str, VERSION))\n__status__ = \"Development\"\n__description__ = u\"Opps CMS websites magazines and high-tr...
python
chosen
[ { "from": "system", "value": "Remove extraneous vim editor configuration comments\n\nChange-Id: I2fb6d6174cf8b73ee663efa6718f4358be673869\nPartial-Bug: #1229324\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Licensed under the Apache License, Version 2.0 (...
python
chosen
[ { "from": "human", "value": "Add a tool for provoking crosstalk glitches between channels\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Open Pixel Control client: Test crosstalk between LED strips;\n# send each strip a different pattern, use a lot of low-brightness\n# pixels so tha...
python
chosen
[ { "from": "human", "value": "Add test for provider(not finished)\n" }, { "from": "gpt", "value": "from mock import patch, MagicMock\nfrom workflow.steps.util.host_provider import Provider\nfrom physical.tests import factory as physical_factory\nfrom workflow.tests.test_host_provider import BaseC...
python
chosen
[ { "from": "human", "value": "Add skeleton file for Herd class\n" }, { "from": "gpt", "value": "\"\"\"Base class for a herd - a group of records\"\"\"\n\n\nclass Herd():\n \"\"\"You need:\n - validate names (check for commas, weird chars, convert to unicode/ascii?)\n * remove Mrs, Ph...
python
chosen
[ { "from": "human", "value": "Add functional tests for telemetry meter\n\nChange-Id: I409e92761a400e12558338e7cba9edacf0b57f13\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. Y...
python
chosen
[ { "from": "human", "value": "Add a script to dump out all project inter-dependencies.\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@296920 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "gpt", "value": "import os\r\nimport re\r\n\r\nfrom use_lldb_suite import lldb_root\r\n\r\nsrc...
python
chosen
[ { "from": "human", "value": "Add migration for update on fellow model\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-04-14 14:11\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mig...
python
chosen
[ { "from": "human", "value": "Disable minimap in Sublime Text 3.\n" }, { "from": "gpt", "value": "# -*- encoding: utf-8 -*-\n\nimport sublime\nimport sublime_plugin\n\nclass DisableMinimap(sublime_plugin.EventListener):\n\n def on_activated(self, view):\n view.window().set_minimap_visib...
python
chosen
[ { "from": "human", "value": "Add previously-missed placeholder Vector/Matrix code\n\nThis lets us use the read.py script without having to import the Blender\nmodule, at the moment. Importing should probably be kept separate from\nreading into blender, but it's convenient to share math structures if\npossib...
python
chosen
[ { "from": "system", "value": "Fix greenlet and essential objects startup order\n" }, { "from": "human", "value": "try:\n from gevent import monkey\nexcept ImportError:\n pass\nelse:\n monkey.patch_all()\n\nfrom tendrl.commons import CommonNS\n\nfrom tendrl.node_agent.objects.definition ...
python
chosen
[ { "from": "human", "value": "command: Create multiuse user invite generation command.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\n\nfrom typing import Any\n\nfrom argparse import ArgumentParser\nfrom confirmation.models import C...
python
chosen
[ { "from": "human", "value": "Delete courts with no cases.\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.9 on 2019-12-19 17:44\n\nfrom django.db import migrations\n\n\ndef delete_courts_without_cases(apps, schema_editor):\n CaseCourt = apps.get_model('main', 'CaseCourt')\n Case...
python
chosen
[ { "from": "human", "value": "ADD prod sale price by margin migration scripts\n" }, { "from": "gpt", "value": "# -*- encoding: utf-8 -*-\nfrom openerp import SUPERUSER_ID\nfrom openerp.modules.registry import RegistryManager\n\n\ndef copy_column(cr, model, table, target_field, source_field, condi...
python
chosen
[ { "from": "human", "value": "Add example building a subch network using the Library.linking_nuclei feature.\n" }, { "from": "gpt", "value": "# C-burning with A=23 URCA rate module generator\n\nimport pynucastro as pyna\nfrom pynucastro.networks import StarKillerNetwork\n\nlibrary_file = \"201802...
python
chosen
[ { "from": "human", "value": "Add a command to index peer records.\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\n\nimport logging\n\nfrom django.core.management.base import BaseCommand\n\nfrom peeringdb.api import PeeringDB\n\n\nclass Command(BaseCommand):\n help = ...
python
chosen
[ { "from": "human", "value": "Add preliminary Russian spelling definitions" }, { "from": "gpt", "value": "\ndef pl_1(order):\n \"\"\"2, 3, 4\"\"\"\n return (order == 'тысяча') and 'тысячи' or order + 'а'\n\ndef pl_2(order):\n \"\"\"5 и больше\"\"\"\n return (order == 'тысяча') and 'ты...
python
chosen
[ { "from": "human", "value": "brushlib: Add start of a Python/GI/GEGL-based example\n" }, { "from": "gpt", "value": "\n# from gi.repository import Gegl, GeglGtk3\nfrom gi.repository import MyPaint, MyPaintGegl\n\nif __name__ == '__main__':\n\n # Create a brush, load from disk\n brush = MyPa...
python
chosen
[ { "from": "human", "value": "ENH: Add test of AD_HDF5 handler.\n" }, { "from": "gpt", "value": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nimport six\nimport numpy as np\nimport h5py\nimport tempfile\nimport uuid\nimport mongo...
python
chosen
[ { "from": "system", "value": "Return the variant ID in the API\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom .models import Relation, Variant\n\n\nclass VariantSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Variant\n ...
python
chosen
[ { "from": "system", "value": "Disable SQL logging in appengine\n" }, { "from": "human", "value": "# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: dan@reciprocitylabs.com\...
python
chosen
[ { "from": "human", "value": "Add script for deleting all projects within a folder\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n# Copyright 2018 Google LLC\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": "human", "value": "Add a migration to change brief numberOfSuppliers to integer\n\nIf 'numberOfSuppliers' is a string parse the last number from the\nvalue and convert it to integer.\n" }, { "from": "gpt", "value": "\"\"\"Change numberOfSuppliers to integer\n\nRevision ID: 610\nRevises...
python
chosen
[ { "from": "human", "value": "Add test case for Presentation-Proposal connection.\n\nPresentation.proposal should return the specific class (Proposal) and\nnot ProposalBase.\n" }, { "from": "gpt", "value": "from symposion.conference.models import Section\nfrom symposion.proposals.models import Pr...
python
chosen
[ { "from": "human", "value": "tests: Add load test for the pascal voc 2012 dataset\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\"\nTest loading Pascal VOC 2012.\n\"\"\"\n\n\nfrom __future__ import print_function\nimport os\nimport dbcollection.manager as dbc\n\n# storage dir\nd...
python
chosen
[ { "from": "human", "value": "Add test for stdio transport\n" }, { "from": "gpt", "value": "import unittest\nimport io\nfrom .transports import StdioTransport\nimport time\n\n\ndef json_rpc_message(payload: str) -> bytes:\n content_length = len(payload)\n return b'Content-Length: ' + bytes(...
python
chosen
[ { "from": "human", "value": "feat: Merge prior product ids with orders ids first pass\n" }, { "from": "gpt", "value": "# importing modules/ libraries\nimport pandas as pd\nimport numpy as np\n\norders_prior_df = pd.read_csv('Data/orders_prior_sample.csv')\nprint('length of orders_prior_df:', len...
python
chosen
[ { "from": "human", "value": "Add tests for HSTS/HPKP functions\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom httpobs.scanner.analyzer.utils import *\n\n\nclass TestPreloadPublicKeyPinning(TestCase):\n def test_not_preloaded(self):\n result = is_hpkp_preloaded('...
python
chosen
[ { "from": "human", "value": "Add examples of API to export institutions\n" }, { "from": "gpt", "value": "#!/bin/python2.7\n# -*- coding: utf-8 -*-\n\"\"\"\nA tool to insert institutions from CSV files.\n\nRequirements:\n - requests\n - gusregon\n - unicodecsv\n - jmespath\n\nExample usage:\n\nTo...
python
chosen
[ { "from": "human", "value": "Add missing migration for Person.headshot\n" }, { "from": "gpt", "value": "# Generated by Django 2.1.9 on 2019-07-17 15:16\n\nimport django.core.files.storage\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = ...
python
chosen
[ { "from": "human", "value": "Implement management command for removing duplicate comments\n" }, { "from": "gpt", "value": "from datetime import timedelta\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCommand\nfrom django.db.models import Count\n\nfrom democracy...
python
chosen
[ { "from": "human", "value": "Add a script to process the team plans.\n\nIt can read the legacy json format and print the old overview.\nIt can also convert the legacy format to some more readeable.\n" }, { "from": "gpt", "value": "#!env python\n\nfrom argparse import ArgumentParser\nimport json\...
python
chosen
[ { "from": "human", "value": "Add migration that catches the donate app up\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.12 on 2017-03-24 16:03\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migration...
python
chosen
[ { "from": "human", "value": "Fix existing home page URIs with migration" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n def ensure_http_prefix_contact(ap...
python
chosen
[ { "from": "human", "value": "Update aliases migration for review change\n\nChange-Id: Ia0dca513f058d60c16fb2c6a41c766c99d0850d4\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.3 on 2016-11-24 13:29\nfrom __future__ import unicode_literals\n\nfrom django.db im...
python
chosen
[ { "from": "human", "value": "Add migration to update existing shipping zones\n" }, { "from": "gpt", "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_shippi...
python
chosen
[ { "from": "human", "value": "Add KMP string search algorithm implmentation\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\n\n\ndef build_next_arr(pattern_s):\n ps_len = len(pattern_s)\n nxt = [-1] * ps_len\n k = -1\n for i in range(1, ps_len):\n while k != -1 and patt...
python
chosen
[ { "from": "human", "value": "Add a script for doing basic maintenance on a private Docker Registry\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"A command-line client for the Docker registry.\"\"\"\n\nimport argparse\n\nimport requests\n\n\ndef list_cmd(args):\n \"\"\"List i...
python
chosen
[ { "from": "human", "value": "Add Campain & tag classes, created assembler package dir\n" }, { "from": "gpt", "value": "#\n# Copyright (C) 2015 Jonathan Finlay <jfinlay@riseup.net>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GN...
python
chosen
[ { "from": "human", "value": "Add placeholder unit tests for the thresholding methods.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy import testing\n\n# dyfunconn\nfrom dyfunconn.graphs import (threshold_mean_degree,\n thre...
python
chosen
[ { "from": "human", "value": "tests: Add feature test for when heap allocation is disabled.\n" }, { "from": "gpt", "value": "# check that we can do certain things without allocating heap memory\n\nimport gc\n\ndef f(a):\n print(a)\n\ndef g(a, b=2):\n print(a, b)\n\nglobal_var = 1\n\ndef h()...
python
chosen
[ { "from": "human", "value": "Add script to make speaker profiles public.\n" }, { "from": "gpt", "value": "# -*- coding: UTF-8 -*-\n\nfrom __future__ import print_function\nfrom django.core.management.base import BaseCommand\nfrom assopy import models as amodels\nfrom conference import models as ...
python
chosen
[ { "from": "human", "value": "Use hashed filename storage in attachment model" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-04-05 14:26\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport froide.foirequest.mod...
python
chosen
[ { "from": "human", "value": "Add example for remote image in ImageToTextTask\n" }, { "from": "gpt", "value": "import requests\nfrom os import environ\n\nfrom python_anticaptcha import AnticaptchaClient, ImageToTextTask\n\napi_key = environ['KEY']\n\nURL = 'https://raw.githubusercontent.com/ad-m/...
python
chosen
[ { "from": "human", "value": "Check out spaCy basic functionality\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Check basic SpaCy functionality.\"\"\"\n\n# set path to project -> change if needed\nproject_path = '/Users/EB/Google Drive/Projects/breweries'\n\n# modules\nimport pi...
python
chosen
[ { "from": "human", "value": "Add migration that allows product_class FK to be blank\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migr...
python
chosen
[ { "from": "human", "value": "Add MongoEngine to the pile.\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nimport re\nfrom mongoengine import connect\n\nfrom marrow.package.loader import load\nfrom web.core.compat import native, iteritems\n\n\nlog = __import__('logging').getLogger(__name__)...
python
chosen
[ { "from": "human", "value": "Add list known archives command\n" }, { "from": "gpt", "value": "import boto\nimport datetime\n\nfrom boto.dynamodb2.table import Table\nfrom boto.dynamodb2.table import HashKey\nfrom boto.dynamodb2.layer1 import DynamoDBConnection\n\nclass CommandListKnownArchivesFo...
python
chosen
[ { "from": "human", "value": "Add tempest API test for API version show\n\nThis patch add tempest API test for API version show.\n\nChange-Id: I1cf7cba550bb04629acab9899be310fd3b767576\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# ...
python
chosen
[ { "from": "human", "value": "Add a migration that Django detects as a change\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "human", "value": "Add a script that solves problem 9.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python -tt -Wall\n\nimport itertools\n\ndef main():\n\tk = 1000\n\tfactors = [4, 25]\n\tranges = (xrange(f, k/4, f) for f in factors)\n\tmultiples = itertools.ifilter(lambda m: not k%...
python
chosen
[ { "from": "human", "value": "Add functional test for Network Quota\n\ntest:\ntest_list\n\nChange-Id: Ie484bc8b36da22a2b3894efb35903ae04a78db7b\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance wi...
python
chosen
[ { "from": "human", "value": "Add a command to fix duplicate 'party:' IDs in the party JSON\n" }, { "from": "gpt", "value": "from collections import defaultdict\nimport json\nfrom os.path import join\nimport re\n\nfrom django.core.management.base import BaseCommand\n\nfrom candidates.static_data ...
python
chosen
[ { "from": "human", "value": "Test handling of zero-length typed lists. Currently fails.\n\n\ngit-svn-id: c4afb4e777bcbfe9afa898413b708b5abcd43877@930 7150bf37-e60d-0410-b93f-83e91ef0e581\n" }, { "from": "gpt", "value": "import sys\nsys.path.insert(1, \"..\")\nfrom SOAPpy import *\n\none = typed...
python
chosen
[ { "from": "human", "value": "[14.0][IMP] contract_sale_generation: Add tests with another recurrency\n" }, { "from": "gpt", "value": "# Copyright 2022 ACSONE SA/NV\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).\n\nfrom freezegun.api import freeze_time\n\nfrom odoo import field...
python
chosen
[ { "from": "human", "value": "Replace FTS functions since the FD table definition has changed.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependenc...
python
chosen
[ { "from": "human", "value": "Add a simple stupid test to just import the management command\n" }, { "from": "gpt", "value": "from easy_thumbnails.tests import utils as test\n\n\nclass ThumbnailCleanupTests(test.BaseTest):\n\n def test_can_import(self):\n \"\"\"\n Just a simple t...
python
chosen
[ { "from": "human", "value": "Add integration test for i19 screen using xia2 regression data\n" }, { "from": "gpt", "value": "from __future__ import division, absolute_import\n\nfrom i19.command_line.screen import i19_screen\n\ndef test_i19screen_command_line_help_does_not_crash():\n i19_screen(...
python
chosen
[ { "from": "human", "value": "Write test to confirm that makemessages works without needing postgres\n" }, { "from": "gpt", "value": "import os\nimport pathlib\nimport subprocess\n\nfrom django.conf import settings\nfrom django.test import TestCase\n\n\nclass MakeMessagesCommandRunTestCase(TestCa...
python
chosen
[ { "from": "human", "value": "Sort to-read list by publication date\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport logging\nimport re\nimport subprocess\nimport sys\nimport os\n\nimport calibre_config\nfrom calibre.library.database2 import LibraryDatabase2\nfrom calibre.utils.config...
python
chosen
[ { "from": "human", "value": "Make course ids and usage ids opaque to LMS and Studio [partial commit]\n\nThis commit adds custom mongoengine fields for CourseKeys and UsageKeys.\n\nThese keys are now objects with a limited interface, and the particular\ninternal representation is managed by the data storage ...
python
chosen
[ { "from": "human", "value": "Add migration to re-save all Tweets\n\nSo that the HTML version of their text uses the newer version of Twython\nwhich fixes some issues with entities in tweets.\n" }, { "from": "gpt", "value": "# Generated by Django 2.0.4 on 2018-04-16 11:44\n\nfrom django.db import...
python
chosen
[ { "from": "human", "value": "Add migration for help text for trigger models\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport fjord.base.models\n\n\nclass Migration(migrations.Migration):\n\n d...
python
chosen
[ { "from": "human", "value": "Add a stub for the file manager\n" }, { "from": "gpt", "value": "# Copyright 2011, The Board of Regents of Leland Stanford, Jr. University\n# All rights reserved. See LICENSE. \n# Author: Scott Williams <scottw@artesiancode.com>\n# Description: A shim over the filesy...
python
chosen
[ { "from": "human", "value": "Add script to drain all the work/production queues\n" }, { "from": "gpt", "value": "from helpers import client\n\nif __name__ == '__main__':\n scrape = client.queue('scrape')\n ingest = client.queue('ingest')\n complete = client.queue('completed')\n were_...
python
chosen
[ { "from": "human", "value": "Migrate the db to add search_export_history table\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.6 on 2019-12-16 13:40\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport uuid\n\n\nclass ...
python
chosen
[ { "from": "human", "value": "Add uprobe strlen histogram example\n\nThis example traces all calls to libc's strlen(). The program is attached as a\nretprobe, therefore giving access to the resulting string length. The value is\nkept in a log2 histogram that is printed to console once per second.\n\nExample:...
python
chosen
[ { "from": "human", "value": "Add migration for field length\n" }, { "from": "gpt", "value": "# Generated by Django 3.1.12 on 2021-08-02 11:40\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('fcm_django', '0005_auto_2017080...
python
chosen
[ { "from": "human", "value": "Add SQLAlchemy database access with models and serializers\n" }, { "from": "gpt", "value": "from database_access import guardeddatabase as gdb\nfrom serializers.alert import alert_schema\nfrom settings import DEFAULT_RADIUS\n\n\ndef get_alerts(*args, **kwargs):\n ...
python
chosen
[ { "from": "human", "value": "Move handler to connection handler\n" }, { "from": "gpt", "value": "from devicehive.handlers.base_handler import BaseHandler\nfrom devicehive.api import Api\n\n\nclass ConnectionHandler(BaseHandler):\n \"\"\"Connection handler class.\"\"\"\n\n def __init__(self...
python
chosen
[ { "from": "human", "value": "Add a CLI to call Eidos\n" }, { "from": "gpt", "value": "\"\"\"\nThis is a Python based command line interface to Eidos\nto complement the Python-Java bridge based interface.\nEIDOSPATH (in the INDRA config.ini or as an environmental variable)\nneeds to be pointing t...
python
chosen
[ { "from": "human", "value": "Add an animation generator script\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\r\n# coding: utf-8\r\n\r\n'''\r\nCreate a white noise animation like a TV screen\r\n'''\r\n\r\nimport numpy as np\r\nfrom PIL import Image\r\n\r\nwidth = 128\r\nheight = 96\r\nn_fra...
python
chosen
[ { "from": "human", "value": "Add script to compute sad and sar for conceptual sar figure\n" }, { "from": "gpt", "value": "import numpy as np\nimport csv\nimport sys\nimport os\nfrom math import exp\n\nimport mete\n\nif len(sys.argv) > 1:\n S0 = int(sys.argv[1])\n N0 = int(sys.argv[2])\n\ni...
python
chosen
[ { "from": "human", "value": "Add test script for checking to see if scrobbling works on new installs" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n##### CONFIG #####\n\nSERVER = \"turtle.libre.fm\"\nUSER = \"testuser\"\nPASSWORD = \"password\"\n\n\n##################\n\nimport gobble, ...
python
chosen
[ { "from": "human", "value": "Add tests for db hashing\n" }, { "from": "gpt", "value": "import hashlib\nfrom handler_fixture import StationHandlerTestCase\n\nfrom groundstation.transfer.request_handlers import handle_listdbhash\nfrom groundstation.transfer.response_handlers import handle_terminat...
python
chosen
[ { "from": "human", "value": "Add example code for finding all solutions.\n" }, { "from": "gpt", "value": "from __future__ import division, print_function\nfrom Numberjack import *\n\n\n# This example demonstrates finding all solutions to a given model.\n# solver.startNewSearch() should be called...
python
chosen
[ { "from": "human", "value": "Add fixed authentication key (with auth number) logic\n\nBased on django.core.signing.{loads,dumps}\n" }, { "from": "gpt", "value": "import zlib\n\nfrom django.core.signing import JSONSerializer, Signer, b64_decode, b64_encode\nfrom django.utils.encoding import force...
python
chosen
[ { "from": "human", "value": "Add a new SimProcedure stub Caller\n" }, { "from": "gpt", "value": "\nimport simuvex\n\n######################################\n# Caller\n######################################\n\n\nclass Caller(simuvex.SimProcedure):\n \"\"\"\n Caller stub. Creates a Ijk_Call ...
python
chosen
[ { "from": "human", "value": "Add command to list experiments\n" }, { "from": "gpt", "value": "from dj_experiment.models import Catalog\nfrom django.core.management.base import BaseCommand, CommandError\nfrom humanfriendly.tables import format_smart_table\n\n\nclass Command(BaseCommand):\n \"\...
python
chosen
[ { "from": "human", "value": "Add some end to end tests for jsexpose decorator edge cases.\n" }, { "from": "gpt", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional infor...
python
chosen
[ { "from": "human", "value": "Add script to generate a table of differences between Brython and CPython distributions\n" }, { "from": "gpt", "value": "# Generate list of modules in the standard distribution\n\nimport sys\nimport os\n\nif(sys.version_info[0]!=3):\n raise ValueError(\"This scrip...
python
chosen
[ { "from": "human", "value": "Add a klayout script to screenshot layouts\n" }, { "from": "gpt", "value": "import pya\nimport re\n\nWIDTH = 2048\nHEIGHT = 2048\n\napp = pya.Application.instance()\nwin = app.main_window()\n\n# Load technology file\ntech = pya.Technology()\ntech.load(tech_file)\nlay...
python
chosen
[ { "from": "human", "value": "Add unit test for tojson filter\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\nTests for salt.utils.jinja\n'''\n# Import Python libs\nfrom __future__ import absolute_import, unicode_literals, print_function\n\n# Import Salt libs\nimport salt.utils.jin...
python
chosen
[ { "from": "human", "value": "Add Py3 version of readme code\n" }, { "from": "gpt", "value": "# this is a Python3 version of the code in readme.py\n\nfrom twisted.internet.task import react\nfrom twisted.internet.defer import inlineCallbacks, ensureDeferred\nfrom twisted.internet.endpoints import...
python
chosen
[ { "from": "human", "value": "Use EN banners for events when available\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('api',...
python
chosen
[ { "from": "human", "value": "Add missing file from AVRO-1673.\n\ngit-svn-id: c07a28b12301a3ecdaa1125838bb8d44496e7ec7@1691208 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- mode: python -*-\n# -*- coding: utf-8 -*-\n\n# Licensed to the Apache ...
python
chosen
[ { "from": "human", "value": "Add quick and dirty script to measure tail latency.\n" }, { "from": "gpt", "value": "# Note that this is not a valid measurement of tail latency. This uses the execution times we measure because they're convenient, but this does not include queueing time inside BitFu...
python
chosen
[ { "from": "human", "value": "Add script for fixing OrderStatus identifiers\n\nAdd a tool to fix the identifiers of the OrderStatus objects, because\nthe default statuses might have been created with invalid identifiers\nbefore the default status data was fixed in the previous commit.\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Include Python 3.4 and 3.5" }, { "from": "human", "value": "from distutils.core import setup\n\nfrom jsonref import __version__\n\n\nwith open(\"README.rst\") as readme:\n long_description = readme.read()\n\n\nclassifiers = [\n \"Development Status :: 1 - Plan...
python
chosen
[ { "from": "human", "value": "Add json to yaml conversion script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport json\nimport argparse\nimport yaml\nfrom yaml import Loader, Dumper\nfrom pprint import pprint\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"-v\", \"--verbo...
python
chosen
[ { "from": "human", "value": "Add file missing from 948063a\n" }, { "from": "gpt", "value": "\"\"\"added provider column to users table\n\nRevision ID: 40f5c56adfee\nRevises: 407f7f23156f\nCreate Date: 2016-02-02 22:19:49.329707\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '4...
python
chosen
[ { "from": "human", "value": "Add search and replace python script\n\n[git-p4: depot-paths = \"//sw/gpgpu/thrust/\": change = 23090677]\n" }, { "from": "gpt", "value": "###########################################\n#\n# A basic search and replace on a text file\n#\n################################...
python
chosen
[ { "from": "human", "value": "Add base class for Flask tests\n" }, { "from": "gpt", "value": "# This file is part of Redmill.\n#\n# Redmill is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as published by\n# the Free Software F...
python
chosen
[ { "from": "human", "value": "Add converter from complex to Fortran-formated string\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom __future__ import division, print_function\n\n\ndef str_complex(c, kindstr=''):\n \"\"\"Converts the complex number `c` to a str...
python
chosen
[ { "from": "system", "value": "Remove suppression of GpuRasterization.BlueBox on Mac\n\nThe regressing CLs have been reverted.\n\nBUG=466690\n\nReview URL: https://codereview.chromium.org/1014503005\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#320789}\n" }, { "from": "human", ...
python
chosen
[ { "from": "human", "value": "Add script to import already downloaded videos into data file\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os\nimport os.path\nimport re\nimport sys\n\n# Ugly hack so we can import pytoutv_plus\nlib_path = os.path.abspath(os.path.join(os.path.dirn...
python
chosen
[ { "from": "human", "value": "Implement CUSIP task in Python\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport math\n\ndef cusip_check(cusip: str) -> bool:\n if len(cusip) != 9:\n raise ValueError('CUSIP must be 9 characters')\n\n cusip = cusi...
python
chosen
[ { "from": "system", "value": "Adjust test generator to make tests pass\n" }, { "from": "human", "value": "import nose\n\nfrom oscar.forms import widgets\n\n\ndef test_datetime_to_date_format_conversion():\n format_testcases = (\n ('%Y-%m-%d', 'yy-mm-dd'),\n ('%Y-%m-%d %H:%M', 'y...
python
chosen
[ { "from": "human", "value": "Add a migration for the recent change in User table\n\nCommit 850be15e7636 (\"Give a better user-facing name to hrid field\")\nmodified User.hrid name without adding a migration for it.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1...
python
chosen