conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add The Learning Experience spider\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport re\n\nfrom locations.items import GeojsonPointItem\n\n\nclass TheLearningExperienceSpider(scrapy.Spider):\n name = \"learning_experience\"\n allow... | python | chosen |
[
{
"from": "system",
"value": "Remove coverage options from default test run\n\nThese were getting annoying for normal runs.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\nimport logging\nfrom optparse import OptionParser\n\nfrom tests.config import configure\n\nlogging.dis... | python | chosen |
[
{
"from": "human",
"value": "Add crude script to draw glowing lines; currently the dark part hides other lines, making them look physical; should be additive\n"
},
{
"from": "gpt",
"value": "from PIL import Image, ImageDraw\n\nimport random\n\nW = 500\nim = Image.new('RGB', (W, W))\nNCOLORS = 19... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for the rand module\n"
},
{
"from": "gpt",
"value": "'''\nTest sorbic.utils.rand\n'''\n# import sorbic libs\nimport sorbic.utils.rand\n# Import python libs\nimport unittest\n\n\nclass TestRand(unittest.TestCase):\n '''\n Cover db funcs\n ''... | python | chosen |
[
{
"from": "human",
"value": "Create parametrized superclass for tests\n\n* Since the tests require that some parameters be provided while running\n the tests, create a class that helps abstract away the details of\n retrieving and setting the expected parameters.\n"
},
{
"from": "gpt",
"value"... | python | chosen |
[
{
"from": "human",
"value": "Remove Duplicates from Sorted List II\n"
},
{
"from": "gpt",
"value": "# Definition for singly-linked list.\nclass ListNode:\n def __init__(self, x):\n self.val = x\n self.next = None\n\nclass Solution:\n # @param head, a ListNode\n # @return a... | python | chosen |
[
{
"from": "human",
"value": "Add simple mrequests GET example\n\nSigned-off-by: Christopher Arndt <711c73f64afdce07b7e38039a96d2224209e9a6c@chrisarndt.de>\n"
},
{
"from": "gpt",
"value": "import mrequests as requests\n\n\nhost = 'http://localhost/'\nurl = host + \"get\"\nr = requests.get(url, he... | python | chosen |
[
{
"from": "human",
"value": "Fix past migration scripts discrepancies\n\nIt is important that running all migration scripts from first to last\nwill give the expected model.\n\nThis fix is a first step. It fixes all discrepancies from previous\nscripts.\n\nThere are still changes in the model that needs to ... | python | chosen |
[
{
"from": "human",
"value": "Test tool for checking entropy available in a loop\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os\nimport logging\nimport time\n\nlog = logging.getLogger(__name__)\nlog.setLevel(logging.INFO)\nmainHandler = logging.StreamHandler()\nma... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for profile.Profile.\n\nAddresses #3.\n"
},
{
"from": "gpt",
"value": "import tempfile\nimport unittest\nimport unittest.mock\n\nfrom . import profile\nfrom . import test_helper\n\n\n@unittest.mock.patch.object(\n profile.Profile,\n 'generate',\n au... | python | chosen |
[
{
"from": "human",
"value": "Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM=\"rel\" env parameters\nto aid debugging.\n"
},
{
"from": "gpt",
"value": "import getopt, sys\n\nif __name__ == '__main__':\n sippy_path = None\n\n try:\n opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')\... | python | chosen |
[
{
"from": "human",
"value": "Add helpers to make Jinja2 more like Angular: PermissiveUndefined, JSDict, and JSList.\n"
},
{
"from": "gpt",
"value": "from __future__ import (division, absolute_import, print_function,\n unicode_literals)\n\nimport jinja2\n\n\nclass Permissiv... | python | chosen |
[
{
"from": "human",
"value": "Add pseudo for connected components\n"
},
{
"from": "gpt",
"value": "def get_connected_components():\n # assume nodes labeled 1 to n\n # connected_components = []\n # for i in 1..n\n # if i not yet explored\n # connected_component = bfs (gr... | python | chosen |
[
{
"from": "human",
"value": "Add azure id creation tests\n"
},
{
"from": "gpt",
"value": "from urllib.parse import urlparse\n\nimport pytest\n\nfrom django.urls import reverse\n\nfrom tests.utils import BaseViewTest\n\n\n@pytest.mark.sso_mark\nclass AzureIdentityTest(BaseViewTest):\n def test... | python | chosen |
[
{
"from": "human",
"value": "Define an iterable frame buffer.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nh2/frame_buffer\n~~~~~~~~~~~~~~~\n\nA data structure that provides a way to iterate over a byte buffer in terms of\nframes.\n\"\"\"\nfrom hyperframe.frame import Frame\... | python | chosen |
[
{
"from": "human",
"value": "Add module for helmholtz results\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\nfrom helmholtz import MixedHelmholtzProblem\nfrom meshes import generate_2d_square_mesh\n\nimport matplotlib... | python | chosen |
[
{
"from": "human",
"value": "Test using bezier going through 4 specific points\n\n\n\ngit-svn-id: 5665c17dde288ce6190d85f4a2d6486351776710@869 f663ce52-ac46-0410-b8de-c1c220b0eb76\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nimport sys\nimport os\nsys.path.insert(0, os.pat... | python | chosen |
[
{
"from": "human",
"value": "Add script for counting all users count\n"
},
{
"from": "gpt",
"value": "import os\nimport telegram\nfrom leonard import Leonard\n\ntelegram_client = telegram.Bot(os.environ['BOT_TOKEN'])\nbot = Leonard(telegram_client)\nbot.collect_plugins()\n\n\ndef main():\n co... | python | chosen |
[
{
"from": "human",
"value": "Add script attach device rbd\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n__author__ = 'weezhard'\n__license__ = 'GPL'\n__version__ = '1.0.0'\n\nimport sys\nimport argparse\nimport libvirt\nimport subprocess\n\nparser = argparse.ArgumentParser()\nparser... | python | chosen |
[
{
"from": "human",
"value": "Add example for using Python in JS\n"
},
{
"from": "gpt",
"value": "# doc-export: UsingPython\n\"\"\"\nThis example demonstrates what things from Python land can be used in JS.\n\nFlexx detects what names are used in the transpiled JS of a Model (or\nWidget class, an... | python | chosen |
[
{
"from": "human",
"value": "Add script to find malformed rules\n"
},
{
"from": "gpt",
"value": "# Print list of rules with invalid algs\n\nfrom api import config\nfrom api.dao import APINotFoundException\nfrom api.jobs.gears import get_gear_by_name\n\nif __name__ == '__main__':\n\n for rule ... | python | chosen |
[
{
"from": "human",
"value": "Add one-off script to convert a list of programming languages to JSON\n"
},
{
"from": "gpt",
"value": "''' One-off junk code to convert a list of programming languages with some extra information in the comments to JSON\n'''\n\nfrom collections import OrderedDict\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add file for Rule.rule tests\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\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rule\n\n\nclass From... | python | chosen |
[
{
"from": "human",
"value": "Create script to execute Marcotti ETL\n"
},
{
"from": "gpt",
"value": "from interface import Marcotti\nfrom models.config.local import LocalConfig\nfrom etl import get_local_handles, ingest_feeds\nfrom etl.csv import CSV_ETL_CLASSES\n\n\nif __name__ == \"__main__\":\... | python | chosen |
[
{
"from": "human",
"value": "Use stack to solve the problem\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis is the interface that allows for creating nested lists.\nYou should not implement it, or speculate about its implementation\n\"\"\"\nclass NestedInteger(object):\n def isInteger(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Make Pepper WebSocket UtilityGetProtocol test less flaky by making the wsh wait for close\n\nAttempt to fix the flakiness by making sure the server handler doesn't exit\nbefore the client closes.\n\nBUG=389084\nR=jgraettinger,yhirano\n\nReview URL: https://codereview.chromium.o... | python | chosen |
[
{
"from": "human",
"value": "Add one-off script to fix nodes with no creator\n\nOSF-8571\n"
},
{
"from": "gpt",
"value": "import logging\nimport sys\n\nfrom django.db import transaction\n\nfrom website.app import setup_django\nsetup_django()\nfrom osf.models import AbstractNode\nfrom scripts imp... | python | chosen |
[
{
"from": "human",
"value": "Add printing of color codes in matplotlib\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode... | python | chosen |
[
{
"from": "system",
"value": "fix(api): Fix formatting of API error message\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom rest_framework import serializers\n\nfrom sentry.utils.http import parse_uri_match\n\n\nclass OriginField(serializers.CharField):\n # S... | python | chosen |
[
{
"from": "human",
"value": "Add new file to test kernel efficiency warnings\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numba import cuda\nfrom numba.cuda.testing import CUDATestCase, skip_on_cudasim\nfrom numba.tests.support import override_config\nfrom numba.core.errors import N... | python | chosen |
[
{
"from": "human",
"value": "Add a helper script to dump tags to a file\n"
},
{
"from": "gpt",
"value": "# Copyright 2018 Tomas Machalek <tomas.machalek@gmail.com>\n# Copyright 2018 Charles University, Faculty of Arts,\n# Institute of the Czech National Corpus\n#\n# Licensed under... | python | chosen |
[
{
"from": "human",
"value": "Add code for extracting best pivot features from saved neural model.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\nimport numpy as np\nimport torch\nfrom learn_pivots_tm import PivotLearnerModel, StraightThroughLayer\n\ndef main(args):\n ... | python | chosen |
[
{
"from": "human",
"value": "[AIRFLOW-125] Add file to GCS operator\n\nAdds an operator to upload a file to Google Cloud Storage. Used as follows:\n```py\nfrom airflow.contrib.operators.file_to_gcs import FileToGoogleCloudStorageOperator\ngcs = FileToGoogleCloudStorageOperator(\n bucket='a-bucket-i-h... | python | chosen |
[
{
"from": "human",
"value": "Test file added to estimate performance of program between systems.\n"
},
{
"from": "gpt",
"value": "from os import system\r\nfrom time import sleep\r\nfrom msvcrt import getch\r\nfrom threading import Thread\r\n\r\nsystem('mode 50,30')\r\ngame_running = True\r\ndire... | python | chosen |
[
{
"from": "human",
"value": "Add a script to slice traces bigger than 256MB\n\nSummary:\nThe chrome://tracing viewer doesn't support files larger than 256MB,\nto make it possible to look at traces from larger builds we add this\nsimple script that splits a bigger trace into smaller chunks.\n\nTest Plan: man... | python | chosen |
[
{
"from": "human",
"value": "Add a Python 3 compatibility helper\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache License, Version 2.0. See the LICENSE file f... | python | chosen |
[
{
"from": "human",
"value": "Add an RGB LED for initial experimentation.\n"
},
{
"from": "gpt",
"value": "'''\n\nDr Who Box: RGB Effects LED\n\n'''\n\nfrom __future__ import print_function\nimport RPi.GPIO as GPIO\nimport time\nfrom multiprocessing import Process\nimport math\n\n# Define PINS\nR... | python | chosen |
[
{
"from": "human",
"value": "Add handle excel script in python\n"
},
{
"from": "gpt",
"value": "\"\"\"\n使用场景:\n有三个巨大的 Excel 文件(合计约一百三十万行)存放在 src_new 下面,\n这个脚本能读取这三个 Excel 文件,将所有数据按第 5 列的值分别存放到 dst_new 里的不同的文件里去,\ndst 文件以数据第 5 列值命名\ntemplate_new.xlsx 是一个模板文件,只含表头\n\nPython 3\n\"\"\"\n\nimport ope... | python | chosen |
[
{
"from": "human",
"value": "Add functionality: photo or 404\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom flask import Flask, abort, send_file\n\napp = Flask(__name__)\n\n\n@app.route(\"/<path:filename>/\")\ndef get_image(filename):\n if not os.path.isfile(filename):\n abort(404)... | python | chosen |
[
{
"from": "human",
"value": "Add a module that can be called from other scripts\n\n* Let's assume using the program's output as another program's input (e.g. Conky).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nfrom tas import make_schedule\nfrom tabulate import tabulate\nimport os\n... | python | chosen |
[
{
"from": "human",
"value": "Add exercise Stock Exchange Losses\n"
},
{
"from": "gpt",
"value": "def maxLoss(lst):\n\tup = lst[0]\n\tdown = lst[0]\n\tmini = down - up\n\n\tfor i, val in enumerate(lst[:-1]):\n\t\t# We are decreasing\n\t\tif (lst[i+1] < val):\n\t\t\tif val > up:\n\t\t\t\tup = val\... | python | chosen |
[
{
"from": "human",
"value": "Test program for QMessageBox formatting\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nTest code for controlling QMessageBox format.\n\"\"\"\n\nimport sys\nfrom PyQt5.QtGui import QPixmap\nfrom PyQt5.QtWidgets import (QApplica... | python | chosen |
[
{
"from": "human",
"value": "Add Python version of commhistory-tool converter\n\nDoesn't really work due to non-ASCII character handling, but adding\nnevertheless for the sake of preservation...\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom json import loads\nfrom time import strfti... | python | chosen |
[
{
"from": "human",
"value": "Add lower index to tags\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-03-30 14:55\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencie... | python | chosen |
[
{
"from": "human",
"value": "Revert \"removing migration script now that it's done\"\n\nThis reverts commit dd32cbb400fb667d05b215a60fe3682da2c1cf2b.\n"
},
{
"from": "gpt",
"value": "\"\"\"Script for migrating ipythonblocks grid data from SQLite to Postgres\"\"\"\nimport json\nimport os\nfrom pa... | python | chosen |
[
{
"from": "human",
"value": "Add test for flexget utils (json)\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom flexget.utils import json\n\n\nclass TestJson(object):\n\n def test_dt_encode(self):\n date_str = '2016-03-11T17:12:17Z'\n dt = datetime.strptime(d... | python | chosen |
[
{
"from": "system",
"value": "Add a command to run the built in werkzeug server\n"
},
{
"from": "human",
"value": "# Copyright 2013 Donald Stufft\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... | python | chosen |
[
{
"from": "human",
"value": "Add sync field to Author model\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 ('ideascale', '00... | python | chosen |
[
{
"from": "human",
"value": "Update script for problem 15 on pe\n"
},
{
"from": "gpt",
"value": "# projecteuler.net/problem=15\n\ndef main():\n answer = LatticePaths(20)\n print(answer)\n\ndef LatticePaths(x):\n x += 1 # each item represent not cell but line (for close lattice n+1)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add little script to test 2 uvfits files for equality\n\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nimport argparse\nimport os.path as op\nfrom uvdata.uv import UVData\n\nparser = argparse.ArgumentParser()\nparser.add_argument('uvfits1',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for Vector2.convert\n\nSee https://github.com/ppb/ppb-vector/pull/91#discussion_r241956449\n"
},
{
"from": "gpt",
"value": "import pytest # type: ignore\n\nfrom ppb_vector import Vector2\nfrom utils import *\n\n@pytest.mark.parametrize('vector_like', UNIT... | python | chosen |
[
{
"from": "human",
"value": "Add file for ipython notebook snippets\n"
},
{
"from": "gpt",
"value": "\"\"\"ipynb.py -- helper functions for working with the IPython Notebook\n\nThis software is licensed under the terms of the MIT License as\nfollows:\n\nCopyright (c) 2013 Jessica B. Hamrick\n\nP... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for Invitation.email\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 ('org... | python | chosen |
[
{
"from": "human",
"value": "Add constraints for unique together for org and slug in org backend, migrations\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.11 on 2018-03-21 15:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\... | python | chosen |
[
{
"from": "human",
"value": "Add wye-delta and delta-wye transformations\n"
},
{
"from": "gpt",
"value": "\"\"\"This module performs network transformations.\n\nCopyright 2020 Michael Hayes, UCECE\n\n\"\"\"\n\n\ndef Z_wye_to_delta(Z1, Z2, Z3):\n \"\"\"Perform wye to delta transformation of th... | python | chosen |
[
{
"from": "human",
"value": "Add a country field for available shipping countries\n"
},
{
"from": "gpt",
"value": "from longclaw.longclawsettings.models import LongclawSettings\nfrom longclaw.longclawshipping.models import ShippingRate\nfrom django_countries import countries, fields\n\nclass Cou... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for build\n"
},
{
"from": "gpt",
"value": "import contextlib\nimport json\nimport os\n\nfrom nose.tools import istest, assert_equal\n\nfrom whack.tempdir import create_temporary_dir\nfrom whack.files import sh_script_description, plain_file, read_file\... | python | chosen |
[
{
"from": "system",
"value": "Disable torcache for now.\nRandomize order torrent cache mirrors are added to urls list.\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@2874 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n"
},
{
"from": "human",
"value": "import logging\nimport re\nfrom flexget.plug... | python | chosen |
[
{
"from": "human",
"value": "Allow channel ops to change the required level for specific permissions\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IMode, IModuleData, Mode, ModuleData\nfrom txircd.utils import ModeType\nfrom zope.interfa... | python | chosen |
[
{
"from": "human",
"value": "Add tests for existing image\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Canonical Ltd\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You ... | python | chosen |
[
{
"from": "human",
"value": "Add cli arguments parser tests\n"
},
{
"from": "gpt",
"value": "from hamcrest import assert_that, is_\nimport pytest\n\nfrom pyhttp.cli import parse_args\n\n\ndef describe_parse_args():\n def it_returns_parsed_arguments():\n args = parse_args(['-c', '100', ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for view_all_talks permission.\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 ('t... | python | chosen |
[
{
"from": "human",
"value": "Add initial test for listener module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport pytest\n\nimport pg_bawler.core\n\n\n@pytest.mark.asyncio\nasync def test_simple_listen():\n\n class NotificationListener(\n pg_bawler.core.BawlerBase,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to test/verify alert configuration\n\nWe're looking to build out another alerter or two, and wanted a way to test our current alert configurations as well as be able to trigger alerts as we developer new alerters."
},
{
"from": "gpt",
"value": "#!/usr/bin/... | python | chosen |
[
{
"from": "human",
"value": "Make some twitter plots of SVR,TOR freq hour\n\nhttps://twitter.com/akrherz/status/703776738422050816\nhttps://twitter.com/akrherz/status/703776599057895424\n"
},
{
"from": "gpt",
"value": "import matplotlib.colors as mpcolors\nimport matplotlib.cm as cm\nimport psyc... | python | chosen |
[
{
"from": "human",
"value": "Add Tunnel Zone and Tunnel Zone Host API handlers\n\nThis patch adds TunnelzoneHandlerMixin and\nTunnelzonehostHandlerMixin to the core plugin using\ngenerate_methods decorators.\n\nThis patch also adds symbols for 'list', 'show', 'create', 'update'\nand 'delete'. It'd be too ea... | python | chosen |
[
{
"from": "human",
"value": "Add local type driver unittests\n\nPartial-Bug: #1269127\n\nChange-Id: I5b34dc09128bcb879ea46be64cc5104eeefd4ab4\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2014 Thales Services SAS\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 ... | python | chosen |
[
{
"from": "human",
"value": "Add custom style which imitates the offical coloring\n\n--HG--\nbranch : igor-pro-changes-v2\n"
},
{
"from": "gpt",
"value": "from pygments.style import Style\nfrom pygments.token import Keyword, Name, Comment, String, Error, \\\n Number, Operator, Generic\n\ncla... | python | chosen |
[
{
"from": "human",
"value": "Add solution v2 for Labelmaker.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ndef solve():\n L, N = input().split(' ')\n N = int(N)\n result = ''\n\n while N > 0:\n N -= 1\n result = L[N % len(L)] + resu... | python | chosen |
[
{
"from": "human",
"value": "Add script for downloading the modern PRISM climate data\n\nThe modern PRISM data provides monthly raster precip and temperature measures\nfor the United States from 1981 to present.\n"
},
{
"from": "gpt",
"value": "#retriever\n\n\"\"\"Retriever script for direct dow... | python | chosen |
[
{
"from": "human",
"value": "Test branja serijskega vmesnika na Ubuntu-ju. \nBranje z naprave Arduino UNO."
},
{
"from": "gpt",
"value": "'''\nCreated on Nov 24, 2013\n\n@author: gregor\n'''\nfrom serial import *\nfrom threading import Thread\n\nlast_received = ''\n\ndef receiving(ser):\n whi... | python | chosen |
[
{
"from": "human",
"value": "Add script for experiment records\n"
},
{
"from": "gpt",
"value": "''' \nExperiments are recorded in this script\n\n'''\n\n\n# Experiment Date:06/24/2015\ndef compare_lab_tests_and_vitals():\n ''' Compare the ability of prediction with lab tests and vital test for... | python | chosen |
[
{
"from": "human",
"value": "ZON-4007: Add test for dummy rendering (belongs to commit:be85116)\n"
},
{
"from": "gpt",
"value": "import zeit.cms.testing\nimport zeit.content.text.jinja\nimport zeit.content.text.testing\n\n\nclass PythonScriptTest(zeit.cms.testing.FunctionalTestCase):\n\n laye... | python | chosen |
[
{
"from": "human",
"value": "Test script show how we might use the Python logger more effectively\n\n\nFormer-commit-id: cc69a6ab3b6c61fd2f3e60bd16085b81cda84e42\nFormer-commit-id: 28ba0ba57de3379bd99b9f508972cd0520c04fcb"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on... | python | chosen |
[
{
"from": "human",
"value": "Add svm experiment on test data\n"
},
{
"from": "gpt",
"value": "from svm import SVMModel\n\nif __name__ == '__main__':\n features = [\n # 'refuting',\n 'ngrams',\n # 'polarity',\n 'named',\n # 'jaccard'\n ]\n\n model = SVMModel... | python | chosen |
[
{
"from": "human",
"value": "Add script to analyze bloatview logs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http... | python | chosen |
[
{
"from": "human",
"value": "Add a unit test for flatc\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n# TODO: Duplicate code\n# Figure out how to import from flatc.py\ndef get_attrs_dict(attrs):\n attrs_dict = {x[0]: x[1] for x in attrs if len(x) == 2}\n ret = {x[0]: None for x in att... | python | chosen |
[
{
"from": "human",
"value": "psa: Add a script to validate PSA targets\n\nAdd a script to parse `targets.json` to identify PSA targets and ensure\nmandatory parameters are configured correctly for all PSA targets.\n\nSigned-off-by: Devaraj Ranganna <53e2fcb007e5c6e2caf46b91114119a655266f64@arm.com>\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Add LocalDataGrabber class so tests work with local data.\n\nThis changeset adds the LocalDataGrabber class in the test source\ntree. This class exposes the same interface as Grabber -- so that\nit can be used in place of it -- but is only able to grab test\ndata from the local ... | python | chosen |
[
{
"from": "human",
"value": "Add file for tests, when no rule is specified\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\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rul... | python | chosen |
[
{
"from": "human",
"value": "Add a script for running pytest with the correct sys.path.\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\"\"\"This is a script for running pytest from the command line.\n\nThis script exists so that the project directory gets added to sys.path, which\nprevents us... | python | chosen |
[
{
"from": "human",
"value": "Add prototype code for testing scalability.\n"
},
{
"from": "gpt",
"value": "# test_scalability.py\n# Ronald L. Rivest with Huasyn Karimi\n\nimport syn2\n\ndef tester(se):\n\n # copy code here from syn2.test; modify as needed\n\ndef test_scale(k):\n\n # start t... | python | chosen |
[
{
"from": "human",
"value": "Add first basic unittests using py.test\n"
},
{
"from": "gpt",
"value": "\"\"\"\n test_validators\n ~~~~~~~~~~~~~~\n \n Unittests for bundled validators.\n \n :copyright: 2007-2008 by James Crasta, Thomas Johansson.\n :license: MIT, see LICENSE.t... | python | chosen |
[
{
"from": "human",
"value": "Add template filters test cases\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom flask import render_template_string\n\n\ndef test_nl2br_filter(app):\n s = '{{ \"\\n\"|nl2br }}'\n rs = rend... | python | chosen |
[
{
"from": "human",
"value": "Add a few tests for Tee\n"
},
{
"from": "gpt",
"value": "from .context import tohu\nfrom tohu.v6.primitive_generators import Integer, TimestampPrimitive\nfrom tohu.v6.derived_generators import IntegerDerived, Tee\nfrom tohu.v6.derived_generators_v2 import TimestampDe... | python | chosen |
[
{
"from": "human",
"value": "Add a script to generate some files to be used for the sensor calibration\n"
},
{
"from": "gpt",
"value": "from pymavlink import mavutil\n\nfileout = open('acc.txt', 'w')\nfilemag = open('mag.txt', 'w')\nfilegyro = open('gyro.txt', 'w')\n\n# create a mavlink serial i... | python | chosen |
[
{
"from": "human",
"value": "Add User object to model\n"
},
{
"from": "gpt",
"value": "from flask import current_app\nfrom passlib.apps import custom_app_context as pwd_context\nfrom itsdangerous import (TimedJSONWebSignatureSerializer\n as Serializer, BadSignature, Sign... | python | chosen |
[
{
"from": "human",
"value": "Add sending raw packet example"
},
{
"from": "gpt",
"value": "from socket import *\n\ndef send_packet(src, dst, eth_type, payload, interface = \"eth0\"):\n \"\"\"Send raw Ethernet packet on interface.\"\"\"\n\n assert(len(src) == len(dst) == 6) # 48-bit ethernet ad... | python | chosen |
[
{
"from": "human",
"value": "Add basic search by pmcid\n"
},
{
"from": "gpt",
"value": "import requests, untangle\n\npmcid = 'PMC3834665'\nepmc_basequeryurl = \"http://www.ebi.ac.uk/europepmc/webservices/rest/search\"\n\n''' Make query to EuropePMC'''\nquery = {'query':pmcid,'resulttype':'core'}... | python | chosen |
[
{
"from": "human",
"value": "Add functions to handle temp directory for download\n"
},
{
"from": "gpt",
"value": "import os\nimport time\n\nTMP_DIR = \"/tmp/lobster\"\n\ndef get_tempdir():\n tmp_path = TMP_DIR\n if not os.path.isdir(tmp_path):\n os.mkdir(tmp_path)\n return tmp_pa... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the IATI wiki\n\nThis adds tests to ensure that IATI wiki is up and contains specified links\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom web_test_base import *\n\nclass TestIATIWiki(WebTestBase):\n urls_to_get = [\n \"http://wiki.arch... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for the HansenLaw implementation\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os.path\n\nimport numpy as np\nfrom numpy.testing import assert_a... | python | chosen |
[
{
"from": "human",
"value": "Add better solution for nth prime\n"
},
{
"from": "gpt",
"value": "def nth_prime(n):\n if n <= 0:\n raise ValueError\n for i, prime in enumerate(prime_gen()):\n if n == i + 1:\n return prime\n\ndef prime_gen():\n def n_gen():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add initial unit test for openstack cloud module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Bo Maryniuk <bo@suse.de>`\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing Libs\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add helper for HTTP/2 SSL context\n"
},
{
"from": "gpt",
"value": "__all__ = [\n 'make_ssl_context',\n]\n\nimport ssl\n\n\ndef make_ssl_context(crt, key):\n ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)\n ssl_context.load_cert_chain(crt, key)\n if ss... | python | chosen |
[
{
"from": "human",
"value": "Add tests for some shop POIs\n"
},
{
"from": "gpt",
"value": "from . import FixtureTest\n\n\nclass FeaturesTest(FixtureTest):\n def test_shops(self):\n self._run_test(\n 'http://www.openstreetmap.org/node/2893904480',\n '16/19299/24631... | python | chosen |
[
{
"from": "human",
"value": "Add standings checker to prevent friendly fire\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom eveapi import eveapi\nimport ChatKosLookup\nimport sys\n\nclass StandingsChecker:\n def __init__(self, keyID, vCode):\n self.checker = ChatKosLookup.KosCheck... | python | chosen |
[
{
"from": "human",
"value": "Add utility to create administrative users.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport rethinkdb as r\nfrom optparse import OptionParser\nimport sys\n\n\ndef create_group(conn):\n group = {}\n group['name'] = \"Admin Group\"\n group['desc... | python | chosen |
[
{
"from": "human",
"value": "[skip ci] Add script to get bus stops from datamall\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport urllib.request\nimport json\nimport os\nimport sys\n\n\nendpoint = 'http://datamall2.mytransport.sg/ltaodataservice/BusStops?$skip='\n\n\ndef get_bus_sto... | python | chosen |
[
{
"from": "human",
"value": "Create Queue with pop and put\n"
},
{
"from": "gpt",
"value": "import sqlite3 as sql\n\nclass Queue(object):\n def __init__(self, db_filename):\n self.con = sql.connect(db_filename)\n self._create_tables()\n\n def _create_tables(self):\n with self.con:\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.