conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add main regression test file for cyclus\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nimport os\n\nfrom tests_list import sim_files\nfrom cyclus_tools import run_cyclus, db_comparator\n\n\"\"\"Tests\"\"\"\ndef test_cyclus():\n \"\"\"Test for all inpu... | python | chosen |
[
{
"from": "human",
"value": "Add a unittest for spacegroup. Still very basic.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\nCreated on Mar 12, 2012\n'''\n\nfrom __future__ import division\n\n__author__=\"Shyue Ping Ong\"\n__copyright__ = \"Copyright 2012, The Materials Project\"... | python | chosen |
[
{
"from": "human",
"value": "Add CLI tool for creating SciTokens.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\n\nfrom cryptography.hazmat.primitives import serialization\nfrom cryptography.hazmat.backends import default_backend\n\nimport scitokens\n\n# Arguments:\n\... | python | chosen |
[
{
"from": "human",
"value": "Add script to make SOFIA ontology\n"
},
{
"from": "gpt",
"value": "import sys\nimport json\nfrom os.path import join, dirname, abspath\nfrom rdflib import Graph, Namespace, Literal\nfrom indra.sources import sofia\n\n\n# Note that this is just a placeholder, it doesn... | python | chosen |
[
{
"from": "system",
"value": "Fix return get_types for ClipboardXsel"
},
{
"from": "human",
"value": "'''\nClipboard xsel: an implementation of the Clipboard using xsel command line tool.\n'''\n\n__all__ = ('ClipboardXsel', )\n\nfrom kivy.utils import platform\nfrom kivy.core.clipboard import Cl... | python | chosen |
[
{
"from": "human",
"value": "Add spider for Sun Loan Company\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport json\nimport re\n\nfrom locations.items import GeojsonPointItem\n\nDAYS={\n 'Monday':'Mo',\n 'Tuesday':'Tu',\n 'Wednesday':'We',\n 'Friday':'Fr... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for sponsors\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.3 on 2016-05-01 16:32\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add russian words for date_time\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom .. import Provider as DateTimeProvider\n\n\nclass Provider(DateTimeProvider):\n\n @classmethod\n def day_of_week(cls):\n day... | python | chosen |
[
{
"from": "human",
"value": "Add test for function re-definition\n"
},
{
"from": "gpt",
"value": "from numba import *\nimport unittest\n\nclass TestRedefine(unittest.TestCase):\n def test_redefine(self):\n\n def foo(x):\n return x + 1\n\n jfoo = jit(int32(int32))(foo)... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for guessing the BuildDir associated with a subdirectory argument.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# __COPYRIGHT__\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and as... | python | chosen |
[
{
"from": "human",
"value": "Add the start of the UVA scraper.\n"
},
{
"from": "gpt",
"value": "from lxml import etree\n\nfrom planner.scrapers.base import Scraper\n\n\nclass UVAScraper(Scraper):\n \"\"\"Scraper for the University of Virginia\"\"\"\n\n def scrape(self):\n with open(... | python | chosen |
[
{
"from": "human",
"value": "Add a visitor to generate the github history link.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom AbstractVisitor import AbstractVisitor\n\nclass AddGitHubArticleLinkVisitor(AbstractVisitor):\n def __init__(self, args):\n self.repo = args.... | python | chosen |
[
{
"from": "human",
"value": "Add server TLS context factory\n"
},
{
"from": "gpt",
"value": "from twisted.internet import reactor, ssl\nfrom OpenSSL import SSL\n\n\nclass ServerContextFactory(ssl.ContextFactory):\n \"\"\"Factory for PyOpenSSL SSL contexts that are used to handle incoming\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a silly test for vertex.q2qclient.enregister.\n"
},
{
"from": "gpt",
"value": "# Copyright 2005-2008 Divmod, Inc. See LICENSE file for details\n# -*- vertex.test.test_q2q.UDPConnection -*-\n\n\"\"\"\nTests for L{vertex.q2qclient}.\n\"\"\"\n\nfrom twisted.trial i... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add photo blocks type\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.5 on 2019-09-26 23:07\n\nfrom django.db import migrations\n\n\ndef generate_job_block_types(apps, schema_editor):\n User = apps.get_model(\"auth\", \"User\")\n roo... | python | chosen |
[
{
"from": "human",
"value": "Add tests for backslash escapes in route paths\n\nCo-Authored-By: Stephen Finucane <06fa905d7f2aaced6dc72e9511c71a2a51e8aead@that.guru>\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom routes.route import Route\n\n\nclass TestRouteEscape(unittest.TestCase):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add basic framework for middleware.\n"
},
{
"from": "gpt",
"value": "# -*- test-case-name: vumi.middleware.tests.test_provider_setter -*-\n\nfrom twisted.internet.defer import inlineCallbacks\n\nfrom vumi.middleware.base import BaseMiddleware\nfrom vumi.persist.txred... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights growing plant problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Growing Plant Problem\n\n\ndef growingPlant(upSpeed, downSpeed, desiredHeight):\n if upSpeed >= desiredHeight:\n return 1\n else:\n ret... | python | chosen |
[
{
"from": "human",
"value": "Add example for high and low peak detection\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport numpy as np\nfrom vector import cb, plot_peaks\nimport peakutils.peak\n\ndef plot_peaks_lows_highs(x, highs, lows, algorithm=None, mph=... | python | chosen |
[
{
"from": "human",
"value": "Add new test for CheckResult\n"
},
{
"from": "gpt",
"value": "from itertools import combinations\nfrom string import ascii_lowercase\n\nfrom botbot import checkinfo as ci\n\ndef test_bidirectional_problem_serialization(tmpdir):\n info = ci.CheckResult(tmpdir.strpa... | python | chosen |
[
{
"from": "human",
"value": "Add Alexa top 1 Million fetcher to push into RabbitMQ\n"
},
{
"from": "gpt",
"value": "import csv\nimport requests\nimport zipfile\nimport os\nimport pika\nfrom os.path import expanduser\n\n\nBASEPATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))\nALE... | python | chosen |
[
{
"from": "human",
"value": "Add gradient and reshape functions to match Matlab\n"
},
{
"from": "gpt",
"value": "from numpy import gradient as np_gradient, reshape as np_reshape\n\n\ndef gradient(f, *varargs):\n \"\"\"\n Return the gradient of an N-dimensional array.\n\n The gradient is... | python | chosen |
[
{
"from": "human",
"value": "Add a small program for checking whether SEG Y files roundtrip through the data structure flawlessly.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom segpy.reader import create_reader\nfrom segpy.trace_header import TraceHeaderRev1\nfrom segpy.types i... | python | chosen |
[
{
"from": "human",
"value": "Add migration script to clear invalid unclaimed records\n\nConfirmed users should not have unclaimed records\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Script to remove unclaimed records for confirmed users. Once a user has... | python | chosen |
[
{
"from": "human",
"value": "Correct crv baseline questionnaire rank w/ migration\n(FKs prevent site_persistence fix from working)\n"
},
{
"from": "gpt",
"value": "\"\"\"Correct rank of CRV baseline\n\nRevision ID: 9ebdfeb28bef\nRevises: a679f493bcdd\nCreate Date: 2017-10-09 10:16:40.584279\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add numpy array of tuples\n"
},
{
"from": "gpt",
"value": "# Numpy converts a list of tuples *not* into an array of tuples, but into a 2D\n# array instead.\nlist_of_tuples = [(1, 2), (3, 4)]\nimport numpy as np\nprint('list of tuples:', list_of_tuples, 'type:', type(... | python | chosen |
[
{
"from": "human",
"value": "Add python data transmission example.\n"
},
{
"from": "gpt",
"value": "import serial\nimport time\n\nclass blinkyBoard:\n def init(self, port, baud):\n self.serial = serial.Serial(port, baud)\n self.serial.open()\n\n def sendPixel(self,r,g,b):\n data = byt... | python | chosen |
[
{
"from": "human",
"value": "Add a script which structures the mlsp2013 data\n\n - creates a csv file which maps a file name to a label set\n"
},
{
"from": "gpt",
"value": "import csv\n\ndef test():\n with open(\"CVfolds_2.txt\", newline='') as id2set, open(\"rec_id2filename.txt\", newline='... | python | chosen |
[
{
"from": "human",
"value": "Add missing migrations for last commit\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-02-08 21:18\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migr... | python | chosen |
[
{
"from": "human",
"value": "bots: Add tests for followup bot.\n\n'followup' bot has different message handling behavior for\ndifferent messages.\nFor usual messages it calls 'send_message' function of\n'BotHandlerApi' class.\nFor empty messages it calls 'send_reply' function of\n'BotHandlerApi' class.\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add a migration script that reindex the contents\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom ideascube.search.utils import create_index_table\n\nreindex = lambda *args: cr... | python | chosen |
[
{
"from": "human",
"value": "Add little script to do basic cleanup after git svn clone\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport subprocess\nimport os.path\nimport sys\nimport re\n\nfrom contextlib import contextmanager\n\nTAGS_RE = re.compile('.+/tags/(.+)')\n\n\ndef git(... | python | chosen |
[
{
"from": "human",
"value": "Reformat source files, add some docstrings.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nimport numpy as nm\n\nfrom sfepy.base.base import basestr, Container, Struct\nfrom sfepy.discrete.functions import Function\n\nfrom sfepy.discrete.con... | python | chosen |
[
{
"from": "human",
"value": "Solve lisa workbook w/ too many nested loops\n"
},
{
"from": "gpt",
"value": "chapters, problems_per_page = list(map(int, input().strip().split(' ')))\nproblems_per_chapter = list(map(int, input().strip().split(' ')))\n\npages = [[]]\nspecial_problems = 0\n\nfor chap... | python | chosen |
[
{
"from": "human",
"value": "Add missing no-op migration for realm_emoji.\n\nBecause of how Django's migration system works, changing the error\nmessage attached to a model field's validator results in an extra\nmigration.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__... | python | chosen |
[
{
"from": "human",
"value": "Add notification for schedule being posted\n"
},
{
"from": "gpt",
"value": "from consts.notification_type import NotificationType\nfrom notifications.base_notification import BaseNotification\n\n\nclass SchedulePostedNotification(BaseNotification):\n\n def __init_... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for the logger\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logbook\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add script that creates an addendum to the english superset, to account for new dictionaries being added. Ensures we don't already have the english words in the existing set before adding them in\n"
},
{
"from": "gpt",
"value": "import optparse\nimport os\n\noptparse... | python | chosen |
[
{
"from": "human",
"value": "Add a script for EtherBone transfers profiling\n"
},
{
"from": "gpt",
"value": "import time\nimport cProfile\n\nimport argparse\n\nfrom utils import memread, memwrite\n\ndef run(wb, rw, n, *, burst, profile=True):\n datas = list(range(n))\n\n ctx = locals()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for formatter raw\n"
},
{
"from": "gpt",
"value": "import unittest, argparse\nfrom echolalia.formatter.rawer import Formatter\n\nclass RawerTestCase(unittest.TestCase):\n\n def setUp(self):\n self.parser = argparse.ArgumentParser()\n self.data = [{ch... | python | chosen |
[
{
"from": "human",
"value": "Add script to copy the files to their correct location (e.g. during testing)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python2\n# Copyright (c) 2015 Kenneth Henderick <kenneth@ketronic.be>\n#\n# Permission is hereby granted, free of charge, to any person obtaining ... | python | chosen |
[
{
"from": "human",
"value": "Upgrade script to add many:many relationship between orgs and rps.\n"
},
{
"from": "gpt",
"value": "from alembic import op\nimport sqlalchemy as sa\n\n\n\"\"\"empty message\n\nRevision ID: 63262fe95b9c\nRevises: 13a45e9375d7\nCreate Date: 2018-02-28 13:17:47.248361\n... | python | chosen |
[
{
"from": "human",
"value": "Add test to check when an acceptor name is bad\n\nHad this in my tree but forgot to add to the commit.\nRelated to #131\n\nSigned-off-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# Copyright ... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for DVR router.\n\nChange-Id: Iafa10dc02626a40a90c48f74c363d977ac4f512f\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": "Add tests for summing sector ids.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom sum_sector_ids import (extract_checksum,\n create_checksum,\n is_valid_checksum,\n extract_sect... | python | chosen |
[
{
"from": "human",
"value": "Add tool to find scan roots.\n\nBug: 73625480\nChange-Id: I93b405feb999aaed9675d2ea52712663fa83c9e0"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Copyright (C) 2018 The Android Open Source Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"... | python | chosen |
[
{
"from": "human",
"value": "Add python test for notes length validation\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom werkzeug.datastructures import MultiDict\n\nfrom cla_public.app import create_app\nfrom cla_public.apps.contact.forms import ContactForm\n\n\ndef submit(**kwargs):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test exhibiting cursor failure\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom mock import Mock\n\nfrom sentry.utils.cursors import build_cursor, Cursor\n\n\ndef build_mock(**attrs):\n obj = Mock()\n for key, value in attrs.i... | python | chosen |
[
{
"from": "human",
"value": "Add test for communicating with the interoperability server. This will allow us to verify we can make connection with the judges' server at competition\n"
},
{
"from": "gpt",
"value": "from time import sleep\nfrom SUASSystem import InteropClientConverter\n\nif __name... | python | chosen |
[
{
"from": "human",
"value": "Revert \"We do not support character buffer protocol on QStrings.\"\n\nThis reverts commit 1a7cbb2473327abad936447c47818ee13df2992c.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n'''Tests QString implementation of Python buffer protocol... | python | chosen |
[
{
"from": "human",
"value": "Add a new organisation for letter branding\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0150_another_letter_org\nRevises: 0149_add_crown_to_services\nCreate Date: 2017-06-29 12:44:16.815039\n\n\"\"\"\n\n# revision identifiers, used by Alembic.... | python | chosen |
[
{
"from": "human",
"value": "Add a helper tool which clears zookeeper test dirs\n\nCreate a tool that can clear any leftover garbage left\nby the testing of taskflow unit tests with zookeeper for\nwhen this is needed (for example, a test does not clean up\ncorrectly on its own).\n\nChange-Id: Icfaf28273b76a... | python | chosen |
[
{
"from": "human",
"value": "Add tests for tileutils module\n"
},
{
"from": "gpt",
"value": "import pytest\nimport numpy as np\n\nfrom pytilemap.tileutils import posFromLonLat, lonLatFromPos\n\n\nLATITUDES = np.arange(-90, 90).astype(np.float64)\nLONGITUDES = np.arange(-180, 180).astype(np.float... | python | chosen |
[
{
"from": "human",
"value": "[Feature] Add marshal fields to map with models.\n"
},
{
"from": "gpt",
"value": "\"\"\"This module defines the format used by marshall to map the models.\"\"\"\nfrom flask_restful import fields\n\nbucketlistitem_serializer = {\n 'id': fields.Integer,\n 'item_n... | python | chosen |
[
{
"from": "human",
"value": "Add tool to make dates for second Tuesday in a month\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding: utf-8\n\"\"\"Make dates on second Tuesday of the month for full year\"\"\"\n\n\nimport datetime\nimport sys\n\n\ndef second_tuesday(year, month):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add PluginManager class and IPlugin interface\n\nThis file should have been included in commit 46c1c31a2bf3c3d953d35195667ccc1af7df3c04\n\nReferences #4\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\nCopyright 2011 Ryan Fobel\r\n\r\nThis file is part of dmf_control_board... | python | chosen |
[
{
"from": "human",
"value": "Add a new snippet 'python/generators' (Fibonacci).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)\n\n# Permission is hereby granted, free of charge, to any person obtaining ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test of navbar context processor\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.http import HttpRequest\n\nfrom core.context_processors import navbar\nfrom board.models import Board\n\n\nclass TestNavbarContextProcessor(TestCa... | python | chosen |
[
{
"from": "human",
"value": "Add a script to find placeholers in legislation\n\nThis script requires BeautifulSoup (bs4)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport fnmatch\nimport sys\n\nfrom bs4 import BeautifulSoup\n\n\ndef find_param_files(input_dir):\n p... | python | chosen |
[
{
"from": "human",
"value": "Add a simple HTTP/2 file server for testing\n"
},
{
"from": "gpt",
"value": "\"\"\"A simple HTTP/2 file server.\"\"\"\n\nimport asyncio\nimport logging\nimport sys\nfrom concurrent.futures.thread import ThreadPoolExecutor\n\nimport os.path\nimport urllib.parse\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add Alert class as well as connect and check_rule methods.\n"
},
{
"from": "gpt",
"value": "class Alert:\n def __init__(self, description, rule, action):\n self.description = description\n self.rule = rule\n self.action = action\n self.... | python | chosen |
[
{
"from": "human",
"value": "Add file for control person detection\n"
},
{
"from": "gpt",
"value": "import argparse\nimport json\nimport tensorflow as tf\n\nfrom aovek.preprocess.download_dataset import download_dataset\nfrom aovek.preprocess.data_processing import DataProcessing\nfrom aovek.tra... | python | chosen |
[
{
"from": "human",
"value": "Add more complicated test of epsilon rules restoration\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 20.08.2017 16:01\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import TestCase, main\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add script to automate the creation of the Neon app.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\nimport os\nimport shutil\nimport subprocess\n\nMAIN_WINDOW_UI_FILE = 'src/opencmiss/neon/ui/ui_mainwindow.py'\n\n\ndef remove_parent_of_menubar():\n with ... | python | chosen |
[
{
"from": "human",
"value": "Add tempest unit test to verify the test list\n\nIf there is an error in a test file it could potentially not get run\nin the tox jobs used for gating. This commit adds a test which looks\nfor ImportFailures in the test list to ensure that all the test files\nwill get run in the... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for logspace_int.\n"
},
{
"from": "gpt",
"value": "from nose.tools import *\n\nimport numpy as np\n\nimport buhmm.misc as module\n\ndef test_logspace_int_smoke():\n # Smoke test\n x = module.logspace_int(2000, 50)\n y = np.array([\n 0... | python | chosen |
[
{
"from": "human",
"value": "Add a very simple test\n"
},
{
"from": "gpt",
"value": "import safe\n\n\ndef test_simple_exception():\n class MockReponse(object):\n def json(self):\n return {'status': False,\n 'method': 'synchronize',\n 'mo... | python | chosen |
[
{
"from": "human",
"value": "Add build flags for YouCompleteMe.\n\nAdd a .ycm_extra.conf.py script to return the same CFLAGS\nwe pass for `make debug`. These are passed to libclang\nso symbol lookup works correctly.\n\nNote this doesn't pick up changes to the build config,\nincluding non-default locations f... | python | chosen |
[
{
"from": "human",
"value": "Add \"Circle Inversion Fractals (Apollonian Gasket)\"\n"
},
{
"from": "gpt",
"value": "# Circle Inversion Fractals (Apollonian Gasket) (Escape-time Algorithm)\n# FB36 - 20131031\nimport math\nimport random\nfrom collections import deque\nfrom PIL import Image\nimgx =... | python | chosen |
[
{
"from": "human",
"value": "TST: Add module-based tests to the `pass` tests\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nnp.char\nnp.ctypeslib\nnp.emath\nnp.fft\nnp.lib\nnp.linalg\nnp.ma\nnp.matrixlib\nnp.polynomial\nnp.random\nnp.rec\nnp.testing\nnp.version\n\nnp.__all__\nnp.__path__... | python | chosen |
[
{
"from": "human",
"value": "Add a rudimentary trace shrinker, implemented in python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Given an axe trace that fails a given consistency model, try to find\n# the smallest subset of the trace that also fails the model. This\n# makes it e... | python | chosen |
[
{
"from": "human",
"value": "Add small script to start calculating error from kmer motifs, prototyping\n"
},
{
"from": "gpt",
"value": "from __future__ import division\nimport numpy as np\nfrom utilBMF.HTSUtils import pFastqProxy, pFastqFile\n\nconsInFq1 = pFastqFile(\"/home/brett/Projects/BMFTo... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for distinct random order filter\n"
},
{
"from": "gpt",
"value": "from datetime import date\n\nimport pytest\nfrom freezegun import freeze_time\n\nfrom adhocracy4.filters.filters import DistinctOrderingFilter\nfrom tests.apps.questions.models import Q... | python | chosen |
[
{
"from": "human",
"value": "Add function to read length of bytes in the buffer from the kernel\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom cffi import FFI as _FFI\nimport fcntl\nimport array\n\n_ffi = _FFI()\n_ffi.cdef(\"\"\"\n#define FIONREAD ...\n\"\"\")\n\n_C = _ffi.verify(\... | python | chosen |
[
{
"from": "human",
"value": "Add test for PR-56(Fix binary decode)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom unittest import TestCase\n\nfrom bson import dumps, loads\n\n\nclass TestBinary(TestCase):\n def setUp(self):\n lyrics = b\"\"\"\n I've Had Enough - Ea... | python | chosen |
[
{
"from": "human",
"value": "Add unit test to cover Mako entry point.\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\r\n\r\nfrom dogpile.cache import util\r\n\r\n\r\nclass MakoTest(TestCase):\r\n \"\"\" Test entry point for Mako\r\n \"\"\"\r\n\r\n def test_entry_point(se... | python | chosen |
[
{
"from": "human",
"value": "Add simple testcase for identifier\n"
},
{
"from": "gpt",
"value": "import angr\nimport nose\nimport identifier\n\nimport os\nbin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries-private'))\n\nimport logging\nlogging.getLogger(... | python | chosen |
[
{
"from": "human",
"value": "Copy from my project create-txt-file-by-name.\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\n\n'''\n這個程式能夠為同目錄下的所有檔案(含子資料夾)都建立一個同名的txt檔\n'''\n\nimport os\n\ndef create_txt_file(fileSimpleName):\n fileName = (fileSimpleName + \".txt\")\n fileopen = ope... | python | chosen |
[
{
"from": "human",
"value": "Add migration mentioned in last commit...\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add all test runner for command line. Now every test can be run for commandline\n"
},
{
"from": "gpt",
"value": "import glob\nimport unittest\nimport os, sys\n\nif __name__ == '__main__':\n PROJECT_ROOT = os.path.dirname(__file__)\n test_file_strings = glob.glo... | python | chosen |
[
{
"from": "human",
"value": "JM: Add example read of previously written LCIO using Python\n\n"
},
{
"from": "gpt",
"value": "import lcio\n\nfac = lcio.LCFactory.getInstance()\nrdr = fac.createLCReader()\nrdr.open(\"write_test.slcio\")\nevt = rdr.readNextEvent()\ncoll = evt.getSimCalorimeterHitCo... | python | chosen |
[
{
"from": "human",
"value": "Add script to decode an internal error backtrace\n"
},
{
"from": "gpt",
"value": "'''\nScript to decode an internal error backtrace\n'''\n\nimport sys\nfrom subprocess import Popen, PIPE\n\nif len(sys.argv) != 2 and len(sys.argv) != 3:\n print 'Usage: %s <path to in... | python | chosen |
[
{
"from": "human",
"value": "Add new collector\nGet JSON and transform it into flat metrics\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\n\"\"\"\nSimple collector which get JSON and parse it into flat metrics\n\n#### Dependencies\n\n * urllib2\n\n\"\"\"\n\nimport urllib2\nimport json\nimpor... | python | chosen |
[
{
"from": "human",
"value": "Add script to demo Sense HAT buttons\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# from https://pythonhosted.org/sense-hat/api/#joystick\n\nfrom sense_hat import SenseHat, ACTION_PRESSED, ACTION_HELD, ACTION_RELEASED\nfrom signal import pause\n\nx = 3\n... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 540. Single Element in a Sorted Array\n\n540. Single Element in a Sorted Array: https://leetcode.com/problems/single-element-in-a-sorted-array/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def singleNonDuplicate(self, nums):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add and Search Word - Data structure design: cheat with `re`\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\n# author: Fei Gao\n#\n# Add And Search Word Data Structure Design\n\n# Design a data structure that supports the following two operations:\n# void addWord... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of the MT-940 parser\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom django_banking.models import MT940\n\ndef parse_mt940(input):\n\n messages = []\n message = None\n\n for line in input:\n\n if line.startswith(':... | python | chosen |
[
{
"from": "human",
"value": "Add a test for a film deletting.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom selenium import webdriver\nfrom selenium.common.exceptions import NoSuchElementException\nimport unittest\n\n\nclass AddFilm(unittest.TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Python script to read mouse delta position events\n"
},
{
"from": "gpt",
"value": "import struct\nfile = open (\"/dev/input/mice\",\"rb\");\n\ndef getMouseEvent():\n\tbuf = file.read(3);\n\tx,y = struct.unpack(\"bb\", buf[1:] );\n\tprint (\"x:%d, y:%d\\n\" % (x,y... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for SMAPE\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom pmdarima.metrics import smape\nimport numpy as np\nimport pytest\n\n\n@pytest.mark.parametrize(\n 'actual,forecasted,expected', [\n pytest.param([0.07533, 0.07533, 0.07... | python | chosen |
[
{
"from": "human",
"value": "Add a really simple burn-in test helper\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Burn-in test: Keep LEDs at full brightness most of the time, but dim periodically\n# so it's clear when there's a problem.\n\nimport opc, time, math\n\nnumLEDs = 512\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate a historic version of wna affect\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom time import sleep\nimport json\nimport codecs\nfrom emotools.lexicon import get_spelling_variants\nimport pandas as pd\n\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests to function parsing CTestTestfile.cmake\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except... | python | chosen |
[
{
"from": "human",
"value": "Add Bootstrap Google Tour example\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\n\n\nclass MyTourClass(BaseCase):\n\n def test_google_tour(self):\n self.open('https://google.com')\n self.wait_for_element('input[title=\"Search\"]'... | python | chosen |
[
{
"from": "system",
"value": "BUG: Fix forgotten import in example\n"
},
{
"from": "human",
"value": "\"\"\"Non linear regression with Support Vector Regression (SVR)\nusing RBF kernel\n\"\"\"\n###############################################################################\n# Generate sample dat... | python | chosen |
[
{
"from": "human",
"value": "Add script for appending entries to .gitignore.\n\nTBR=kjellander\n\nReview URL: https://webrtc-codereview.appspot.com/1629004\n\ngit-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@4193 4adac7df-926f-26a2-2b94-8c16560cd09d\n"
},
{
"from": "gpt",
"value": "#!/usr/bi... | python | chosen |
[
{
"from": "human",
"value": "Copy subtree plugin. Unfinished and untested.\n"
},
{
"from": "gpt",
"value": "\"\"\"Copy values or subtrees, either locally or remotely.\n\nCurrently a quick hack using either direct database access or httplib2, synchronously.\nShould use callUrl, so local/remote be... | python | chosen |
[
{
"from": "human",
"value": "Add benchmark script for python 3\n"
},
{
"from": "gpt",
"value": "from time import clock\nfrom random import choice, randint, seed\nfrom sys import stdout\n\nimport ahocorasick\n\n\ndef write(str):\n stdout.write(str)\n stdout.flush()\n\n\ndef writeln(str):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example script to print out all updates\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# A simple script to print all updates received\n\nfrom telethon import TelegramClient\nfrom getpass import getpass\nfrom os import environ\n# environ is used to ge... | python | chosen |
[
{
"from": "human",
"value": "Test getting the logs (broken)"
},
{
"from": "gpt",
"value": "from httmock import urlmatch, HTTMock\nimport unittest\nfrom myria import MyriaConnection\n\n\n@urlmatch(netloc=r'localhost:8753')\ndef local_mock(url, request):\n print url\n if url.path == '/logs/s... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.