conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add NewsChooserBlock for choosing news items in StreamFields\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.utils.functional import cached_property\nfrom wagtail.wagtailcore.blocks import ChooserBlock\n\n\ncla...
python
chosen
[ { "from": "human", "value": "Add migration to set UserProfilesSettings correctly\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom molo.profiles.models import UserProfilesSettings\n\nfrom wagtail.wagtailc...
python
chosen
[ { "from": "human", "value": "Fix: Merge migrations file to resolve conflicts\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.20 on 2019-11-22 04:50\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Mi...
python
chosen
[ { "from": "human", "value": "Add test cases for KeyAuthMiddleware, Test apikey authentication\n" }, { "from": "gpt", "value": "import json\n\nfrom rest_framework import status\nfrom rest_framework.test import APITestCase\nfrom django.contrib.auth import get_user_model\n\nfrom api_bouncer.models ...
python
chosen
[ { "from": "human", "value": "Add script to collect data from the system\n" }, { "from": "gpt", "value": "import argparse\nimport datetime\nimport time\nfrom os import linesep\n\nimport psutil\n\n\ndef system_stats(duration):\n for _ in range(duration):\n now = datetime.datetime.isoform...
python
chosen
[ { "from": "human", "value": "Add missing migration, student course enrollment\n\nThis was fixed by running `makemigrations`, which we presumably should\nhave done when we made the original change [1].\nThis has probably been broken all this time, potentially as far back as\nDecember 2016.\n\nDespite earlier...
python
chosen
[ { "from": "human", "value": "Add example script for HEAD requests\n\nChange-Id: I3d2421f1fb6e0db02e01789edc78ca432e34975f\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. You m...
python
chosen
[ { "from": "human", "value": "Create in 63 glorious lines" }, { "from": "gpt", "value": "#!/usr/bin/python3\n\n# Import modules\nfrom os import system as do\nfrom time import sleep\n\n# Set Variables\nupCache = \" \"\nupSys = \" \"\nremAuto = \" \"\n\n# define how to get config\ndef getConfig(fil...
python
chosen
[ { "from": "human", "value": "Create a separate package to hold all the PyTask sitewide helpers.\n" }, { "from": "gpt", "value": "\"\"\"Package containing the helper functions that may be used through out\nthe site.\n\"\"\"\n\n__authors__ = [\n '\"Madhusudan.C.S\" <madhusudancs@fossee.in>',\n ...
python
chosen
[ { "from": "human", "value": "Add integration test for number of detected RSS feeds\n" }, { "from": "gpt", "value": "import subprocess\nimport unittest\n\nfrom aws_status.status_page import StatusPage\n\nclass TestStatusPage(unittest.TestCase):\n def test_number_of_detected_feeds(self):\n ...
python
chosen
[ { "from": "human", "value": "BUG: Make sure that joblib does get installed.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\ndef configuration(parent_package='', top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('externals',parent_pac...
python
chosen
[ { "from": "human", "value": "Add script to extract the crosswalk between msas and blocks\n" }, { "from": "gpt", "value": "\"\"\"crosswalk_msa_block.py\n\nExtract the crosswalk between 2000 msa and blocks\n\"\"\"\nimport os\nimport csv\n\n#\n# Import data\n#\n\n## MSA to counties crosswalk\n# cou...
python
chosen
[ { "from": "human", "value": "Allow us to run tests from external XBlock repositories\n" }, { "from": "gpt", "value": "\"\"\"\nThis will run tests on all XBlocks in the `xblock.test.v0`\nentrypoint. Did you notice something about that entry point? It ends\nwith a v0. That means this is not finish...
python
chosen
[ { "from": "human", "value": "Add the main package module file\n\nA basic introduction to the utility and philosophy of the package is\nadded to the package docstring.\n" }, { "from": "gpt", "value": "\"\"\"\nSimple and extensible toolkit for theoretic chemical kinetics\n=========================...
python
chosen
[ { "from": "human", "value": "Add command to find applications enabled for an add on [skip ci]\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nimport csv\n\nfrom django.core.management.base import BaseCommand\nfrom corehq import toggles\nfrom corehq.apps.app_manager.model...
python
chosen
[ { "from": "human", "value": "Add tests for game parser item\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport requests\nfrom lxml import html\n\nfrom parsers.team_parser import TeamParser\nfrom parsers.game_parser import GameParser\n\n\ndef test_2016():\n\...
python
chosen
[ { "from": "system", "value": "Remove exception eating from dispatch_hook." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests.hooks\n~~~~~~~~~~~~~~\n\nThis module provides the capabilities for the Requests hooks system.\n\nAvailable hooks:\n\n``args``:\n A dictionary ...
python
chosen
[ { "from": "human", "value": "Add fake robot utility tool.\n" }, { "from": "gpt", "value": "import json\n\nfrom time import time\nfrom threading import Timer\n\nfrom tornado.ioloop import IOLoop\nfrom tornado.web import Application\nfrom tornado.websocket import WebSocketHandler\n\n\nclass Repeat...
python
chosen
[ { "from": "human", "value": "Add script to list projects\n" }, { "from": "gpt", "value": "from yastlib import *\n\nyast_id = 'id'\nyast_password = 'password'\nyast = Yast()\nyast_hash = yast.login(yast_id, yast_password)\nif yast_hash != False:\n\tprint 'Connected to yast.com'\n\tprojects = yast...
python
chosen
[ { "from": "human", "value": "Test all modules in one fell swoop\n\ngit-svn-id: a2d0af3c19596d99b5c1e07a0b4fed4eaca14ddf@18173 7fff26f0-e11d-0410-b8d0-f4b6ff9b0dc5\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom mst_tree_builder import *...
python
chosen
[ { "from": "human", "value": "Move win32 audio experiment to trunk.\n\n\n\n\n\ngit-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@736 14d46d22-621c-0410-bb3d-6f67920f7d95\n" }, { "from": "gpt", "value": "#!/usr/bin/python\r\n# $Id:$\r\n\r\n# Play an audio file with DirectShow. Tested ok with M...
python
chosen
[ { "from": "system", "value": "Fix the script. It did not work at all before.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# Enable or disable the use of NMEA.\n\nimport ubx\nimport struct\nimport calendar\nimport os\nimport gobject\nimport logging\nimport sys\nimport socket\nimport ti...
python
chosen
[ { "from": "human", "value": "Add reverse geocode command for NI\n" }, { "from": "gpt", "value": "\"\"\"Usage:\n\n ./manage.py enhance_ni_stops\n\"\"\"\n\nimport requests\nfrom time import sleep\nfrom django.core.management.base import BaseCommand\nfrom ...models import StopPoint\n\n\nSESSION ...
python
chosen
[ { "from": "human", "value": "Add script to display normal distribution\n" }, { "from": "gpt", "value": "\nimport healpy as hp\nimport numpy as np\n\nimport matplotlib.pyplot as plt\n\ndef load_ply(path):\n \n lines = []\n verts = []\n norms = []\n \n \n f = open(path, \"...
python
chosen
[ { "from": "human", "value": "Use a generator with numpy.loadtxt\n" }, { "from": "gpt", "value": "\"\"\"Use a generator with numpy loadtxt\"\"\"\n\nimport numpy as np\n\n\ndef file_stream(file_name):\n for line in open(file_name):\n yield line\n\n\ndef demo_use():\n file_name = 'cens...
python
chosen
[ { "from": "human", "value": "Add unstable embedding in larger network\n" }, { "from": "gpt", "value": "\"\"\"\nEmbed motif in larger network\n\"\"\"\n\nimport copy\n\nimport numpy as np\nimport networkx as nx\nimport scipy.stats as scis\nimport matplotlib.pyplot as plt\n\nfrom tqdm import trange...
python
chosen
[ { "from": "human", "value": "Add unit tests for Jobs()\n" }, { "from": "gpt", "value": "import unittest\nimport mock\nfrom ..jobs import Jobs\n\n\nclass TestJobs(unittest.TestCase):\n\n @mock.patch('auth0.v2.jobs.RestClient')\n def test_get(self, mock_rc):\n mock_instance = mock_rc....
python
chosen
[ { "from": "human", "value": "Add migrations for indexes on ADS\n" }, { "from": "gpt", "value": "\"\"\"Add indexes on ADS for numero and insee\n\nRevision ID: 34c2049aaee2\nRevises: e187aca7c77a\nCreate Date: 2019-10-21 16:35:48.431148\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevisi...
python
chosen
[ { "from": "human", "value": "Add process memory usage script" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\ndef show_usage():\n sys.stderr.write('''memio - Simple I/O for /proc/<pid>/mem\nDump /proc/<pid>/maps:\n memio.py <pid>\nRead from or write to (when s...
python
chosen
[ { "from": "human", "value": "Add file for simple test of unreachable symbols remove\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfro...
python
chosen
[ { "from": "human", "value": "Add more organisations for letter branding\n\n> The logos are now ready to go on DVLA side- so far we've got:\n> 001 = HM Government\n> 002 = OPG\n> 003 = DWP\n> 004 = GEO\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0104_more_letter_orgs\nRev...
python
chosen
[ { "from": "human", "value": "Add noise image generator script\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\"Generates smooth noise images.\"\"\"\n\nimport argparse\n\nimport numpy as np\nfrom PIL import Image\n\nfrom num_utils import resize\n\n\ndef main():\n parser = argpa...
python
chosen
[ { "from": "human", "value": "Make an experiment for reconstructing a function from partial ordering of its values at samples points.\n" }, { "from": "gpt", "value": "# Goal:\n#\n# Given:\n# - a set of samples (S)\n# - an unknown evaluation function f of S (f: S -> [0; 1])\n# - a partial order c ...
python
chosen
[ { "from": "human", "value": "Make validation and test separate scripts\n" }, { "from": "gpt", "value": "import sys\nimport torch\nimport visdom\nimport argparse\nimport numpy as np\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torchvision.models as models\n\nfrom torch.autograd...
python
chosen
[ { "from": "human", "value": "Apply model permissions - plot permission name\n\nData migration to fix plot permissions to say can add or delete\n**planting site**, rather than **plot**.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom djang...
python
chosen
[ { "from": "human", "value": "Update photo and album models for non-required fields\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": "Introduce a single program to rule them all...\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*- \n\n\n#\n# Application to capture, and calibrate stereo cameras\n#\n\n\n#\n# External dependencies\n#\nimport argparse\nimport Calibration\n...
python
chosen
[ { "from": "human", "value": "[AC-6187] Add migration for image field\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2018-12-17 21:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport sorl.thumbnail.fields\n\n\nclass Mi...
python
chosen
[ { "from": "human", "value": "Revert \"Revert \"Created the model and migration for person_location_history table\"\"\n\nThis reverts commit baf53bd5b1fdcb0c1b39c60a2337d3f3d58cad95.\noops\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom dj...
python
chosen
[ { "from": "human", "value": "Create a new test module along with a session scoped env fixture\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom jinja2 import Environment\n\n\n@pytest.fixture(scope='session')\ndef environment():\n return Environment(extensions=[...
python
chosen
[ { "from": "human", "value": "Add Turing machine class before integer-to-TM conversion.\n" }, { "from": "gpt", "value": "class State():\n def __init__(self, ??):\n self.end_of_tape = ??\n self.write_false = ??\n self.move_false = ??\n self.write_true = ??\n s...
python
chosen
[ { "from": "human", "value": "Add script for injecting InChI keys and string (and others)\n" }, { "from": "gpt", "value": "import CoolProp\nfrom chemspipy import ChemSpider\nfrom chemspipy_key import key # private file with the key (DO NOT COMMIT!!)\nimport glob, json\ncs = ChemSpider(key)\n\n# M...
python
chosen
[ { "from": "human", "value": "Add scatter linked-brush selection example\n" }, { "from": "gpt", "value": "\"\"\"\nFaceted Scatter Plot with Linked Brushing\n-----------------------------------------\nThis is an example of using an interval selection to control the color of\npoints across multiple...
python
chosen
[ { "from": "human", "value": "Add cumulative 60 module (L2)\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport json\nimport zmq\nimport zconfig\nimport zutils\n\n\ndef main():\n logger = zutils.getLogger(__name__)\n\n ctx = zmq.Context()\n subsock = ctx.socket(zmq.SUB)\n ...
python
chosen
[ { "from": "human", "value": "Write tests for the command server\n" }, { "from": "gpt", "value": "import os\nimport select\nimport socket\nimport time\nimport unittest\n\nfrom jobmon.protocol import *\nfrom jobmon import command_server, protocol, transport\n\nPORT = 9999\n\nclass CommandServerRec...
python
chosen
[ { "from": "human", "value": "Add random script for renaming toutv files\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# coding=utf8\n\nfrom enum import Enum\nimport os\nimport os.path\nimport re\nimport sys\n\ndef main():\n VideoTypes = Enum('VideoType', 'emission film miniserie')\n...
python
chosen
[ { "from": "human", "value": "[svn] Add a reminder to write a HTML formatter test.\n\n--HG--\nbranch : trunk\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n Pygments HTML formatter tests\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: 2006 by Georg Brandl.\n :licens...
python
chosen
[ { "from": "human", "value": "Add test for librato uptime\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport unittest\nimport json\n\nsys.path.insert(0, os.path.abspath('./situation'))\nsys.path.insert(0, os.path.abspath('./'))\n\nfrom situation.librato_uptime import Calculator\nfrom ...
python
chosen
[ { "from": "human", "value": "Add config file for global user-defined variables\n" }, { "from": "gpt", "value": "# Additional configuration\n\n# User defined global variables\n\n# Snack calling method\n# Choices are 'exe', 'python', 'tcl'\n# Setting it to None, uses the default for your operating...
python
chosen
[ { "from": "human", "value": "Add unit tests for dakota.dakota_utils\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Tests for dakota.dakota_utils module.\n#\n# Call with:\n# $ nosetests -sv\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nimport os\nfrom nose.tools import *\nfrom dak...
python
chosen
[ { "from": "human", "value": "Add solution for problem 1a\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*- \n\n# Copyright 2014 Fabian M.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance...
python
chosen
[ { "from": "human", "value": "Add configs unit test case\n\nChange-Id: I9a9bb85226059cf6421282d72e4f6b8fd4df7d7f\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 Intel Corp.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complia...
python
chosen
[ { "from": "human", "value": "Add migration file to generate certificatesubscription table\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\nimport django.db.models.delet...
python
chosen
[ { "from": "human", "value": "Add script to aggregate RouteDates and display ranked lists of routes.\n" }, { "from": "gpt", "value": "from collections import defaultdict\nimport sys\nimport django\ndjango.setup()\n\nfrom busshaming.models import RouteDate, Feed\n\nFEED_SLUG = 'nsw-buses'\n\n\nMIN...
python
chosen
[ { "from": "human", "value": "Create basic url on opps article\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\nfrom django.conf.urls.defaults import patterns, url\nfrom django.conf.urls import include\n\nfrom opps.article.views import OppsDetail\n\n\n\nurlpatte...
python
chosen
[ { "from": "human", "value": "Add negative test-cases for openstack node create command\n\nChange-Id: Icf7afa131f3cc07c19df88bd254b4aa823c6bef4\nPartial-Bug: #1630288\n" }, { "from": "gpt", "value": "# Copyright (c) 2016 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"L...
python
chosen
[ { "from": "human", "value": "Add a test for goto_line\n" }, { "from": "gpt", "value": "\"\"\"\nThis module tests the text api module (pyqode.core.text)\n\"\"\"\nimport os\nfrom PyQt4 import QtGui\nfrom PyQt4.QtTest import QTest\nimport sys\n\nfrom pyqode.core.editor import QCodeEdit\nfrom pyqode...
python
chosen
[ { "from": "human", "value": "Add crawler for \"Hägar the Horrible\"\n" }, { "from": "gpt", "value": "# encoding: utf-8\nfrom comics.aggregator.crawler import ComicsKingdomCrawlerBase\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = 'Hägar the Hor...
python
chosen
[ { "from": "human", "value": "Add reset_polymorphic_ctype() function to assist with migration to polymorphic\n" }, { "from": "gpt", "value": "from django.contrib.contenttypes.models import ContentType\n\n\ndef reset_polymorphic_ctype(*models, **filters):\n \"\"\"\n Set the polymorphic conte...
python
chosen
[ { "from": "human", "value": "Add tests for v3 auth\n" }, { "from": "gpt", "value": "import puresnmp.auth as auth\n\n\ndef test_password_to_key():\n from hashlib import md5\n\n hasher = auth.password_to_key(md5, 16)\n result = hasher(b\"foo\", b\"bar\")\n expected = b\"x\\xf4\\xdf-#\\...
python
chosen
[ { "from": "human", "value": "Add rules for San Diego\n" }, { "from": "gpt", "value": "from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES\n\nudfs = {\n 'plot': {\n 'type': 'udf:Plot Type',\n 'powerline_conflict_potential': 'udf:Powerlines Overhead',\n ...
python
chosen
[ { "from": "human", "value": "Add iOS api for storage path\n" }, { "from": "gpt", "value": "'''\niOS Storage Path\n--------------------\n'''\n\nfrom plyer.facades import StoragePath\nfrom pyobjus import autoclass\nimport os\n\nNSFileManager = autoclass('NSFileManager')\n\n# Directory constants (N...
python
chosen
[ { "from": "human", "value": "Add a mixin form that provides bidirectional m2m fields in the admin\n" }, { "from": "gpt", "value": "from django.forms import ModelForm\n\n\nclass BidirectionalM2MForm(ModelForm):\n\n bi_m2m_fields = []\n\n def _get_m2m_attr_name(self, m2m_field):\n ret...
python
chosen
[ { "from": "human", "value": "Add py solution for 662. Maximum Width of Binary Tree\n\n662. Maximum Width of Binary Tree: https://leetcode.com/problems/maximum-width-of-binary-tree/\n" }, { "from": "gpt", "value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init_...
python
chosen
[ { "from": "human", "value": "Add script to split the dataset\n" }, { "from": "gpt", "value": "import os\n\nimport numpy as np\n\ndata_dir = \"data/dataset/\"\njpg_filenames = list(filter(lambda x: x[-3:] == \"jpg\", os.listdir(data_dir)))\n\n# Randomly select the test dataset\ntest_percentage = ...
python
chosen
[ { "from": "human", "value": "Add tests for tagging of parameter cells\n" }, { "from": "gpt", "value": "import unittest\n\nfrom ..api import read_notebook\nfrom ..execute import _parameterize_notebook\nfrom . import get_notebook_path\n\n\nclass TestNotebookHelpers(unittest.TestCase):\n def tes...
python
chosen
[ { "from": "human", "value": "Fix paper revisions with same submitted dt\n" }, { "from": "gpt", "value": "\"\"\"Fix future paper revisions\n\nRevision ID: 2963fba57558\nRevises: 098311458f37\nCreate Date: 2017-04-19 12:02:16.187401\n\"\"\"\n\nfrom collections import Counter\nfrom datetime import ...
python
chosen
[ { "from": "human", "value": "Return union of two sorted arrays\n" }, { "from": "gpt", "value": "'''\nIn this module, we implement a function which gets the union\nof two sorted arrays. \n\n'''\n\ndef union_sorted_arrays(arr_1, arr_2):\n\t'''\n\tReturn the union of two sorted arrays\n\n\t'''\n\tr...
python
chosen
[ { "from": "human", "value": "Add script to run Monte Carlo and bootstrap analyses\n" }, { "from": "gpt", "value": "\"\"\"Run bootstrap analyses\"\"\"\n\nfrom working_functions import *\nimport multiprocessing\n\n# Datasets not included: Cocoli, Sherman, Luquillo, Shiramaki\ndat_list = ['FERP', '...
python
chosen
[ { "from": "human", "value": "Add state for salt proxy\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport logging\n\nlog = logging.getLogger(__name__)\n\n\ndef _proxy_conf_file(proxyfile):\n changes = []\n success = True\n if not os.path.exists(proxyfile):\n ...
python
chosen
[ { "from": "system", "value": "Update expected error message for this test\n\nPR 6370 on the chapel repository caused a change to the error message output\nwhen a Chapel module or enum can't be found in a use statement, resulting in\nthe failure of this test to match expected output. Update accordingly.\n" ...
python
chosen
[ { "from": "human", "value": "Add prob9, night in 9.18\n" }, { "from": "gpt", "value": "import math\nclass Solution(object):\n def isPalindrome(self, x):\n \"\"\"\n :type x: int\n :rtype: bool\n \"\"\"\n flag = 0\n if x < 0:\n return False\n...
python
chosen
[ { "from": "human", "value": "Add example for block bar\n" }, { "from": "gpt", "value": "\"\"\"\n\nThis example demonstrates how to make colorful bars.\n\n\"\"\"\n\nfrom rich.block_bar import BlockBar\nfrom rich.console import Console\nfrom rich.table import Table\n\ntable = Table()\ntable.add_co...
python
chosen
[ { "from": "human", "value": "CLOWDER: Add migration for expire at\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2017-08-09 19:48\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio...
python
chosen
[ { "from": "human", "value": "Test codie to get sound duration right\n" }, { "from": "gpt", "value": "import math\nimport numpy\nimport pyaudio\n\n\ndef sine(frequency, length, rate):\n length = int(length * rate)\n factor = float(frequency) * (math.pi * 2) / rate\n return numpy.sin(nump...
python
chosen
[ { "from": "human", "value": "Add English assembled mechanism linking questions\n" }, { "from": "gpt", "value": "import pickle\nfrom indra.tools.incremental_model import IncrementalModel\nfrom indra.mechlinker import MechLinker\nfrom indra.assemblers import EnglishAssembler\n\n\ndef print_linked_...
python
chosen
[ { "from": "human", "value": "Add unit test for channel ready\n" }, { "from": "gpt", "value": "# Copyright 2020 The gRPC Authors\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 of ...
python
chosen
[ { "from": "human", "value": "Add unit test for haralick_features()\n" }, { "from": "gpt", "value": "import numpy as np\nimport pytest\n\nfrom microscopium import features\n\n\n@pytest.fixture(scope=\"module\", params=[np.uint8, np.float])\ndef haralick_image(request):\n haralick_image = np.ar...
python
chosen
[ { "from": "human", "value": "Test that an int arg to grad is okay\n" }, { "from": "gpt", "value": "from test_util import *\nfrom funkyyak import grad\n\ndef test_int_case():\n check_equivalent((lambda x:x*x)(2.0), 4.0)\n check_equivalent((lambda x:x*x)(2) + 0.0, 4.0)\n check...
python
chosen
[ { "from": "human", "value": "Add tests for the IATI Registry\nThis adds a 200 response and link checks for the IATI Registry\n" }, { "from": "gpt", "value": "import pytest\nfrom web_test_base import *\n\nclass TestIATIRegistry(WebTestBase):\n urls_to_get = [\n \"http://iatiregistry.org...
python
chosen
[ { "from": "human", "value": "Add some tests for dns config parsing" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance wit...
python
chosen
[ { "from": "human", "value": "Add configuration for ideascube hw\n" }, { "from": "gpt", "value": "from .base import * # pragma: no flakes\n\nfrom tzlocal import get_localzone\n\n\nTIME_ZONE = get_localzone().zone\nBACKUP_FORMAT = 'gztar'\nSTAFF_HOME_CARDS = [c for c in STAFF_HOME_CARDS # pragma...
python
chosen
[ { "from": "human", "value": "Add file for running gui filtering tests.\n" }, { "from": "gpt", "value": " \n\"\"\"\nSlow tests for filtering systems\n \n\"\"\"\nimport os\nimport tempfile\nimport shutil\n\nimport numpy as np\n\nfrom . import base\nfrom ..gui import mainWindow\nfrom ..system.la...
python
chosen
[ { "from": "human", "value": "Add a new script that downloads data for a date range\n\nBecause this is a date range, we can no longer use localdate (which is a\nfiltering technique).\nInstead we convert to a timestamp and use timestamps instead.\nWe also query using the timeseries, so we get both raw and ana...
python
chosen
[ { "from": "human", "value": "1.3.1dev: Add missing file from r15148\n\nRefs #12496.\n\n\ngit-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@15149 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2003-2016 Edgewall Software\n# Cop...
python
chosen
[ { "from": "human", "value": "Add Consortia Org as new membership type\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.23 on 2020-01-14 09:21\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.M...
python
chosen
[ { "from": "human", "value": "Create new FeatureDataset class to be used by experiment\n" }, { "from": "gpt", "value": "import abc\nimport json\nimport datetime\nimport h5py\nimport numpy as np\nfrom pelops.datasets.chip import ChipDataset\n\nclass FeatureDataset(ChipDataset):\n def __init__(s...
python
chosen
[ { "from": "human", "value": "Add openid fix migration script\n\nUsers who previously had a '%20' in their openstackids currently aren't able\nto access their data on RefStack. This is because a '.' has taken the place of\n'%20' in a recent openstack id update. This migration will reflect this change\nin the...
python
chosen
[ { "from": "human", "value": "Call the python script which is MUCH faster than php gpio\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# http://www.youtube.com/watch?v=Dc16mKFA7Fo\n\nimport time, sys, exceptions\nimport RPi.GPIO as GPIO\n\n\nGPIO.setmode(GPIO.BOARD)\nGPIO.setwarnings(F...
python
chosen
[ { "from": "human", "value": "Test scenario written by SeleniumBuilder\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom selenium.webdriver.firefox.webdriver import WebDriver\nfrom selenium.webdriver.common.action_chains import ActionChains\nimport time, unittest\n\n\ndef is_alert_pr...
python
chosen
[ { "from": "human", "value": "Add wrapper script to call tool to bulk abandon Gerrit CLs\n\nMakes it easy to invoke https://skia-review.googlesource.com/c/buildbot/+/275096\nfrom the Skia repo\n\nChange-Id: If94d506d86a2b4319c7e0a7c830d5dab27916c10\nReviewed-on: https://skia-review.googlesource.com/c/skia/+/...
python
chosen
[ { "from": "human", "value": "Add missing blank field migration\n\nI forgot to create this migration when adding blank attributes to Target\nfields.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nc...
python
chosen
[ { "from": "human", "value": "Add basic tests for CommandChainDispatcher\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Tests for CommandChainDispatcher.\"\"\"\n\nfrom __future__ import absolute_import\n\n#--------------------------------------------------------------------------...
python
chosen
[ { "from": "human", "value": "Add crawler for 'Super Effective'\n" }, { "from": "gpt", "value": "import datetime as dt\n\nfrom comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Super Effective'\n language ...
python
chosen
[ { "from": "human", "value": "Add simple eauth via REST\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\nProvide authentication using a REST call\n\nDjango auth can be defined like any other eauth module:\n\n.. code-block:: yaml\n\n external_auth:\n rest:\n ^url: http...
python
chosen
[ { "from": "human", "value": "tests: Add tests for example from OGR docs.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom construct import OptionalGreedyRepeater, UBInt8\n\nclass TestOptionalGreedyRepeater(unittest.TestCase):\n\n def setUp(self):\n self.c = OptionalGreedyRepeat...
python
chosen
[ { "from": "human", "value": "Add usage test. Currently failing because expects sets and gets lists.\n" }, { "from": "gpt", "value": "from ccs.icd9 import ICD9\nfrom clinvoc.icd9 import ICD9CM, ICD9PCS\nfrom nose.tools import assert_equals\n\n\ndef test_icd9():\n codesets = ICD9()\n dx_voc...
python
chosen
[ { "from": "human", "value": "Test user authentication against service\n" }, { "from": "gpt", "value": "\"\"\"\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICENSE` file for details)\n\"\"\"\n\nfrom pytest import raises\n\nfrom byceps.services.authentication.exceptions...
python
chosen
[ { "from": "human", "value": "Add test script for switching LEDs with Teensy buttons\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nTest buttons by switching LED colors\n\"\"\"\nimport time\n\nfrom octo import Octo\nfrom listener import ButtonListener\n\n\ndef main():\n octo =...
python
chosen
[ { "from": "human", "value": "Add class for running CLI commands\n\nThis commit adds a module which contains a class for running commands\nwhich will be invoked by the command-line interface.\n" }, { "from": "gpt", "value": "\"\"\"\nThis module defines the main interface for running dlex experime...
python
chosen