conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add unit tests for timestr()\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# ex:ts=4:sw=4:sts=4:et\n# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-\n\n# The unittest framwork doesn't play nice with pylint:\n# pylint: disable-msg=C0103\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add initial test for routes.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\n\nimport website\nimport unittest\nimport tempfile\n\nclass FPOTestCase(unittest.TestCase... | python | chosen |
[
{
"from": "human",
"value": "Add problem 35, circular primes\n"
},
{
"from": "gpt",
"value": "from math import sqrt\nfrom time import time\n\nPRIME_STATUS = {}\n\n\ndef is_prime(n):\n if n == 2:\n return True\n if n % 2 == 0 or n <= 1:\n return False\n for i in range(3, in... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for lazy strings\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))\n\n\nfrom stringlike.lazy import LazyString, CachedLazyString\nfrom unittest import main, ... | python | chosen |
[
{
"from": "human",
"value": "Create a new tour example\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\n\n\nclass MyTourClass(BaseCase):\n\n def test_google_maps_tour(self):\n self.open(\"https://www.google.com/maps/@42.3598616,-71.0912631,15z\")\n self.wait_f... | python | chosen |
[
{
"from": "human",
"value": "Add small example of basic anomaly detection w/peewee.\n"
},
{
"from": "gpt",
"value": "import math\nfrom peewee import *\n\n\ndb = SqliteDatabase(':memory:')\n\nclass Reg(Model):\n key = TextField()\n value = IntegerField()\n\n class Meta:\n database... | python | chosen |
[
{
"from": "human",
"value": "Add decision tree classifier attempt.\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nfrom sklearn import tree\n\n# X = [[0, 1], [1, 1]]\n# Y = [0, 1]\n#clf = tree.DecisionTreeClassifier()\n#clf = clf.fit(X, Y)\n\ndata = pd.read_excel('/home/andre/sandbox/jhu-i... | python | chosen |
[
{
"from": "human",
"value": "Add script to shuffle paired fastq sequences.\n"
},
{
"from": "gpt",
"value": "# shuffles the sequences in a fastq file\nimport os\nimport random\nfrom Bio import SeqIO\nimport fileinput\nfrom argparse import ArgumentParser\n\nif __name__ == \"__main__\":\n parser... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate other adobe themes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom PIL import Image, ImageEnhance\nimport PIL.ImageOps\nimport fnmatch\nimport shutil\nimport os\n\ndef globPath(path, pattern):\n result = []\n for root, subdir... | python | chosen |
[
{
"from": "human",
"value": "Add rolling mean scatter plot example\n"
},
{
"from": "gpt",
"value": "\"\"\"\nScatter Plot with Rolling Mean\n------------------------------\nA scatter plot with a rolling mean overlay. In this example a 30 day window\nis used to calculate the mean of the maximum te... | python | chosen |
[
{
"from": "system",
"value": "Use cache backend for sessions in deployed settings.\n"
},
{
"from": "human",
"value": "\nDATABASES = {\n \"default\": {\n # Ends with \"postgresql_psycopg2\", \"mysql\", \"sqlite3\" or \"oracle\".\n \"ENGINE\": \"django.db.backends.postgresql_psyco... | python | chosen |
[
{
"from": "human",
"value": "Add migration to remove non-{entity,classifier} dimensions from the database, and to recompute cubes if necessary\n"
},
{
"from": "gpt",
"value": "import logging\n\nfrom openspending.lib import cubes\nfrom openspending import migration, model, mongo\n\nlog = logging.... | python | chosen |
[
{
"from": "human",
"value": "Add Dehnen smoothing as a wrapper\n"
},
{
"from": "gpt",
"value": "###############################################################################\n# DehnenSmoothWrapperPotential.py: Wrapper to smoothly grow a potential\n############################################... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for profile items.\n\nWhen we moved profile item image content into a separate model, we\nmissed this migration when rebasing.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-08-01 14:16\nfrom __fut... | python | chosen |
[
{
"from": "human",
"value": "Add migration for new overrides table\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 ('grades',... | python | chosen |
[
{
"from": "human",
"value": "Add a failing test to the landing page to check for upcoming events.\n"
},
{
"from": "gpt",
"value": "from django.core.urlresolvers import reverse\nfrom django.test import TestCase\nfrom mock import patch\nfrom datetime import date\n\nclass FakeDate(date):\n \"A f... | python | chosen |
[
{
"from": "human",
"value": "Add script demonstrating raising and catching Exceptions.\n"
},
{
"from": "gpt",
"value": "gestures = [\"rock\", \"paper\", \"scissors\"]\n\ndef verify_move(player_move):\n if player_move not in gestures:\n raise Exception(\"Wrong input!\")\n return play... | python | chosen |
[
{
"from": "human",
"value": "Use unified class for json output\n"
},
{
"from": "gpt",
"value": "from os import path\n\nfrom ffflash import RELEASE, log, now, timeout\nfrom ffflash.lib.clock import epoch_repr\nfrom ffflash.lib.data import merge_dicts\nfrom ffflash.lib.files import read_json_file,... | python | chosen |
[
{
"from": "human",
"value": "Use filfinder to get the average radial width of features in the moment 0\n"
},
{
"from": "gpt",
"value": "\nfrom fil_finder import fil_finder_2D\nfrom basics import BubbleFinder2D\nfrom spectral_cube.lower_dimensional_structures import Projection\nfrom astropy.io im... | python | chosen |
[
{
"from": "human",
"value": "Remove Duplicates from Sorted Array problem\n"
},
{
"from": "gpt",
"value": "'''\nGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.\n\nDo not allocate extra space for another array, you must do thi... | python | chosen |
[
{
"from": "human",
"value": "Add codemod to replace __unicode__ with __str__\n"
},
{
"from": "gpt",
"value": "import sys\n\nfrom bowler import Query\n\n\n(\n Query(sys.argv[1])\n .select_function(\"__unicode__\")\n .rename('__str__')\n .idiff()\n),\n(\n Query(sys.argv[1])\n .se... | python | chosen |
[
{
"from": "system",
"value": "Bump version 0.15.0rc3 --> 0.15.0rc4\n\nSigned-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>\n"
},
{
"from": "human",
"value": "import logging\n\n__version__ = \"0.15.0rc3\"\nversion = tuple(__version__.split('.'))\n\nlogging.getLogger(__na... | python | chosen |
[
{
"from": "human",
"value": "Add initial shell of Pyglab class.\n"
},
{
"from": "gpt",
"value": "import requests\n\n\nclass Pyglab(object):\n def __init__(self, token):\n self.token = token\n self.headers = {'PRIVATE-TOKEN', token}\n self.user = None\n\n def sudo(self,... | python | chosen |
[
{
"from": "human",
"value": "Add JSON HttpResponse that does the encoding for you.\n"
},
{
"from": "gpt",
"value": "from django.core.serializers import json, serialize\nfrom django.db.models.query import QuerySet\nfrom django.http import HttpResponse\nfrom django.utils import simplejson\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "[qa] Add missing migration file to the repo\n"
},
{
"from": "gpt",
"value": "\"\"\"add person id to shot history\n\nRevision ID: e839d6603c09\nRevises: 346250b5304c\nCreate Date: 2020-12-14 12:00:19.045783\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\ni... | python | chosen |
[
{
"from": "human",
"value": "Add test for sabnzbd cleanupfilename.py\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom cleanupfilename import rename\n\n\nclass TestRename(unittest.TestCase):\n files = []\n dirs = []\n\n def setUp(self):\n self.files = [('filename-sample.x264... | python | chosen |
[
{
"from": "human",
"value": "Add auto solver for \"W3-Radix Sorts\".\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\ndef make_arr(text):\n return text.strip().split(' ')\n\n\ndef print_arr(arr):\n for t in arr:\n print(t, end=' ')\n print()\n\n\ndef solve_q1(arr, tim... | python | chosen |
[
{
"from": "human",
"value": "Add the model.py file declarative generated from mysql.\n"
},
{
"from": "gpt",
"value": "#autogenerated by sqlautocode\n\nfrom sqlalchemy import *\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import relation\n\nengine = create_engine(... | python | chosen |
[
{
"from": "human",
"value": "Remove start dates for the second time from draft dos2 briefs\n\nThis is identical to the previous migration but will be run again\nto cover any draft briefs with invalid dates that could have\nappeared during the previous API rollout process (after the previous\nmigration but b... | python | chosen |
[
{
"from": "human",
"value": "Create file and add pseudocode\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Bran Seals. All rights reserved.\n# Created: 2017-06-05\n\nprint(\"== UML to CPP ==\")\nprint(\"Create or modify C++ header and implementation files by plaintext UML.\")\n#print(\"En... | python | chosen |
[
{
"from": "human",
"value": "Add test for posting a review through the view\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for wafer.talk review form behaviour.\"\"\"\n\nfrom django.test import Client, TestCase\nfrom django.urls import reverse\n\nfrom reversion import revisions\nfrom reversion.mod... | python | chosen |
[
{
"from": "human",
"value": "Add script for word counts\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport requests\nimport ipdb\nimport time\nimport csv\nimport sys\nimport pysolr\n\ndef fetch_all( solr, query ) :\n documents = []\n num_matching_documents = solr.search( query ).... | python | chosen |
[
{
"from": "human",
"value": "Add example for a clunky 3D high resolution loupe for napari\n"
},
{
"from": "gpt",
"value": "import functools\nimport numpy as np\nimport dask.array as da\nfrom magicgui.widgets import Slider, Container\nimport napari\n\n# stack = ... # your dask array\n# stack2 = ... | python | chosen |
[
{
"from": "human",
"value": "Add new content parser class (based upon code in Konstruktuer)\n"
},
{
"from": "gpt",
"value": "#\n# Konstrukteur - Static website generator\n# Copyright 2013 Sebastian Fastner\n#\n\nimport glob, os\nfrom jasy.core import Console\nimport konstrukteur.Language\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add installation script for profiler.\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Lic... | python | chosen |
[
{
"from": "human",
"value": "Add problem 36, palindrome binaries\n"
},
{
"from": "gpt",
"value": "from time import time\n\n\ndef is_palindrome(s):\n for idx in range(len(s)/2):\n if s[idx] != s[-1*idx - 1]:\n return False\n return True\n\n\ndef main():\n palindrom_nums... | python | chosen |
[
{
"from": "human",
"value": "TST: Add test for the matrix representation function.\n\nAdd a small test in R3 for the matrix representation function, to see\nthat one gets the same matrix back.\n"
},
{
"from": "gpt",
"value": "# Copyright 2014, 2015 The ODL development group\n#\n# This file is pa... | python | chosen |
[
{
"from": "human",
"value": "Add some time handling functions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom datetime import datetime, timedelta\n\ndef todayhelper():\n today = datetime.today()\n return datetime(day=today.day, year=today.year, month=today.month)\n\ndef fo... | python | chosen |
[
{
"from": "human",
"value": "Add staff permissions for backup models\n"
},
{
"from": "gpt",
"value": "from nodeconductor.core.permissions import StaffPermissionLogic\n\n\nPERMISSION_LOGICS = (\n ('backup.BackupSchedule', StaffPermissionLogic(any_permission=True)),\n ('backup.Backup', Staf... | python | chosen |
[
{
"from": "human",
"value": "Add two-point example to serve as a regression test for gridline/plot distinguishing\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDemonstrates plotting multiple linear features with a single ``ax.pole`` call.\n\nThe real purpose of this example is to serve as an implicit... | python | chosen |
[
{
"from": "human",
"value": "Add an extra test for the OpalSerializer\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUnittests for opal.core.views\n\"\"\"\nfrom opal.core import test\n\nfrom opal.core import views\n\nclass SerializerTestCase(test.OpalTestCase):\n\n def test_serializer_default_will_... | python | chosen |
[
{
"from": "human",
"value": "Add missing tests for Variable\n"
},
{
"from": "gpt",
"value": "from gaphas.solver import Variable\n\n\ndef test_equality():\n v = Variable(3)\n w = Variable(3)\n o = Variable(2)\n\n assert v == 3\n assert 3 == v\n assert v == w\n assert not v ==... | python | chosen |
[
{
"from": "human",
"value": "Add Qt4 file to start on creating a Qt-based GUI\n"
},
{
"from": "gpt",
"value": "from lib.version import AMON_VERSION\nfrom lib.keybase import KeybaseUser\nfrom lib.gmail import GmailUser\nfrom lib.addresses import AddressBook\nimport lib.gpg as gpg\n\nimport sys\ni... | python | chosen |
[
{
"from": "human",
"value": "Add script to save ner data to a csv file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport click\nimport os\nimport codecs\nimport json\nimport pandas as pd\n\n\n@click.command()\n@click.argument('input_dir', type=click.Path(exists=True))\n@click.argume... | python | chosen |
[
{
"from": "human",
"value": "Add tests for User admin_forms\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\nfrom django.test import TestCase\n\nfrom .. import admin_forms\nfrom . factories import UserFactory\n\n\nclass UserCreationFormTest(TestCase):\n def... | python | chosen |
[
{
"from": "human",
"value": "Implement DispatchLoader (metapath import hook)\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import, unicode_literals, division\nfrom stackable.stack import Stack\nfrom stackable.utils import StackablePickler\nfrom stackable.networ... | python | chosen |
[
{
"from": "human",
"value": "Add testing for graphing code\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom click.testing import CliRunner\n\nfrom cli.script import cli\n\n\ndef get_graph_code():\n return '''\nfrom copy import deepcopy as dc\n\nclass StringCopier(object):\n def __init__(... | python | chosen |
[
{
"from": "human",
"value": "Add driver to find plate solutions\n"
},
{
"from": "gpt",
"value": "import babeldix\n\nimport sys\nimport operator\n\n# Print solutions in order of increasing score\n\nfor plate in sys.argv[1:]:\n solns = babeldix.Plates.get_solutions(plate)\n for (soln,score) ... | python | chosen |
[
{
"from": "human",
"value": "Make migration for item-visibility change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-03-30 13:42\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.M... | python | chosen |
[
{
"from": "human",
"value": "Add a low-level example for creating views.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nA low level example:\nThis is how JenkinsAPI creates views\n\"\"\"\nimport requests\nimport json\n\nurl = 'http://localhost:8080/newView'\nstr_view_name = \"ddsfddfd\"\nparams = {}# ... | python | chosen |
[
{
"from": "human",
"value": "Add new file with mixin for mysql\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# (C) Copyright 2017 Inova Development Inc.\n# All Rights Reserved\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in... | python | chosen |
[
{
"from": "human",
"value": "Add test class to cover the RandomForestClassifier in Go\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom unittest import TestCase\n\nfrom sklearn.ensemble import RandomForestClassifier\n\nfrom tests.estimator.classifier.Classifier import Classifier\n... | python | chosen |
[
{
"from": "human",
"value": "Add unittests for bridgedb.parse.versions module.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#_____________________________________________________________________________\n#\n# This file is part of BridgeDB, a Tor bridge distribution system.\n#\n# :au... | python | chosen |
[
{
"from": "human",
"value": "Add my fibonacci sequence homework.\n"
},
{
"from": "gpt",
"value": "def even_fibonacci_sum(a:int,b:int,max:int) -> int:\r\n temp = 0\r\n sum = 0\r\n\r\n while (b <= max):\r\n if (b%2 == 0):\r\n sum += b\r\n temp = a + b\r\n a... | python | chosen |
[
{
"from": "human",
"value": "Add in the db migration\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 8081a5906af\nRevises: 575d8824e34c\nCreate Date: 2015-08-25 18:04:56.738898\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '8081a5906af'\ndown_revision = '... | python | chosen |
[
{
"from": "human",
"value": "Fix corrupt abstract field data\n"
},
{
"from": "gpt",
"value": "\"\"\"Fix corrupt abstract field data\n\nRevision ID: 8b5ab7da2d5\nRevises: 52d970fb6a74\nCreate Date: 2016-10-04 17:21:19.186125\n\"\"\"\n\nimport sqlalchemy as sa\nfrom alembic import op\n\n\n# revisi... | python | chosen |
[
{
"from": "human",
"value": "Add solution for 118 pascals triangle\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def generate(self, numRows):\n \"\"\"\n :type numRows: int\n :rtype: List[List[int]]\n \"\"\"\n res = [[1],[1,1]]\n if numRow... | python | chosen |
[
{
"from": "human",
"value": "Add frameless drag region example.\n"
},
{
"from": "gpt",
"value": "import webview\n\n'''\nThis example demonstrates a user-provided \"drag region\" to move a frameless window\naround, whilst maintaining normal mouse down/move events elsewhere. This roughly\nreplicat... | python | chosen |
[
{
"from": "human",
"value": "Add a little program that calls sync until is is done\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport subprocess\nimport sys\nfrom time import time\n\n\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n\n\ndef main():\n ... | python | chosen |
[
{
"from": "human",
"value": "[depot_tools][owners] Add owners client to depot_tools.\n\nAdd an owners API that will be used by Depot Tools to\ninteract with OWNERS files.\n\nThe API will be implemented using both owners.py and the\nGerrit Code-Owners plugin REST API. All Depot Tools code\nwill be modified t... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for smudge\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom dotbriefs.smudge import SmudgeTemplate\n\n\nclass TestCleanSecret(unittest.TestCase):\n\n def setUp(self):\n self.secrets = {}\n self.secrets['password'] = 's3cr3t'\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to write base signatures\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport argparse\nimport subprocess\nimport os\nimport shutil\nimport sys\n\nfrom util import write_signature\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\n \... | python | chosen |
[
{
"from": "human",
"value": "Add a test to make sure exception is raised\n\nNone of our code should be raising this exception, so itβs possible it\ncould stop working without us knowing about it.\n\nThis commit adds a tests to alert us if the override ever does silently\nstop working (for example because of... | python | chosen |
[
{
"from": "human",
"value": "Add script for converting a solarized dark file to solarized dark high contrast\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\nif sys.version_info < (3, 4):\n sys.exit('ERROR: Requires Python 3.4')\n\nfrom enum import Enum\n\ndef main():\n... | python | chosen |
[
{
"from": "human",
"value": "Add an autonomous mode to strafe and shoot. Doesn't work\n"
},
{
"from": "gpt",
"value": "\r\ntry:\r\n import wpilib\r\nexcept ImportError:\r\n from pyfrc import wpilib\r\n\r\nimport timed_shoot\r\n\r\nclass HotShootAutonomous(timed_shoot.TimedShootAutonomous):... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for scriptserver.\n\nCovers ZoneScriptRunner.__init__ and ZoneScriptRunner.load_scripts.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom mock import patch, Mock\n\nimport sys\nsys.path.append(\".\")\nfrom scriptserver import ZoneScriptRunner\... | python | chosen |
[
{
"from": "human",
"value": "Add a plot just of backscatter phase vs. diameter.\n\nThis (mostly) reproduces a figure in Matrosov et al. 2002 in JAM.\n"
},
{
"from": "gpt",
"value": "import matplotlib.pyplot as plt\nimport numpy as np\nimport scattering\nimport scipy.constants as consts\n\ndef pl... | python | chosen |
[
{
"from": "human",
"value": "Add handler for concurrently logging to a file\n"
},
{
"from": "gpt",
"value": "\n'''\nUtilities to assist with logging in python\n'''\n\nimport logging\n\n\nclass ConcurrentFileHandler(logging.Handler):\n \"\"\"\n A handler class which writes logging records t... | python | chosen |
[
{
"from": "human",
"value": "Add test_learning_journal.py with test_app() for configuring the app for testing\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom contextlib import closing\nimport pytest\n\nfrom journal import app\nfrom journal import connect_db\nfrom journal import ge... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for alerter class\n"
},
{
"from": "gpt",
"value": "import unittest\nimport datetime\nimport Alerters.alerter\n\n\nclass TestAlerter(unittest.TestCase):\n\n def test_groups(self):\n config_options = {'groups': 'a,b,c'}\n a = Alerters... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for asyncio coroutines\n"
},
{
"from": "gpt",
"value": "from trollius import test_utils\nfrom trollius import From, Return\nimport trollius\nimport unittest\n\ntry:\n import asyncio\nexcept ImportError:\n from trollius.test_utils import SkipTest\... | python | chosen |
[
{
"from": "human",
"value": "Add mock HTTP server to respond to requests from web UI\n"
},
{
"from": "gpt",
"value": "from http.server import BaseHTTPRequestHandler, HTTPServer\nimport json\nimport socket\nfrom threading import Thread\n\nimport requests\n\n# https://realpython.com/blog/python/te... | python | chosen |
[
{
"from": "human",
"value": "Add missing test data folder\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the Lice... | python | chosen |
[
{
"from": "human",
"value": "Add feed update task for social app\n"
},
{
"from": "gpt",
"value": "from celery.task import PeriodicTask\nfrom datetime import timedelta\n\nfrom social.utils import FeedUpdater, UpdateError\n\nclass UpdateFeedsTask(PeriodicTask):\n run_every = timedelta(minutes=1... | python | chosen |
[
{
"from": "human",
"value": "Create script to dowload requisite test urls.\n"
},
{
"from": "gpt",
"value": "def set_test_db():\n from sys import path\n path.insert(0, \"..\")\n from MyEdgarDb import get_list_sec_filings, get_cik_ticker_lookup_db, lookup_cik_ticker\n get_list_sec_fili... | python | chosen |
[
{
"from": "human",
"value": "Add a unit-test for thread_pool.py.\n"
},
{
"from": "gpt",
"value": "import thread_pool\nimport unittest\nfrom six.moves import queue\n\nclass TestThreadPool(unittest.TestCase):\n\n def _producer_thread(self, results):\n for i in range(10):\n results.put(i)\... | python | chosen |
[
{
"from": "human",
"value": "examples: Add example to show listing of USB devices\n\nAlso we add a quick example of how to implement a custom plugin to provide\nruntime plugin support for LdmManager.\n\nSigned-off-by: Ikey Doherty <d8d992cf0016e35c2a8339d5e7d44bebd12a2d77@solus-project.com>\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Add partial evaluation tool to replace functools module for python < 2.5\n\nFrom: cdavid <cdavid@cb17146a-f446-4be1-a4f7-bd7c5bb65646>\n\ngit-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@236 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8\n"
},
{
"from": "gpt",
"value": "# ... | python | chosen |
[
{
"from": "human",
"value": "Add script to synthesize all uploaded files.\nPatch by Dan Callahan.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\"\"\"\nThis script touches all files known to the database, creating a skeletal\nmirror for local development.\n\"\"\"\n\nimport sys, os\nimport ... | python | chosen |
[
{
"from": "system",
"value": "Add test for timer automatically inserted due to directive\n"
},
{
"from": "human",
"value": "\"\"\"tests/test_directives.py.\n\nTests to ensure that directives interact in the etimerpected mannor\n\nCopyright (C) 2015 Timothy Edmund Crosley\n\nPermission is hereby ... | python | chosen |
[
{
"from": "human",
"value": "Add script that dumps the python path\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\n# path[0], is the directory containing the script that was used to invoke the Python interpreter\nfor s in sorted(sys.path[1:]):\n print s\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Format all local .json files for human readability"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport json, os\n\nfor filename in os.listdir('.'):\n if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json':\n with open(fi... | python | chosen |
[
{
"from": "human",
"value": "Add the analysis driver for the run step of the study\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# Brokers communication between Dakota and SWASH through files.\n#\n# Arguments:\n# $1 is 'params.in' from Dakota\n# $2 is 'results.out' returned to Dak... | python | chosen |
[
{
"from": "system",
"value": "Make the cli work again.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\n\n\"\"\"\njrnl is a simple journal application for your command line.\n\"\"\"\n\n__title__ = 'jrnl'\n__version__ = '1.0.3'\n__author__ = 'Manuel Ebert'\n__license... | python | chosen |
[
{
"from": "human",
"value": "Add blink example on two different boards\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Author: Andrea Stagi <stagi.andrea@gmail.com>\n# Description: keeps your led blinking on 2 boards\n# Dependencies: None\n\nfrom nanpy import (ArduinoApi, SerialManag... | python | chosen |
[
{
"from": "human",
"value": "Create stub for 2016 NFLPool player picks\n"
},
{
"from": "gpt",
"value": "\n\nstone = {\"firstname\": \"chris\", \"lastname\": \"stone\", \"timestamp\": \"9/6/2016\", \"email\": \"stone@usisales.com\",\n \"afc_east_1\": \"Patriots\", \"afc_east_2\": \"Jets\"... | python | chosen |
[
{
"from": "human",
"value": "Use Q-learning to learn all state-action values via self-play\n"
},
{
"from": "gpt",
"value": "'''\nIn this example we use Q-learning via self-play to learn\nthe value function of all Tic-Tac-Toe positions.\n'''\nfrom capstone.environment import Environment\nfrom cap... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 513. Find Bottom Left Tree Value\n\n513. Find Bottom Left Tree Value: https://leetcode.com/problems/find-bottom-left-tree-value/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(s... | 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\nim... | python | chosen |
[
{
"from": "human",
"value": "Add test case for configure failure.\n\nTryRun fails to find the executable when VariantDir is set up from\nSConscript/SConstruct.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# __COPYRIGHT__\n#\n# Permission is hereby granted, free of charge, to any pe... | python | chosen |
[
{
"from": "human",
"value": "Add sine wave sweep test\n\nThis test produces spectrograms like those available on the SRC\nComparisons web site.\n\nhttp://src.infinitewave.ca/\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some preliminary code and function to enlarge image\n"
},
{
"from": "gpt",
"value": "from lxml import html\nfrom PIL import Image\nimport requests\n\ndef enlarge_image(image_file):\n\timage = Image.open(image_file)\n\tenlarged_size = map(lambda x: x*2, image.size... | python | chosen |
[
{
"from": "human",
"value": "Add network set default route view\n\nSigned-off-by: Adam Stokes <0a364f4bf549cc82d725fa7fd7ed34404be64079@ubuntu.com>\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Canonical, Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it u... | python | chosen |
[
{
"from": "system",
"value": "Call pip install before running server.\n"
},
{
"from": "human",
"value": "from os.path import expanduser\nfrom os import kill\nimport subprocess\nimport sys\nimport time\n\n\npython = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')\ncwd = expanduser('~/... | python | chosen |
[
{
"from": "human",
"value": "Add nagios check for idot snowplow ingest"
},
{
"from": "gpt",
"value": "\"\"\"\n Nagios check to see how much snowplow data we are currently ingesting\n\"\"\"\nimport sys\nimport os\nimport psycopg2\n\nPOSTGIS = psycopg2.connect(database='postgis', host='iemdb', use... | python | chosen |
[
{
"from": "human",
"value": "Add an example map flow\n"
},
{
"from": "gpt",
"value": "from taskin import task\n\n\ndef get_servers(data):\n return [\n 'foo.example.com',\n 'bar.example.com',\n ]\n\n\ndef create_something(data):\n servers, name = data\n for server in ser... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests for the hashing protocol of dtype (fail currently).\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@6666 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import *\n\nclass TestBui... | python | chosen |
[
{
"from": "system",
"value": "Add an option to redirect user to a page if the key is already expired.\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nfrom django.http import HttpResponseRedirect, HttpResponseGone\nfrom django.shortcuts import get_object_or_404\nfrom django.co... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 556. Next Greater Element III\n\n556. Next Greater Element III: https://leetcode.com/problems/next-greater-element-iii/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd o... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for IosBrowserFinder.\n\nThis test checks if Chrome on iOS is running. It only\nruns on iOS platforms.\n\nBUG=None\n\nReview URL: https://codereview.chromium.org/350583002\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@279143 0039d316-1c4b-4281-b951-d872f2... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.