conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a little file to test raw data (pixels) into MSSImage class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Test raw data with MSSImage class.\n\nimport sys\nfrom mss import MSSImage\n\n\nif len(sys.argv) < 4:\n\tprint('python... | python | chosen |
[
{
"from": "human",
"value": "Add an integration test for the `9k` shorthand\n"
},
{
"from": "gpt",
"value": "import tarfile\n\nfrom . import *\n\n\nclass Test9k(IntegrationTest):\n def __init__(self, *args, **kwargs):\n IntegrationTest.__init__(\n self, os.path.join(examples... | python | chosen |
[
{
"from": "human",
"value": "Add migration for previous commit\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('djconnectwis... | python | chosen |
[
{
"from": "human",
"value": "Test submit_pin method defined for a charge\n"
},
{
"from": "gpt",
"value": "import httpretty\n\nfrom paystackapi.tests.base_test_case import BaseTestCase\nfrom paystackapi.charge import Charge\n\n\nclass TestCharge(BaseTestCase):\n\n @httpretty.activate\n def ... | python | chosen |
[
{
"from": "human",
"value": "Add python example for downloading glm pojo.\n"
},
{
"from": "gpt",
"value": "import h2o\nh2o.init()\npath = h2o.system_file(\"prostate.csv\")\nh2o_df = h2o.import_file(path)\nh2o_df['CAPSULE'] = h2o_df['CAPSULE'].asfactor()\nbinomial_fit = h2o.glm(y = \"CAPSULE\", x... | python | chosen |
[
{
"from": "human",
"value": "Add tests for http response codes\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Tests API response codes.\"\"\"\n\nimport json\nfrom mock import patch\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add migration to reset osf_abstractprovider_id_seq...\n\n...and osf_abstractprovider_licenses_acceptable_seq.\n\nThese sequences got out of sync in the 0081 migration.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-04-1... | python | chosen |
[
{
"from": "human",
"value": "Resolve PID and get internal information\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nRetrieve pid information accessing the handle resolution system using HTTP\n\"\"\"\n\n__author__ = 'Roberto Mucci (r.mucci@cineca.it)'\n\n\nimport json\n#import... | python | chosen |
[
{
"from": "human",
"value": "Add decorator for basic auth with ApiUsers\n"
},
{
"from": "gpt",
"value": "import base64\nfrom corehq.apps.api.models import ApiUser\nfrom django.http import HttpResponse\n\n\ndef api_user_basic_auth(permission, realm=''):\n def real_decorator(view):\n def... | python | chosen |
[
{
"from": "system",
"value": "Fix case in nerd tree matcher regex\n\nFixes #1105\n"
},
{
"from": "human",
"value": "# vim:fileencoding=utf-8:noet\nfrom __future__ import (unicode_literals, division, absolute_import, print_function)\n\nimport os\nimport re\n\nfrom powerline.bindings.vim import bu... | python | chosen |
[
{
"from": "human",
"value": "Create individual student pie graph\n"
},
{
"from": "gpt",
"value": "from enum import IntEnum\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport sqlite3\n\nDB = 'db/development.sqlite3'\n\nStyle = IntEnum('Style', 'Contributor, Collaborator, Communicator, C... | python | chosen |
[
{
"from": "human",
"value": "Add sample code for returning all strings as unicode strings.\n\n\ngit-svn-id: b746c3c07d6b14fe725b72f068c7252a81557b48@133 0cf6dada-cf32-0410-b4fe-d86b42e8394d\n"
},
{
"from": "gpt",
"value": "#------------------------------------------------------------------------... | python | chosen |
[
{
"from": "human",
"value": "Add check for denizen labels\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"MAU109: Denizen labels.\n\n---\nlayout: post\nerror_code: MAU109\nsource: Garner's Modern American Usage\nsource_url: http://amzn.to/15wF76r\ntitle: denizen labe... | python | chosen |
[
{
"from": "human",
"value": "Add 'copied_to_following_framework' column to services\n\nWe need to keep track of whether a service has been copied to a\nfollowing framework during applications. Adding this column will allow\nthis.\n"
},
{
"from": "gpt",
"value": "\"\"\"add_copied_to_following_fra... | python | chosen |
[
{
"from": "human",
"value": "Add init of 0.25x0.25 climatefiles\n\nSo that we can more quickly hot-start newly added DEP regions..."
},
{
"from": "gpt",
"value": "\"\"\"When DEP expands, we have a problem that we have no close by precip files.\n\nSo lets ensure we have one file per 0.25 degree l... | python | chosen |
[
{
"from": "human",
"value": "Concatenate each line of the string\n"
},
{
"from": "gpt",
"value": "def main():\n s=raw_input()\n a=raw_input()\n b=raw_input()\n c=raw_input()\n x = (a,b,c)\n print s.join(x)\n\nmain()\n\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add script to make list of users + event types + event times\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nExtract the usernames from a JSON file, and write a file of those usernames + event type and event times\n\nGiven a file with a field marked '... | python | chosen |
[
{
"from": "human",
"value": "Break into a python interpreter from anywhere\n\nSummary:\nI use pdb a lot when debugging and I find it really annoying that we only get stack traces from errors on gunks. Wouldn't it be cool to be able to at least have access to an interpreter at the bottom of a stack trace? We... | python | chosen |
[
{
"from": "human",
"value": "Add a script to test that tests and modules in setup.py are up-to-date\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest that the installed modules in setup.py are up-to-date.\n\nIf this test fails, run\n\npython bin/generate_test_list.py\n\nand\n\npython bin/generate_mo... | python | chosen |
[
{
"from": "human",
"value": "Add Zenity-based user interface for SuperSAOP\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2018, CNRS-LAAS\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Quran Text models\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom model_mommy import mommy\n\nfrom ..models import Ayah\n\n\nclass SuraModelTest(TestCase):\n def setUp(self):\n self.sura = mommy.make('quran_text.sura'... | python | chosen |
[
{
"from": "human",
"value": "[crawler] Add script to do manual renames.\n"
},
{
"from": "gpt",
"value": "#!/opt/local/bin/python\nimport hashlib\nimport json\nimport os.path\nimport sys\nimport string\n\nfor i, line in enumerate(sys.stdin):\n (url, title, fileName1) = json.loads(line)\n page1 ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for neural net (I106).\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nimport numpy as np\n#import pandas as pd \n\ndef getdataset(myobj):\n if myobj.dataset == 'mnist':\n return getmnist()\n if myobj.dataset == 'dailymintemperatures'... | python | chosen |
[
{
"from": "human",
"value": "Add ZooKeeper support in kolla-ansible\n\nIn kolla-mesos, ZK will be used for storing information about\nactions done in bootstrap.\n\nChange-Id: Id7067a493b457cf7b73eb007852df7b13f4363b3\nPartially-Implements: blueprint zookeeper\n"
},
{
"from": "gpt",
"value": "#!/... | python | chosen |
[
{
"from": "human",
"value": "Tag an image based on detected visual content which mean running a CNN on top of it."
},
{
"from": "gpt",
"value": "import requests\nimport json\n\n# Tag an image based on detected visual content which mean running a CNN on top of it.\n# https://pixlab.io/#/cmd?id=ta... | python | chosen |
[
{
"from": "human",
"value": "Add a test for kcsapi_util.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport pytest\n\nimport kcsapi_util\n\n\nclass TestKCSAPIHandler(object):\n\n def pytest_funcarg__kcsapi_handler(self):\n return kcsapi_util.KCSAPIHandler(None, False)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add response time distributions from GIS.\n"
},
{
"from": "gpt",
"value": "# A dictionary where the key is an fdid-state and the values are lognormal fits generated\n# from response time gis data.\n\nresponse_time_distributions = {\n '37140-CA': (0.206110952263220... | python | chosen |
[
{
"from": "human",
"value": "Add module for converting heading node tuples to a dictionary\n\nThis could be stored in BaseLoader.py directly if that\nis a more logical location. It also could convert output\nof every Verto conversion, but currently is only called\nwhen needed.\n"
},
{
"from": "gpt",... | python | chosen |
[
{
"from": "human",
"value": "Add Api class with refresh token request\n"
},
{
"from": "gpt",
"value": "from devicehive.transport import Request\nfrom devicehive.transport import Response\n\n\nclass Api(object):\n \"\"\"Api class.\"\"\"\n\n def __init__(self, transport):\n self._tran... | python | chosen |
[
{
"from": "human",
"value": "Initialize Chapter 2 Practice Questions\n"
},
{
"from": "gpt",
"value": "# Chapter 2 Practice Questions\n# To check these questions, they should be entered in IDLE; otherwise\n# print statements would be needed.\n\n# 1. Which is the operator for division, / or \\?\n4... | python | chosen |
[
{
"from": "system",
"value": "Allow to be called from other directories.\n"
},
{
"from": "human",
"value": "import os\n\nimport pytest\n\n\n@pytest.fixture\n\ndef setup(request):\n def teardown():\n print(\"Running make clean\")\n os.system('make clean')\n print(\"Complet... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for programs\n"
},
{
"from": "gpt",
"value": "import unittest\nimport multiprocessing\nimport time\n\n\nclass TestPrograms(unittest.TestCase):\n\n def program_helper(self, func, params=dict()):\n self.process = multiprocessing.Process(target=... | python | chosen |
[
{
"from": "human",
"value": "Write Python Script for recipe creation\n\nSigned-off-by: Harsh Gupta <c4bd8559369e527b4bb1785ff84e8ff50fde87c0@gmail.com>\n"
},
{
"from": "gpt",
"value": "import argparse\nimport subprocess\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"package_list\",... | python | chosen |
[
{
"from": "human",
"value": "chromium: Add my script to generate the commit messages\n\nMight not be that readable and reliable but it should get the job done.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env nix-shell\n#!nix-shell -i python3 -p python3Packages.feedparser python3Packages.requests... | python | chosen |
[
{
"from": "human",
"value": "Add check remote upload example\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nfrom openload import OpenLoad\n\nusername = 'FTP Username/API Login'\nkey = 'FTP Password/API Key'\n\nopenload = OpenLoad(username, key)\nresp = openload.remote_... | python | chosen |
[
{
"from": "human",
"value": "Add script to move corrupt images\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Script to move corrupt images to 'dirty' directory\n \n Reads list of images to move. Does not verify that images are corrupt - \n Simply moves to 'dirty' directory of appropriate... | python | chosen |
[
{
"from": "human",
"value": "examples/hwapi: Add hwconfig for DragonBoard 410c.\n\nThis requires recently added implementation of machine.Pin from\nmicropython-lib.\n"
},
{
"from": "gpt",
"value": "from machine import Pin\n\n# 96Boards/Qualcomm DragonBoard 410c\n# By default, on-board LEDs are c... | python | chosen |
[
{
"from": "human",
"value": "Tweak volume commands and add k=v argparse action\n\nBasic cleanups:\n* change metadata to property\n* add new KeyValueAction to parse the property options\n* multiple properties can be set using multiple --property args\n* consistent formatting\n* do lookups for volume args\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script to find the next PR number for the changelog"
},
{
"from": "gpt",
"value": "import sys\nfrom github import Github\n\nif len(sys.argv) == 2:\n repository = sys.argv[1]\nelif len(sys.argv) > 2:\n print(\"Usage: next_pr_number.py <repository>\")\n ... | python | chosen |
[
{
"from": "human",
"value": "Include the migration this time :fireworks:\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 ('pr... | python | chosen |
[
{
"from": "human",
"value": "Add missing (meta) migration from previous commit\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 test for pifont.PiFontFontTools.get_contours_count method\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding: utf-8\n# Copyright 2013,2017 The Font Bakery Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice... | python | chosen |
[
{
"from": "human",
"value": "Add script for set spider env\n"
},
{
"from": "gpt",
"value": "#!/use/bin/env python3\nimport os\n\nos.system('mv report_spider report_spider_temp')\nos.system('scrapy startproject report_spider')\n\nos.chdir('./report_spider_temp')\nfor f in os.listdir():\n\tif os.p... | python | chosen |
[
{
"from": "human",
"value": "Add script to add missing arch to Wine scripts\n"
},
{
"from": "gpt",
"value": "import logging\nimport yaml\nfrom django.core.management.base import BaseCommand\nfrom games.models import Installer\n\nLOGGER = logging.getLogger(__name__)\n\n\nclass Command(BaseCommand... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 329. Longest Increasing Path in a Matrix\n\n329. Longest Increasing Path in a Matrix: https://leetcode.com/problems/longest-increasing-path-in-a-matrix/\n\nApproach 1:\n Topological sort and find the maximum chain length\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Use lazy translation for importer strings\n"
},
{
"from": "human",
"value": "from corehq.apps.data_interfaces.interfaces import DataInterface\nfrom django.utils.translation import ugettext as _\n\nclass ImportCases(DataInterface):\n name = _(\"Import Cases from E... | python | chosen |
[
{
"from": "human",
"value": "Test case using executors without Parsl\n"
},
{
"from": "gpt",
"value": "import time\r\n# from requests import get\r\n\r\nimport argparse\r\nimport parsl\r\n# from parsl.config import Config\r\n# from parsl.app.app import python_app\r\n# from parsl.executors import H... | python | chosen |
[
{
"from": "human",
"value": "Add a test for missing migrations\n"
},
{
"from": "gpt",
"value": "import StringIO\n\nfrom django.core.management import call_command\nfrom django.test import TestCase\n\n\nclass CommandsTestCase(TestCase):\n def test_no_missing_migrations(self):\n\n result... | python | chosen |
[
{
"from": "human",
"value": "digest: Add a management command to enqueue digest email recipients.\n\n(imported from commit 70ff2c7a4dae654f4077041c45e2154b3ac7afb7)\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nimport datetime\nimport pytz\n\nfrom django.core.managemen... | python | chosen |
[
{
"from": "human",
"value": "Add example for real device (iOS).\n"
},
{
"from": "gpt",
"value": "\"\"\"Be sure to use the latest selenium version\nas there might be some problems with JSON serialization\n\nBefore running the test make sure you started appium server\nwith TestApp app: grunt appiu... | python | chosen |
[
{
"from": "human",
"value": "Migrate remaining TEXT columns to LONGTEXT\n\nTo avoid cases where mysql silently truncates json data\nwhen it is > 2^16 bytes, migrate all remaining TEXT columns\nto LONGTEXT, in a similar way to the fix for bug #1210799\n\nCombined with the fix for bug #1215501 which limits th... | python | chosen |
[
{
"from": "human",
"value": "Upgrade database to add kernelspec column\n"
},
{
"from": "gpt",
"value": "\"\"\"add kernelspecs\n\nRevision ID: 50a4d84c131a\nRevises: b6d005d67074\nCreate Date: 2017-06-01 16:48:02.243764\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision id... | python | chosen |
[
{
"from": "human",
"value": "Add script to create csv for submissions\n"
},
{
"from": "gpt",
"value": "import argparse\nimport os\n\nimport caffe\nimport leveldb\nimport numpy as np\nimport pandas as pd\n\nimport dataset as data\n\nDFLT_INPUT = 'data/nn00/test_65001'\nHELP_INPUT = 'Fullpath of f... | python | chosen |
[
{
"from": "human",
"value": "Create python script to access bluemix object storage\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\nimport requests\n\nurl = 'https://lon-identity.open.softlayer.com/v3/auth/tokens'\nheaders={'Content-Type': 'application/json'}\ndata = '''{\n \"auth\": {\n ... | python | chosen |
[
{
"from": "human",
"value": "Create simple node to check start button state\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport gpio\nimport rospy\nimport time\nfrom std_msgs.msg import Bool\n\nCHANNEL = 395\ngpio.setup(CHANNEL, gpio.IN)\n\nif __name__ == '__main__':\n rospy.init_... | python | chosen |
[
{
"from": "human",
"value": "Add management command for repopulating subscriptions\n"
},
{
"from": "gpt",
"value": "from os import environ\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom registrations.models import Registration\nfrom registrations.tasks import valida... | python | chosen |
[
{
"from": "human",
"value": "Add basic char LCD example.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.\nimport math\nimport time\n\nimport Adafruit_CharLCD as LCD\n\n\n# Raspberry Pi pin configuration:\nlcd_rs... | python | chosen |
[
{
"from": "human",
"value": "Add an alembic migration script adding the `active` field to the filters table\n\nRelates to https://github.com/fedora-infra/fmn/issues/13\n"
},
{
"from": "gpt",
"value": "\"\"\"Add an active field to Filter\n\nRevision ID: 2ea9623b21fa\nRevises: 18ebf3181f87\nCreate... | python | chosen |
[
{
"from": "human",
"value": "Add a starter script for plotting marker trajectories approaching targets.\n"
},
{
"from": "gpt",
"value": "import climate\nimport itertools\nimport lmj.plot\nimport numpy as np\n\nimport source as experiment\nimport plots\n\n\n@climate.annotate(\n root='plot data... | python | chosen |
[
{
"from": "human",
"value": "Create an ASCII version of static catalog for Larry\n"
},
{
"from": "gpt",
"value": "from pymongo import MongoClient\n\npath = '/Users/willettk/Astronomy/Research/GalaxyZoo/rgz-analysis'\n\ndef load_data():\n\n client = MongoClient('localhost', 27017)\n db = cl... | python | chosen |
[
{
"from": "human",
"value": "Add filters for the buildsystem messages\n"
},
{
"from": "gpt",
"value": "\n\ndef buildsys_build_state_change(config, message):\n \"\"\" Buildsys: build changed state (started, failed, finished)\n\n TODO description for the web interface goes here\n \"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate custom loinc codes"
},
{
"from": "gpt",
"value": "import argparse\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--start\", type=int)\nparser.add_argument(\"--num\", type=int)\nparser.add_argument(\"--noX\", action=\"count\")\n\na... | python | chosen |
[
{
"from": "human",
"value": "Add tests for sandboxing utils.\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport unittest\n\nimport mock\n\nfrom st2common.util.sandboxing import get_sandbox_python_path\n\n\nclass SandboxingUtilsTestCase(unittest.TestCase):\n\n @mock.patch('st2commo... | python | chosen |
[
{
"from": "human",
"value": "Add fake MWS credentials pytest fixture\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n@pytest.fixture\ndef credentials():\n \"\"\"Fake set of MWS credentials\"\"\"\n return {\n \"access_key\": \"AAAAAAAAAAAAAAAAAAAA\",\n \"secret_key\": \"AA... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Click integration"
},
{
"from": "gpt",
"value": "import re\n\n\ndef test_simple(pyscript):\n script = pyscript(\"\"\"\n import click\n from daemonocle.cli import DaemonCLI\n\n @click.command(cls=DaemonCLI,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add case-insensitive index on PreregistrationUser.email.\n\nThis fixes a performance issue joining a server with a large number of\nusers.\n\nThanks to @dbiollo for the suggestion!\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unico... | python | chosen |
[
{
"from": "human",
"value": "Add tests for preparing filters"
},
{
"from": "gpt",
"value": "from main.tests.helper_methods import get_command_with_parsed_options\n\n\ndef test_prepare_package_filters_returns_none_when_no_package_filters():\n merge_coverage_files_command = get_command_with_par... | python | chosen |
[
{
"from": "human",
"value": "Add satori.core WSGI aplication file (belongs to 97b22ae4a25e, but forgot to add the file).\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nfrom django.core.wsgi import get_wsgi_application\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'satori.core.setti... | python | chosen |
[
{
"from": "human",
"value": "Send & receive files via ftp\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\tFile transfer protocol used to send and receive files using FTP server.\n\tUse credentials to provide access to the FTP client\n\n\tNote: Do not use root username & password for security reasons\... | python | chosen |
[
{
"from": "human",
"value": "Add failing tests for social handles\n"
},
{
"from": "gpt",
"value": "import core.tests.utils as test_utils\nfrom core import models\n\n\nclass WagtailCompanyPageTestCase(test_utils.WagtailTest):\n\n def test_twitter_handler(self):\n twitter_user = 'springl... | python | chosen |
[
{
"from": "human",
"value": "Add a script to check for repeated tokens.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n Checker for repeated tokens\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Helper script to find suspicious lexers which produce the same token\n repeatedly, i.... | python | chosen |
[
{
"from": "human",
"value": "Test immutability and deepcopy behavior.\n"
},
{
"from": "gpt",
"value": "import copy\n\nimport pytest\n\nfrom ..core import Document, NotMutable\n\n\ndef test_immutable():\n d = Document({'a': 1})\n with pytest.raises(NotMutable):\n # Update existing ke... | python | chosen |
[
{
"from": "human",
"value": "Add example for phase unwrapping.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n================\nPhase Unwrapping\n================\n\nSome signals can only be observed modulo 2*pi, and this can also apply to\ntwo- and three dimensional images. In these cases phase unwra... | python | chosen |
[
{
"from": "human",
"value": "Add convenience command for finding apiupdates to execute manually\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom stationspinner.accounting.models import APIUpdate, APICall\nfrom stationspinner.character.model... | python | chosen |
[
{
"from": "human",
"value": "Test fixture for API clients\n"
},
{
"from": "gpt",
"value": "import pytest, zerorpc\n\nfrom .base import TestDB\n\n@pytest.fixture(scope='session')\ndef api_client(config, request):\n test = TestDB()\n\n api_server_loc = config.get('API_SERVER_LOC')\n\n fro... | python | chosen |
[
{
"from": "human",
"value": "Write TestCase subclass that reads an example file\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for details.\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add a first test file\n\nTo be used with py.test\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport sfs\nimport pytest\n\n\nlinear_cases = [\n ((3, 1), [[-1, 0, 0], [0, 0, 0], [1, 0, 0]]),\n ((2, 1), [[-0.5, 0, 0], [0.5, 0, 0]]),\n ((1, 1), [[0, 0, ... | python | chosen |
[
{
"from": "human",
"value": "Add test for green query with gevent\n"
},
{
"from": "gpt",
"value": "import datetime\nimport unittest\n\nimport gevent\nimport gevent.socket\n\nimport pymssql\nfrom .helpers import pymssqlconn\n\n\nclass GreenletTests(unittest.TestCase):\n\n def greenlet_run(self... | python | chosen |
[
{
"from": "human",
"value": "Add naive context suppression script.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport numpy as np\nfrom tpn.data_io import tpn_test_iterator\nimport os\nimport cPickle\n\ndef parse_args():\n parser = argparse.ArgumentParser('Naive... | python | chosen |
[
{
"from": "human",
"value": "Add variants to clinical report script\n"
},
{
"from": "gpt",
"value": "\"\"\"Add variant report variants to a Clinical Report by ID.\n\"\"\"\n\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\nimport sys\nimport json\nimport argparse\n\n# Load en... | python | chosen |
[
{
"from": "human",
"value": "Add an example of automatically blurring faces in images or videos\n"
},
{
"from": "gpt",
"value": "import face_recognition\nimport cv2\n\n# This is a demo of blurring faces in video.\n\n# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed ... | python | chosen |
[
{
"from": "human",
"value": "Add management command for setting default value of send to dup number option\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom optparse import make_option\nfrom corehq.apps.domain.models import Domain\nfrom core... | python | chosen |
[
{
"from": "human",
"value": "Add example to test keep alive\n"
},
{
"from": "gpt",
"value": "\"\"\"\nExample that demonstrates/tests how objects survive synchronisation\njitter even if Python and JS are busy. We tried hard to make this\nas painless as possible in Flexx, which is why this example... | python | chosen |
[
{
"from": "human",
"value": "Add example of doing a 2-pass composite heatmap in Python.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#\n# Generates two heat maps from the same data and composites them together.\n#\n# Copyright 2022 Seth Golub http://www.sethoscope.net/heatmap/\n#\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add Decision Tree Regression in Python\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Decision Tree regression for machine learning.\n\nDecision tree builds regression or classification models in the form of a tree\nstructure. It brakes down a datase... | python | chosen |
[
{
"from": "human",
"value": "Add script to transform CountryTemplate legilation\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n''' xml_to_json_country_template.py : Parse XML parameter files for Country-Template and convert them to YAML files. Comments are NOT transformed.\n\nUsage ... | python | chosen |
[
{
"from": "human",
"value": "Add script to write CIViC VCF\n"
},
{
"from": "gpt",
"value": "from civicpy import civic\nfrom civicpy.exports import VCFWriter\nimport argparse\n\nparser = argparse.ArgumentParser(description='Create CIViC VCF')\nparser.add_argument('vcf_path')\nargs = parser.parse_... | python | chosen |
[
{
"from": "human",
"value": "Add example for LCD createChar\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom nanpy.lcd import Lcd\n\n\nif __name__ == '__main__':\n\n pins = [7, 8, 9, 10, 11, 12]\n cols, rows = 16, 2\n lcd = Lcd(pins, [cols, rows])\n \n smiley= [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add parse arguments test cases\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Command Line Interface test cases.\"\"\"\n\nimport os\nimport tempfile\nimport unittest\n\nfrom esis.cli import (\n clean,\n count,\n index,\n parse_arguments,\... | python | chosen |
[
{
"from": "human",
"value": "Add a new script to setup a win32 svn root\n"
},
{
"from": "gpt",
"value": "import os\r\nimport sys\r\n\r\nVERSION = '0.5.2'\r\n\r\ndef process_template(input, output=None, vardict={}):\r\n if output is None and input.endswith('.in'):\r\n output = input[:-3... | python | chosen |
[
{
"from": "human",
"value": "Clean up empty call to action blocks\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\ndef remove_empty_blocks(apps, schema_editor):\n CallToActionBlock = apps.get_mod... | python | chosen |
[
{
"from": "human",
"value": "Add stub for spike detection unit test\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom neuroanalysis.data import Recording, Trace\nfrom neuroanalysis.neuronsim.model_cell import ModelCell\nfrom neuroanalysis.units import pA, mV, MOhm, pF, us, ms\nfrom neuro... | python | chosen |
[
{
"from": "human",
"value": "Add simple Python Stress test script\n"
},
{
"from": "gpt",
"value": "__author__ = 'Frank'\n\nimport pycurl\nimport json\nfrom datetime import datetime, timezone, timedelta\nimport random\n\n\ntry:\n # python 3\n from urllib.parse import urlencode\nexcept Impo... | python | chosen |
[
{
"from": "human",
"value": "Add reached movebase goal desision\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement\n\n\nclass ReachedMovebaseGoalPosition(AbstractDecisionElement):\n def __init__(self, blac... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 725. Split Linked List in Parts\n\n725. Split Linked List in Parts: https://leetcode.com/problems/split-linked-list-in-parts/\n"
},
{
"from": "gpt",
"value": "# Definition for singly-linked list.\n# class ListNode(object):\n# def __init__(self... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the ignore-unknown-dependency command line option.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the ignore-unknown-dependency command line option.\n\"\"\"\n\nimport pytest\n\n\ndef test_no_ignore(ctestdir):\n \"\"\"No command line option, e.g. ignore... | python | chosen |
[
{
"from": "human",
"value": "Test for TUFTranslator and network call interposition\n"
},
{
"from": "gpt",
"value": "#Jerry B. backer\n#11/06/2012\n#test for TUFTanslator and libnit_lister\n#Uses test_simple server\nimport libnit_listener\nfrom tuf_api_translator import TUFTranslator\n\ndef main... | python | chosen |
[
{
"from": "human",
"value": "Add django task to link learning circles to teams\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom studygroups.models import StudyGroup\nimport requests\n\nclass Command(BaseCommand):\n help = 'Associate le... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 676. Implement Magic Dictionary\n\n676. Implement Magic Dictionary: https://leetcode.com/problems/implement-magic-dictionary/\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nclass Node(object):\n def __init__(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for importing the new categories from excel.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom cat.models import Category\n\nfrom openpyxl.reader.excel import load_workbook\n\ndef import_categories(fil... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.