conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test for basic search\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\n\"\"\"Test helpers\"\"\"\n\n\nimport imaplib\nimport unittest\n\nfrom imap_cli import config\nfrom imap_cli import list_mail\nfrom imap_cli import tests\n\n\nclass HelpersTest(uni... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights even digits only problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Add Border Problem\n\n\ndef evenDigitsOnly(n):\n return sum(map(lambda d: int(d) % 2, str(n))) == 0\n # Alternative solution\n # return all([in... | python | chosen |
[
{
"from": "human",
"value": "Add script to visualize trajectories images and actions\n"
},
{
"from": "gpt",
"value": "import argparse\nimport matplotlib.pyplot as plt\nimport matplotlib.gridspec as gridspec\nfrom gui.grid_image_visualizer import GridImageVisualizer\nfrom gui.arrow_plotter import... | python | chosen |
[
{
"from": "system",
"value": "Complete map dict sol w/ time/space complexity\n"
},
{
"from": "human",
"value": "\"\"\"Leetcode 246. Strobogrammatic Number\nEasy\n\nURL: https://leetcode.com/problems/strobogrammatic-number/A strobogrammatic number is a number that looks the same when rotated 180 ... | python | chosen |
[
{
"from": "human",
"value": "Add initial code to open agency.txt\n"
},
{
"from": "gpt",
"value": "import csv\nimport sys\n\n\ndef clean_agency_file(*agencies):\n with open('agency.txt', 'r') as f:\n reader = csv.reader(f)\n next(f)\n for row in reader:\n if row... | python | chosen |
[
{
"from": "human",
"value": "Add script to handle posts from r_slimerancher\n\nBased on various app.py fom other channels\nDon't know if that's correct cause I've never done anything in python before xD"
},
{
"from": "gpt",
"value": "#encoding:utf-8\n\nfrom utils import get_url\n\n# Subreddit th... | python | chosen |
[
{
"from": "human",
"value": "Add initial basic test for compression\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nTest database compression functions\n'''\n# Import sorbic libs\nimport sorbic.db\n\n# Import python libs\nimport os\nimport shutil\nimport unittest\nimport tempfile\... | python | chosen |
[
{
"from": "human",
"value": "Add script to show agency rankings.\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nimport sys\nimport django\ndjango.setup()\n\nfrom busshaming.models import Agency, RouteDate, Feed\n\nFEED_SLUG = 'nsw-buses'\n\n\nMIN_TRIPS = 500\nMIN_RT_ENTRIE... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for volume type list\n\nadd tests for `os volume type list`\n\nChange-Id: Icd874b9cfac9376cc410041806fac64f1ff0c59d\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this... | python | chosen |
[
{
"from": "human",
"value": "Add simple interface to store parameters and patterns across python 2 and 3.\n"
},
{
"from": "gpt",
"value": "# Begin: Python 2/3 compatibility header small\n# Get Python 3 functionality:\nfrom __future__ import\\\n absolute_import, print_function, division, unico... | python | chosen |
[
{
"from": "human",
"value": "Add view for API v1 Root\n\nThis sends back a JSON response contain sites with ID's as well as\ntitle/tagline.\n"
},
{
"from": "gpt",
"value": "from pyramid.view import view_config\n\n\nfrom ....views.finalisecontext import FinaliseContext\n\nclass APIV1(FinaliseCont... | python | chosen |
[
{
"from": "system",
"value": "Add ability to iterate over old document model and new document model for migrations\n"
},
{
"from": "human",
"value": "import time\nimport logging\n\nfrom cassandra.cqlengine.query import Token\n\nfrom scrapi.database import _manager\nfrom scrapi.processing.cassand... | python | chosen |
[
{
"from": "human",
"value": "Add config for fuzzing POX proactive mode\n"
},
{
"from": "gpt",
"value": "\nfrom config.experiment_config_lib import ControllerConfig\nfrom sts.topology import FatTree\nfrom sts.control_flow import Fuzzer\nfrom sts.input_traces.input_logger import InputLogger\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add permission to read Document and Meeting resources in the Audit\ncontext for Auditor role.\n"
},
{
"from": "gpt",
"value": "\n\"\"\"Auditors have document and meeting permissions in audit context.\n\nRevision ID: 1a22bb208258\nRevises: 1f865f61312\nCreate Date: 20... | python | chosen |
[
{
"from": "human",
"value": "Add basic unit test coverage for BrokerConnection\n"
},
{
"from": "gpt",
"value": "# pylint: skip-file\nfrom __future__ import absolute_import\n\nfrom errno import EALREADY, EINPROGRESS, EISCONN, ECONNRESET\nimport socket\nimport time\n\nimport pytest\n\nfrom kafka.c... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for SYNC producer\n\nTest one-shot SYNC transmission with and without counter value.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport canopen\n\n\nclass TestSync(unittest.TestCase):\n\n def test_sync_producer(self):\n network = canopen... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for artists app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport model_utils.fields\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migra... | python | chosen |
[
{
"from": "human",
"value": "Add module symbolic Fourier FA integration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nimport itertools\n\nimport numpy as np\nimport sympy as sp\n\ndef dot(es1, es2):\n return sum([e[0]*e[1] for e in zip(... | python | chosen |
[
{
"from": "human",
"value": "Add barebones bql query test cases.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010-2016, MIT Probabilistic Computing Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file e... | python | chosen |
[
{
"from": "human",
"value": "Add test for command output\n"
},
{
"from": "gpt",
"value": "import os\nimport pytest\n\nTEST_URL = str(os.environ.get('TEST_URL'))\nif TEST_URL != 'None' and TEST_URL.strip():\n pass\nelse:\n TEST_URL=\"https://192.168.10.10:8443/api\"\n\n@pytest.mark.parametrize(... | python | chosen |
[
{
"from": "human",
"value": "search: Increase test coverage for helper functions\n\nSigned-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>\n"
},
{
"from": "gpt",
"value": "from api.search import helpers\n\n\ndef test_reverse_complement():\n seq = \"ATGCCCTGA\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the event server\n"
},
{
"from": "gpt",
"value": "import os\nimport select\nimport socket\nimport time\nimport unittest\n\nfrom jobmon.protocol import *\nfrom jobmon import event_server, transport\n\nPORT = 9999\n\nclass TestEventServer(unittest.TestCa... | python | chosen |
[
{
"from": "human",
"value": "Add a new little urllib import test\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sys\nprint([m for m in sys.modules if m.startswith('urllib')])\n\nclass MyTest(unittest.TestCase):\n def test_urllib(self):\n import urllib\n print(urllib.__... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot CFL - needs to be modified\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom matplotlib.pyplot import *\n\nCFL = []\ninFile = open('./log_0_20','r')\nfor line in inFile:\n\tif ('Courant Number mean' in str(line)):\n\t\tfield = line.split()... | python | chosen |
[
{
"from": "human",
"value": "Add insertion sort method to module.\n"
},
{
"from": "gpt",
"value": "def insertion_sort(un_list):\n for idx in range(1, len(un_list)):\n current = un_list[idx]\n position = idx\n\n while position > 0 and un_list[position-1] > current:\n ... | python | chosen |
[
{
"from": "human",
"value": "Move typepad module into a directory so it can be externals-ed\n"
},
{
"from": "gpt",
"value": "import httplib2\nimport simplejson\nimport logging\nfrom urlparse import urljoin\nimport types\n\n# TODO configurable?\nBASE_URL = 'http://127.0.0.1:8080/'\n\nclass Remote... | python | chosen |
[
{
"from": "human",
"value": "Add script to write cluster HTML files for GtR.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport json, os, sys\n\nif __name__ == '__main__':\n if len(sys.argv) < 3:\n print('Usage: gtr-pages.py <input directory> <output directo... | python | chosen |
[
{
"from": "human",
"value": "Add script for reading k for list of trials\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\nReads thermal conductivity and statistics for a list of trials and saves results to a yaml file\r\n\"\"\"\r\nimport os\r\nimport yaml\r\nfrom thermof.parameters import k_parameters... | python | chosen |
[
{
"from": "human",
"value": "Add stub boot trigger handler.\n"
},
{
"from": "gpt",
"value": "# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version 3 of ... | python | chosen |
[
{
"from": "human",
"value": "Split some fastq files into smaller files\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSplit paired end fastq files into different files\n\"\"\"\n\nimport os\nimport sys\nimport argparse\nfrom roblib import stream_fastq, message\n\n__author__ = 'Rob Edwards'\n\n\n\n\nif ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 463. Island Perimeter\n\n463. Island Perimeter: https://leetcode.com/problems/island-perimeter/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def islandPerimeter(self, grid):\n \"\"\"\n :type grid: List[List[int]]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to grant board access to user\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Grant access to a board to a user.\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nimport click\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add baseline convolutional neural network model.\n"
},
{
"from": "gpt",
"value": "from keras.models import Sequential\nfrom keras.layers import Dense, Activation, Dropout, Flatten\nfrom keras.layers import Convolution2D, MaxPooling2D\nfrom keras.optimizers import SGD... | python | chosen |
[
{
"from": "human",
"value": "Convert nodes to dicts and count results of query\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom copy import copy\nfrom datetime import datetime\nfrom eve.utils import config\n\n\ndef node_to_dict(node):\n node = dict(node)\n if config.DATE_CREA... | python | chosen |
[
{
"from": "system",
"value": "Fix translatability of validation messages when defined in custom settings\n"
},
{
"from": "human",
"value": "from django.core.exceptions import ValidationError\n\nfrom django_auth_policy import settings as dap_settings\n\n\ndef password_min_length(value):\n if d... | python | chosen |
[
{
"from": "system",
"value": "Update script for init seahub_settings.py in Windows\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom hashlib import md5, sha1\nfrom base64 import urlsafe_b64encode as b64encode\nimport random\nrandom.seed()\n\ndef random_string():... | python | chosen |
[
{
"from": "human",
"value": "Add find intersection between two sorted lists\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFind the intersection of two sorted arrays.\n\"\"\"\n\ndef find_intersection(list_a, list_b):\n \"\"\"\n Assumes that both lists are sorted.\n \"\"\"\n # Initialize re... | python | chosen |
[
{
"from": "human",
"value": "Add a basic EntityDatabase class\n"
},
{
"from": "gpt",
"value": "from . import utils\nfrom .tl import TLObject\n\n\nclass EntityDatabase:\n def __init__(self, enabled=True):\n self.enabled = enabled\n\n self._entities = {} # marked_id: user|chat|ch... | python | chosen |
[
{
"from": "system",
"value": "Add support for nested attribute lookup and formatting.\n"
},
{
"from": "human",
"value": "from st2actions.runners.pythonrunner import Action\n\nfrom prettytable import PrettyTable\n\n__all__ = [\n 'St2ChatOpsFormatListResult'\n]\n\n\nclass St2ChatOpsFormatListRe... | python | chosen |
[
{
"from": "human",
"value": "Add Hypothesis-based state machine tests.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\ntest_state_machines\n~~~~~~~~~~~~~~~~~~~\n\nThese tests validate the state machines directly. Writing meaningful tests for\nthis case can be tricky, so the maj... | python | chosen |
[
{
"from": "human",
"value": "Add short script to calculate rescaling of marks\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"\nCalculates rescaled mark using hardcoded intervals\n\nUsage example:\n $ ./rescale_mark.py 50\n Your mark should be 65.0\n\"\"\"\n\nimport sys\n\... | python | chosen |
[
{
"from": "human",
"value": "Add download page py file.\n"
},
{
"from": "gpt",
"value": "import requests\n\n\ndef download(method='GET', url=None, tries_num=2, user_agent=None):\n print('Download:', url)\n try:\n headers = {'User-Agent': user_agent}\n req = requests.request(m... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate DB NDEx network\n"
},
{
"from": "gpt",
"value": "import glob\nimport pickle\nfrom indra.db import get_primary_db\nfrom indra.db.util import make_stmts_from_db_list\nfrom indra.assemblers import CxAssembler\n\ndata_path = '/pmc/data/db_ndex'\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add simple test module for integration testing\n"
},
{
"from": "gpt",
"value": "import sys\nimport argparse\nimport operator\nimport threading\nimport time\n\nfrom jnius import autoclass, cast\nfrom TripsModule.trips_module import TripsModule\n\n# Declare KQML java c... | python | chosen |
[
{
"from": "human",
"value": "Add an utility module to load entry-points with whatever lib is available\n"
},
{
"from": "gpt",
"value": "import logging\nimport sys\nimport types\n\nUSE_IMPORTLIB_METADATA_STDLIB = USE_IMPORTLIB_METADATA = USE_PKG_RESOURCES = False\n\nif sys.version_info >= (3, 10)... | python | chosen |
[
{
"from": "system",
"value": "Django: Test improvementes. Empty Pad test class added.\n"
},
{
"from": "human",
"value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your ... | python | chosen |
[
{
"from": "human",
"value": "Add exercise 4 checking code\n"
},
{
"from": "gpt",
"value": "from learntools.core import *\nimport tensorflow as tf\n\n\nclass Q1(ThoughtExperiment):\n _solution = \"\"\n\n\nclass Q2(ThoughtExperiment):\n _solution = \"\"\n\n\nclass Q3A(ThoughtExperiment):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to output codepage tables.\n"
},
{
"from": "gpt",
"value": "\"\"\"Prints code page tables.\n\"\"\"\n\nimport six\nimport sys\n\nfrom escpos import printer\nfrom escpos.constants import *\n\n\ndef main():\n dummy = printer.Dummy()\n\n dummy.hw('init')... | python | chosen |
[
{
"from": "human",
"value": "Add WiFi IP to LCD\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright (c) 2015 Max Vilimpoc\n#\n# References:\n# http://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python\n\n# https://github.com/intel-iot-devkit/up... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test to test automatic color assigment from TW\n"
},
{
"from": "gpt",
"value": "from time import sleep\nfrom tests.base import IntegrationTest, MultipleSourceTest\n\n\nclass TestSimpleColorAssigment(IntegrationTest):\n\n def configure_global_varialbes(s... | python | chosen |
[
{
"from": "human",
"value": "Write test case for worker\n"
},
{
"from": "gpt",
"value": "from twisted.trial import unittest\n\nfrom ooni.plugoo import work, tests\n\nclass WorkerTestCase(unittest.TestCase):\n def testWorkGenerator(self):\n class DummyTest:\n assets = {}\n ... | python | chosen |
[
{
"from": "human",
"value": "Add new class for illumination statistics files\n"
},
{
"from": "gpt",
"value": "import h5py\nimport re\nimport numpy as np\nfrom image_toolbox.util import regex_from_format_string\n\n\nclass Illumstats:\n '''Utility class for an illumination correction statistics... | python | chosen |
[
{
"from": "human",
"value": "Add list of builtin codegenerators\n"
},
{
"from": "gpt",
"value": "\"\"\"Code generation primitives.\"\"\"\n\nimport hdltools.verilog.codegen\nimport hdltools.specc.codegen\n\nBUILTIN_CODE_GENERATORS = {\n \"verilog\": hdltools.verilog.codegen.VerilogCodeGenerato... | python | chosen |
[
{
"from": "human",
"value": "Introduce tests for urlize_quoted_links() function\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nfrom django.test import TestCase\nfrom rest_framework.templatetags.rest_framework import urlize_quoted_links\nimport sys\n\n\nclass URLizerTes... | python | chosen |
[
{
"from": "human",
"value": "Add a data migration to make sure we don’t send a lot of emails to old events\n"
},
{
"from": "gpt",
"value": "# Generated by Django 1.10.5 on 2017-01-07 17:29\nfrom __future__ import unicode_literals\n\nimport datetime\n\nfrom django.db import migrations\nfrom djang... | python | chosen |
[
{
"from": "human",
"value": "Add new andalusian migration file\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.1 on 2019-07-25 14:07\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('andalusian', '0005_auto_20190... | python | chosen |
[
{
"from": "system",
"value": "Change the way transaction is initiated as readonly support was introduced in version 2.4\n"
},
{
"from": "human",
"value": "# -*- coding: UTF-8 -*-\n'''\n nereid.backend\n\n Backed - Tryton specific features\n\n :copyright: (c) 2010-2012 by Openlabs Techno... | python | chosen |
[
{
"from": "human",
"value": "Test cases for normalized string"
},
{
"from": "gpt",
"value": "from rdflib import *\nimport unittest\n\nclass test_normalisedString(unittest.TestCase):\n def test1(self):\n lit2 = Literal(\"\\two\\nw\", datatype=XSD.normalizedString)\n lit = Literal... | python | chosen |
[
{
"from": "human",
"value": "Implement Philips HUE wrapper caller for Minion Proxy\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nPhilips HUE lamps module for proxy.\n'''\n\nfrom __future__ import absolute_import\nimport sys\n\n__virtualname__ = 'hue'\n__proxyenabled__ = ['philip... | python | chosen |
[
{
"from": "human",
"value": "Add ON DELETE CASCADE to more easily remove bad datasets\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.11 on 2016-12-02 19:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migra... | python | chosen |
[
{
"from": "human",
"value": "Add segment conversion to feature string\n"
},
{
"from": "gpt",
"value": "feature_order = ['syllabic',\n 'stress',\n 'long',\n 'consonantal',\n 'sonorant',\n 'continuant',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add entry script for mies/acq4 analysis\n"
},
{
"from": "gpt",
"value": "import acq4\nfrom neuroanalysis.nwb_viewer import MiesNwbViewer, MiesNwb\nacq4.pyqtgraph.dbg()\n\nm = acq4.Manager.Manager(argv=['-D', '-n', '-m', 'Data Manager'])\ndm = m.getModule('Data Manage... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 684. Redundant Connection\n\n684. Redundant Connection: https://leetcode.com/problems/redundant-connection/\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nclass Solution(object):\n def findRedundantConnection(self, edges)... | python | chosen |
[
{
"from": "human",
"value": "Add some async protocol handling code\n\nSigned-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>\n"
},
{
"from": "gpt",
"value": "import asyncio\n\nimport logging\n\nfrom meshnet.serial.messages import SerialMessageConsumer\n\nlogger ... | python | chosen |
[
{
"from": "human",
"value": "Notify: Add migration to make notification identifier not unique\n\nRefs SHOOP-1282\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport shoop.core.fields\n\n\nclass Migr... | python | chosen |
[
{
"from": "human",
"value": "Write migration to associate group users with the group's files.\n"
},
{
"from": "gpt",
"value": "\"\"\"Associate groups with files.\n\nRevision ID: a3fe8c8a344\nRevises: 525162a280bd\nCreate Date: 2013-11-05 13:55:04.498181\n\n\"\"\"\n\n# revision identifiers, used ... | python | chosen |
[
{
"from": "human",
"value": "Add praw with post generator for selfposts\n"
},
{
"from": "gpt",
"value": "import praw\n\nr = praw.Reddit(user_agent='stream only self posts from a sub by /u/km97')\nposts = [post for post in r.get_subreddit('all').get_hot(limit=50) if post.is_self]\n\n# print(dir(p... | python | chosen |
[
{
"from": "human",
"value": "Solve Distance Between Two Points in python\n"
},
{
"from": "gpt",
"value": "from math import pow, sqrt\n\nx1, y1 = map(float, input().split())\nx2, y2 = map(float, input().split())\n\ndistance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2))\n\nprint(f\"{distance:.4f}\")\n... | python | chosen |
[
{
"from": "human",
"value": "Move docker_stream_adapter tests from plugins/ into modern testsuite\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom girder_worker.docker.stream_adapter import DockerStreamPushAdapter\n\n\nclass CaptureAdapter(object):\n def __init__(self):\n self._c... | python | chosen |
[
{
"from": "human",
"value": "Solve Where is the Marble? in python\n"
},
{
"from": "gpt",
"value": "import sys\n\n\ndef binary_search(marbles, query):\n begin = 0\n end = len(marbles) - 1\n middle = end // 2\n\n while begin <= end:\n if marbles[middle] < query:\n beg... | python | chosen |
[
{
"from": "human",
"value": "TEST\n(Still not automatic, to be converted eventually.)\n\nTest/example for experimental feature introduced in r283\n\n\n"
},
{
"from": "gpt",
"value": "# This tests the observation of observables into lists and maps.\n# This test should be converted to unittest\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a simple node testing script in Python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilities\nfrom selenium import webdriver\n\ndriver = webdriver.Remote('http://127.0.0.1:4444/wd/hub'... | python | chosen |
[
{
"from": "human",
"value": "Add tests for gene and ld snp pairs\n"
},
{
"from": "gpt",
"value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom .base import TestPostgapBase\n# ------------------------------------------------\n\nclass TestPostga... | python | chosen |
[
{
"from": "human",
"value": "Add simple selenium test for vtkObject.\n"
},
{
"from": "gpt",
"value": "from selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver.support.ui import Select\nfrom selenium.comm... | python | chosen |
[
{
"from": "human",
"value": "Test mask resulted in the same value as comprehension list\n\n\nFormer-commit-id: f1e3c2e5a3ddeab54e47746398620c57931170d6"
},
{
"from": "gpt",
"value": "\nimport numpy as np\nimport pytest\nfrom hypothesis import given\n# To test the equivalence of code to check if ... | python | chosen |
[
{
"from": "human",
"value": "Add script to upgrade Debian/Ubuntu bots.\n\nBug: skia:6890\nChange-Id: I30eea5d64c502ac7ef51cf2d8f6ef3c583e60b3e\nReviewed-on: https://skia-review.googlesource.com/28840\nCommit-Queue: Ben Wagner <3ef7217be91069877d94f7907ce5479000772cd3@google.com>\nReviewed-by: Eric Boren <0e... | python | chosen |
[
{
"from": "human",
"value": "Add tests for 'contain' matcher"
},
{
"from": "gpt",
"value": "import unittest\nfrom robber import expect\nfrom robber.matchers.contain import Contain\n\nclass TestAbove(unittest.TestCase):\n def test_matches(self):\n expect(Contain({'key': 'value'}, 'key')... | python | chosen |
[
{
"from": "human",
"value": "Add expire reservations in backport position.\n\nChange-Id: If0e58da50ebe9b50b414737a9bd81d93752506e2\nRelated-bug: #1348720\n(cherry picked from commit f4454f4c6962dd2c57c08dc7fecfcdebe7924e3b)\n"
},
{
"from": "gpt",
"value": "# All Rights Reserved.\n#\n# License... | python | chosen |
[
{
"from": "system",
"value": "Add some more tests for simple_persistence\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals, division, absolute_import\nfrom tests import FlexGetBase\n\n\nclass TestSimplePersistence(FlexGetBase):\n\n __yaml__ = \"\"\"\n tasks:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add repeat a word a thousand times exercise\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\ndef main():\n word = raw_input(\"Say a word and I will repeat it a thousand times: \").strip()\n \n if (word.count(\" \") > 0):\n print \"More than one word!! ... | python | chosen |
[
{
"from": "human",
"value": "Duplicate info in parent and children\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom web import models\n\nclass Command(BaseCommand):\n can_import_settings = True\n\n def handle(self, *args, **options):\... | python | chosen |
[
{
"from": "human",
"value": "Add test for socket printer\n"
},
{
"from": "gpt",
"value": "# Nemubot is a smart and modulable IM bot.\n# Copyright (C) 2012-2015 Mercier Pierre-Olivier\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affe... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for repo_utils\n\nSigned-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>\n"
},
{
"from": "gpt",
"value": "import logging\nimport os.path\nfrom pytest import raises\nimport shutil\n\nfrom .. import repo_utils\nrepo_utils.log.se... | python | chosen |
[
{
"from": "human",
"value": "Add the nodev.specs example code.\n"
},
{
"from": "gpt",
"value": "\n# import pytest\n\nfrom nodev.specs.generic import FlatContainer\n\n#\n# possible evolution of a ``skip_comments`` function\n#\ndef skip_comments_v0(stream):\n return [line.partition('#')[0] for ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the payload generator of the Uploader class.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the uploader module\"\"\"\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ im... | python | chosen |
[
{
"from": "human",
"value": "Copy input without modification to begin with\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport sys\n\nif len(sys.argv) < 3:\n print('usage: python {} input_filename output_filename'.format(sys.argv[0]))\n exit(1)\n\nwith open(sys.argv[1], 'r') as in... | python | chosen |
[
{
"from": "human",
"value": "Add a game of life benchmark\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBenchmark a game of life implementation.\n\"\"\"\n\nimport numpy as np\n\nfrom numba import jit\n\n\n@jit(nopython=True)\ndef wrap(k, max_k):\n if k == -1:\n return max_k - 1\n elif k ... | python | chosen |
[
{
"from": "human",
"value": "Remove falsy unique together constraint\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 ('meinbe... | python | chosen |
[
{
"from": "human",
"value": "Create python example on formatting string\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Format string precedence\"\"\"\n\nclass Foo(object):\n def __str__(self):\n return \"i am a __str__\"\n def __repr__(self):\n return \"repre... | python | chosen |
[
{
"from": "human",
"value": "Add script to update snapshot version.\n"
},
{
"from": "gpt",
"value": "from sys import argv\nfrom tempfile import mkstemp\nfrom shutil import move\nfrom os import remove, close\n# import os, fileinput\n\nservices = [\"alchemy\", \"conversation\", \"dialog\", \"disco... | python | chosen |
[
{
"from": "human",
"value": "Make a tidy file of all miso summaries.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nwrite MISO summary tables out to tidy format\n\"\"\"\n\nfrom argparse import ArgumentParser\nimport pandas as pd\nimport os\nimport logging\nlogging.basicConfig(level=logging.INFO,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add command to update popularity of games\n"
},
{
"from": "gpt",
"value": "\"\"\"Updates the popularity of all games\"\"\"\nfrom django.core.management.base import BaseCommand\nfrom django.db.models import Count\n\nfrom games.models import Game\n\n\nclass Command(Bas... | python | chosen |
[
{
"from": "human",
"value": "Set up Code Fights create die problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Create Die Problem\n\nimport random\n\n\ndef createDie(seed, n):\n class Die(object):\n pass\n\n class Game(object):\n die = Die(seed, n)... | python | chosen |
[
{
"from": "human",
"value": "Add test for last commit\n"
},
{
"from": "gpt",
"value": "from chai import Chai\nfrom datetime import datetime\n\nfrom dfaker.data_generator import dfaker \n\n\nclass Test_Pump_Settings(Chai):\n def test_smoke(self):\n pass\n #def test_type(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for class as iterable\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nimport numpy as np\nimport numpy.testing as npt\n\nfrom nimble import Events\n\n\nclass TestClassIterable(TestCase):\n def setUp(self):\n conditional_arra... | python | chosen |
[
{
"from": "human",
"value": "Add merge migration - submissions migrations with develop (guardian).\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-06-18 14:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass M... | python | chosen |
[
{
"from": "human",
"value": "Add script to run test suite with multiple python versions at once\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Runs the tornado test suite with all supported python interpreters.\"\"\"\n\nimport os\nimport subprocess\nimport sys\n\nINTERPRETERS = [\... | python | chosen |
[
{
"from": "human",
"value": "Add 3D power spectrum for comparing with generated fields\n"
},
{
"from": "gpt",
"value": "\nimport numpy as np\n\n\ndef threeD_pspec(arr):\n '''\n Return a 1D power spectrum from a 3D array.\n\n Parameters\n ----------\n arr : `~numpy.ndarray`\n ... | python | chosen |
[
{
"from": "human",
"value": "Use parametrize to test authorization and permissions\n\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\nparameters = [\n (\"post\", (\"/api/viruses\", {})),\n (\"patch\", (\"/api/viruses/foobar\", {})),\n (\"delete\", (\"/api/viruses/foobar\",)),\n (\... | python | chosen |
[
{
"from": "human",
"value": "Add test for Submission model\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom app.models import Submission, Comment\n\n\nMOCK_SUBMISSION = {\n 'permalink': (u'https://www.reddit.com/r/fake/comments'\n u'/000000/submission_title/'\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.