conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add script to get nested projects\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Helper to get a list of all projects that are nested within another project.\"\"\"\n\nfrom website.project.model import Node\nfrom modularodm impo...
python
chosen
[ { "from": "human", "value": "Add a script to update users with a CSV\n" }, { "from": "gpt", "value": "# The purpose of this script to update database with a CSV\n\nimport os\nimport sys\n\nimport psycopg2\nimport dotenv\n\n# Load environment variable from a .env file\ndotenv.load_dotenv('.env')\...
python
chosen
[ { "from": "human", "value": "Add tool to plot beta\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport numpy as np\n#import matplotlib\n#matplotlib.use('agg')\n\nimport matplotlib.pyplot as plt\n\nimport castep_isotope_sub\n\ndef plot_beta(Ts, betas):\n\n Tsm1 = 1E6/(Ts**2.0)\n ...
python
chosen
[ { "from": "human", "value": "Create Dirichlet Process Mixture Model class.\n" }, { "from": "gpt", "value": "\"\"\" Going to try algorithm 1 from Neal (2000)\n\"\"\"\n\nimport numpy as np\nimport bisect\n\n\ndef pick_discrete(p):\n \"\"\"Pick a discrete integer between 0 and len(p) - 1 with pr...
python
chosen
[ { "from": "human", "value": "Add mass model destruction test." }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"Perfscale test measuring adding and destroying a large number of models.\n\nSteps taken in this test:\n - Bootstraps a provider\n - Creates x amount of models and waits for...
python
chosen
[ { "from": "human", "value": "Add test to valide MFA status in JS\n" }, { "from": "gpt", "value": "# coding: utf-8\nimport constance\nfrom constance.test import override_config\nfrom django.urls import reverse\nfrom django.test import TestCase\n\n\nclass GlobalSettingsTestCase(TestCase):\n\n f...
python
chosen
[ { "from": "system", "value": "mpd: Add list of unsupported MPD features\n" }, { "from": "human", "value": "\"\"\"The MPD server frontend.\n\nMPD stands for Music Player Daemon. MPD is an independent project and server.\nMopidy implements the MPD protocol, and is thus compatible with clients for ...
python
chosen
[ { "from": "human", "value": "Add test for debrief view\n" }, { "from": "gpt", "value": "import datetime\n\nfrom django.core.urlresolvers import reverse\n\nfrom ..models import Event, Task, Role\nfrom .base import TestBase\n\n\nclass TestDebrief(TestBase):\n def setUp(self):\n super().s...
python
chosen
[ { "from": "human", "value": "Implement a simple cryptography functions using a key\n" }, { "from": "gpt", "value": "\"\"\"This module crypts the message of ping\"\"\"\n\nfrom __future__ import division\nfrom string import ascii_lowercase\n\nsymbols = list('0123456789')\nsymbols.append(' ')\nfor ...
python
chosen
[ { "from": "human", "value": "TST: Add a test for Runge-Kutta coefficient properties\n" }, { "from": "gpt", "value": "import pytest\nfrom numpy.testing import assert_allclose\nimport numpy as np\nfrom scipy.integrate import RK23, RK45\n\n\n@pytest.mark.parametrize(\"solver\", [RK23, RK45])\ndef t...
python
chosen
[ { "from": "human", "value": "Add script to generate the v8 version.\n\nBUG=chromium:446166\nLOG=n\nTBR=jkummerow@chromium.org\nNOTRY=true\n\nReview URL: https://codereview.chromium.org/835903003\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#25964}\n" }, { "from": "gpt", "valu...
python
chosen
[ { "from": "human", "value": "[build] Use distutils to install pymajka as standard module\n\nThe installation of majka itself is not covered.\n" }, { "from": "gpt", "value": "#!/usr/bin/python -tt\n\nfrom distutils.core import setup\n\nsetup(\n\tname='pymajka',\n\tversion='1.0',\n\tdescription='P...
python
chosen
[ { "from": "human", "value": "Add basic cms page handler\n" }, { "from": "gpt", "value": "from django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\nfrom feincms.models import Page\n\n\ndef handler(request, path):\n page = Page.objects.page_for_path_or_404(p...
python
chosen
[ { "from": "human", "value": "Add initial code for launching UI\n" }, { "from": "gpt", "value": "import sys\nfrom PyQt5.QtWidgets import QApplication, QMainWindow\nfrom PyQt5.uic import loadUi\n\nclass MainWindow(QMainWindow):\n\tdef __init__(self, *args):\n\t\tsuper(MainWindow, self).__init__(*a...
python
chosen
[ { "from": "human", "value": "Add module capable of rendering a circle-shaped Particle object\n" }, { "from": "gpt", "value": "import pygame\n\n\npygame.init()\n\n#-- SCREEN CHARACTERISTICS ------------------------->>>\nbackground_color = (255,255,255)\n(width, height) = (300, 200)\n\nclass Parti...
python
chosen
[ { "from": "human", "value": "Add create all CLI entry point\n" }, { "from": "gpt", "value": "\"\"\"\nCreate databases.\n\n\"\"\"\nfrom argparse import ArgumentParser\n\nfrom microcosm_postgres.operations import create_all, drop_all\n\n\ndef parse_args(graph):\n parser = ArgumentParser()\n ...
python
chosen
[ { "from": "human", "value": "Add a fast GML reader (reads in seconds).\n" }, { "from": "gpt", "value": "import networkx as nx\r\n\r\n# from gml_read import read_gml2\r\n# g = read_gml2(\"steiner-small.gml\")\r\n\r\ndef read_gml2(path):\r\n\r\n # Read file lines\r\n f = open(path)\r\n li...
python
chosen
[ { "from": "human", "value": "[src/test] Add a dummy python socket server\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nPORT = 50007\n\n# Echo server program\nimport socket\nimport sys\nimport json\n\nHOST = None # Symbolic name meaning all available...
python
chosen
[ { "from": "human", "value": "Add Iterative Deepening Depth-First Search\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport draw\nimport grid\nimport util\n\ndef iddfs(g, start, goal):\n for i in range(40):\n path = iddfs_rec(g, start, goal, [start], i)\n if path !=...
python
chosen
[ { "from": "human", "value": "Add a naive solution for Mars Lander\n" }, { "from": "gpt", "value": "N = int(raw_input()) # the number of points used to draw the surface of Mars.\nfor i in xrange(N):\n\t# LAND_X: X coordinate of a surface point. (0 to 6999)\n\t# LAND_Y: Y coordinate of a surface p...
python
chosen
[ { "from": "human", "value": "Create script for adding/removing global mods.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport sys\nfrom redis import Redis\n\ndb = Redis()\n\nsession_id = sys.argv[2]\n\nif sys.argv[1]=='add':\n db.sadd('global-mods', session_id)\n print 'Added to...
python
chosen
[ { "from": "human", "value": "Add a fully reproducible autoencoder test code\n\n\nFormer-commit-id: fef07285a8dd84dabd37eb73de7cb298b0b50944" }, { "from": "gpt", "value": "import numpy as np\nimport tensorflow as tf\nfrom autoencoder.io import read_text, preprocess\nfrom autoencoder.api import au...
python
chosen
[ { "from": "human", "value": "Load HST photometry from Starplex catalog\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\nModule for directly estimating SB by adding up the light of stars in the Brown\ncatalog and transforming that total light into an SDSS magnitu...
python
chosen
[ { "from": "system", "value": "Disable new test from r1779 for the android generator.\n\nBUG=gyp:379\nTBR=torne@chromium.org\n\nReview URL: https://codereview.chromium.org/68333002\n\ngit-svn-id: e7e1075985beda50ea81ac4472467b4f6e91fc78@1782 78cadc50-ecff-11dd-a971-7dbc132099af\n" }, { "from": "human...
python
chosen
[ { "from": "human", "value": "Add letter logos for TWFRS and Thames Valley Police\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0190_another_letter_org\nRevises: 0189_ft_billing_data_type\nCreate Date: 2017-06-29 12:44:16.815039\n\n\"\"\"\n\n# revision identifiers, used by ...
python
chosen
[ { "from": "human", "value": "Convert entity graphs to visually simpler graphs\n" }, { "from": "gpt", "value": "from collections import defaultdict\nfrom glob import glob\nimport networkx as nx\nimport json\nimport os\nfrom pprint import pprint\nimport re\nimport subprocess\nimport sys\nimport ...
python
chosen
[ { "from": "human", "value": "Enable automatic testing for hash sum\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport shutil\nimport unittest\n\nimport hashsum\n\nprint('hashsum: v%s' % hashsum.VERSION)\nprint('Python: %s' % sys.version)\n\nshutil.copytree(os...
python
chosen
[ { "from": "human", "value": "Add skeleton code for PIR motion sensor\n" }, { "from": "gpt", "value": "# Detect motion from PIR module\n# SKELETON code modified from http://www.raspberrypi-spy.co.uk\n# Added computation of voltage time from PIR and checks\n# by AC Jan 06 2014\n\n\n# Import requir...
python
chosen
[ { "from": "human", "value": "Add tests for lib/bio module\n" }, { "from": "gpt", "value": "\"\"\"Testing functions in lib/bio.\"\"\"\n\nfrom hypothesis import given\nimport hypothesis.strategies as st\nimport lib.bio as bio\n\nDNA = 'ACGTUWSMKRYBDHVNXacgtuwsmkrybdhvnx'\nREVERSIBLE = 'ACGTWSMKRYB...
python
chosen
[ { "from": "human", "value": "Add tests for bad messages, and actor message retries.\n" }, { "from": "gpt", "value": "from thespian.actors import *\nfrom thespian.test import *\nimport time\nfrom datetime import timedelta\nimport sys\n\n\nmax_response_delay = timedelta(seconds=1.0)\n\n\nclass Bad...
python
chosen
[ { "from": "human", "value": "Add a test for an async item_scraped handler.\n" }, { "from": "gpt", "value": "from twisted.internet import defer\nfrom twisted.trial import unittest\n\nfrom scrapy import signals, Request, Spider\nfrom scrapy.utils.test import get_crawler\n\nfrom tests.mockserver im...
python
chosen
[ { "from": "human", "value": "Add routine to calculate circular velocity.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -----------------------------------------------------------------------------\n# GENHERNQUIST.VCIRC\n# Laura L Watkins [lauralwatkins@gmail.com]\n# -----------------...
python
chosen
[ { "from": "human", "value": "Add script to extract the shape of blockgroups and aggregate them per msa\n" }, { "from": "gpt", "value": "\"\"\"shape_msa_blockgroup.py\n\nOutput one shapefile per MSA containing all the blockgroups it contains\n\"\"\"\nimport os\nimport csv\nimport fiona\n\n\n#\n# ...
python
chosen
[ { "from": "human", "value": "tests/cpydiff: Add CPy diff test for assignment expression behaviour.\n" }, { "from": "gpt", "value": "\"\"\"\ncategories: Syntax,Operators\ndescription: MicroPython allows using := to assign to the variable of a comprehension, CPython raises a SyntaxError.\ncause: M...
python
chosen
[ { "from": "human", "value": "Add a convenience script for running gunicorn workers\n" }, { "from": "gpt", "value": "import subprocess\nimport argparse\nimport pwd\nimport os\n\n\ndef _get_user_home_dir(user):\n return os.path.expanduser('~' + user)\n\n\ndef build_parser():\n\n def _get_cur...
python
chosen
[ { "from": "human", "value": "Add old script to add cs:updated element to styles.\n" }, { "from": "gpt", "value": "# Python script to add timestamp to style with empty updated field\n# Author: Rintze M. Zelle\n# Version: 2011-12-17\n# * Requires lxml library (http://lxml.de/)\n\nimport os, glob, ...
python
chosen
[ { "from": "human", "value": "Add a script for hiding old ShowFast results\n\nThe script keeps the specified number of the most recent results\nper release and hides everything else. It is helpful for keeping\nShowFast clean and normalized.\n\nHere is an example of hiding Spock results for XDCR and Views:\n\...
python
chosen
[ { "from": "human", "value": "Fix hidden unit test dependencies\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE. For\n# more information on DataONE, s...
python
chosen
[ { "from": "human", "value": "Add problem 38, pandigital multiples\n" }, { "from": "gpt", "value": "from time import time\nfrom itertools import permutations\n\n\nDIGITS = 123456789\n\n\ndef is_pandigital_product(num):\n for l in range(1, len(str(num))):\n candidate_num = int(str(num)[0...
python
chosen
[ { "from": "human", "value": "Add first draft of ethereum trading contract in Viper.\n" }, { "from": "gpt", "value": "# Ethereum flashcards smart-contract v1.0\r\n#\r\n# This contract is used to place/execute sell and buy\r\n# orders for flashcard categories in codingchili/flashcards-webapp.git\r...
python
chosen
[ { "from": "human", "value": "Add a script to get server details.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#usage: ha-server-details UUID\n\nimport sys\nimport pyrax\nimport getopt\nimport pprint\n\nfrom common import init_pyrax\n\ndef main(argv):\n if len(argv) != 1:\n p...
python
chosen
[ { "from": "human", "value": "Add python implementation for problem 39.\n" }, { "from": "gpt", "value": "'''\n Integer Right Triangles\n =======================\n If p is the perimeter of a right angle triangle with integral length sides,\n {a,b,c}, there are exactly three solutions f...
python
chosen
[ { "from": "human", "value": "Create PSA plugin, only accessible for admins\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n================================================\n:mod:`onebot.plugins.psa` PSA\n================================================\n\nThis plugin allows adm...
python
chosen
[ { "from": "human", "value": "Add phonetics download from aiciba, can download more things from aiciba in future\n" }, { "from": "gpt", "value": "'''\nCreated on 2013-12-20\n\n@author: bn\n'''\n\n# -*- coding: gbk -*-\nimport re\n\ntry: \n input = raw_input\nexcept NameError:\n pass\n\ntry:...
python
chosen
[ { "from": "human", "value": "Introduce a bulk importer, partly to prove how easy it is\n" }, { "from": "gpt", "value": "import argparse\nimport os.path\nfrom fore import database\n\nparser = argparse.ArgumentParser(description=\"Bulk-import MP3 files into the appension database\",\n\tepilog=\"St...
python
chosen
[ { "from": "human", "value": "Add a script for combining version .rst files\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport re\nimport sys\n\ndef main(args = None):\n if args is None:\n args = sys.argv\n\n re_version = re.compile('Version (\\d+\\.\\d+\\.\\d+), ([0-9]{4}-...
python
chosen
[ { "from": "human", "value": "Add python implementation for problem 3\n" }, { "from": "gpt", "value": "def largest_prime_factor(n, h):\n for i in xrange(2, n+1):\n d, m = divmod(n, i)\n if m == 0:\n largest_prime_factor(d, i)\n break\n if n == 1: print h\...
python
chosen
[ { "from": "human", "value": "Add test of the AlreadyExistsException and the NotFoundException, when creating or deleting databases\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nUnit tests for pyes. These require an es server with thrift plugin running on t...
python
chosen
[ { "from": "human", "value": "Add a test for ClassLoader default transforms and default transform overriding.\n" }, { "from": "gpt", "value": "from jawa.cf import ClassFile\nfrom jawa.util.classloader import ClassLoader\nfrom jawa.transforms.simple_swap import simple_swap\nfrom jawa.assemble impo...
python
chosen
[ { "from": "human", "value": "Test CSP logging view returns a 200\n\nTouch #81\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n##\n# Copyright (C) 2015 Jessica Tallon & Matt Molyneaux\n#\n# This file is part of Inboxen.\n#\n# Inboxen is free software: you can redistribute it an...
python
chosen
[ { "from": "human", "value": "Test the complete h2xml and xml2py toolchain on Windows by running it\nover 'windows.h'.\n" }, { "from": "gpt", "value": "import unittest\nimport sys\nfrom ctypeslib import h2xml, xml2py\n\nclass ToolchainTest(unittest.TestCase):\n if sys.platform == \"win32\":\n ...
python
chosen
[ { "from": "system", "value": "Create the Account List > List Accounts - Create URL\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nadmin.autodiscover()\n\nfrom marketing.views import HomePage\n\nurlpatterns = patterns(''...
python
chosen
[ { "from": "human", "value": "Add script for loading external data for testing\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport bson\nimport copy\nimport datetime\nimport dateutil.parser\nimport json\n\nfrom api import config\n\n## DEFAULTS ##\n\nUSER_ID = \"meganhenning@flywheel....
python
chosen
[ { "from": "human", "value": "Add curried join from my old functoolsx module.\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\n\"\"\"Tools for strings.\n\"\"\"\n\ndef join(sep):\n \"\"\"join(sep)(iterable) Join strings in iterable with sep.\n\n str -> [str] -> str\n\n >>> comma...
python
chosen
[ { "from": "human", "value": "Add first draft of Nitroshare UDP discovery\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nAttempt to comunicate with Nitroshare.\n\n [x] listen nitroshare broadcasts and show who is available\n [x] listen for UDP packets on port 40816\n\n\"\"\"\n\...
python
chosen
[ { "from": "human", "value": "Add script for migrating categories\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport logging\n\nfrom tests.base import OsfTestCase\nfrom tests.factories import NodeFactory\n\nfrom website.project.model import Node\n\nlogger = lo...
python
chosen
[ { "from": "human", "value": "Add sigma tests from OB\n" }, { "from": "gpt", "value": "\"\"\"Unit tests for the sigma module.\n\nThomas Ogden <t@ogden.eu>\n\"\"\"\n\nimport sys\nimport unittest\nimport numpy as np\nimport qutip as qu\n\nfrom maxwellbloch import sigma\n\nclass TestSigma(unittest.T...
python
chosen
[ { "from": "human", "value": "Test APS 3.0 with eventlet\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.7\n\nfrom pytz import utc\nimport time\n\nimport eventlet\nfrom apscheduler.schedulers.background import BackgroundScheduler\n\n\ndef test_aps_eventlet():\n def showMessage():\n ...
python
chosen
[ { "from": "human", "value": "Add a few tests for anonymous.json\n" }, { "from": "gpt", "value": "from __future__ import print_function, unicode_literals\n\nfrom aspen import json\n\nfrom gittip.elsewhere.twitter import TwitterAccount\nfrom gittip.testing import Harness\nfrom gittip.testing.clien...
python
chosen
[ { "from": "human", "value": "Add some unit tests for the hashing protocol of dtype (fail currently).\n" }, { "from": "gpt", "value": "import numpy as np\nfrom numpy.testing import *\n\nclass TestBuiltin(TestCase):\n def test_run(self):\n \"\"\"Only test hash runs at all.\"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add test for simple array initialziation\n" }, { "from": "gpt", "value": "from thinglang.thinglang import run\n\n\ndef test_simple_arrays():\n assert run(\"\"\"\nthing Program\n does start\n array names = [\"yotam\", \"andrew\", \"john\"]\n Output...
python
chosen
[ { "from": "human", "value": "Add a little test for rtnorm, to make sure this is not the problem. It is not, apparently.\n" }, { "from": "gpt", "value": "\n# This should plot a histogram looking like a gaussian\n# ... It does.\n\n## CONFIGURATION (play with different values)\n\nsamples = int(1e6)...
python
chosen
[ { "from": "human", "value": "Add an INTERVAL form field.\n" }, { "from": "gpt", "value": "import datetime\nimport re\n\nfrom django import forms\n\nINTERVAL_RE = re.compile(\n r'^((?P<days>\\d+) days)?,?\\W*'\n r'((?P<hours>\\d\\d?)(:(?P<minutes>\\d\\d)(:(?P<seconds>\\d\\d))?)?)?'\n)\n\nde...
python
chosen
[ { "from": "human", "value": "Test to parse & serialize test documents to XML and text." }, { "from": "gpt", "value": "\nimport unittest\nimport os\nimport glob\nimport libtaxii.messages_11 as tm11\nimport libtaxii.taxii_default_query as tdq\n# from libtaxii.validation import SchemaValidator\n\nc...
python
chosen
[ { "from": "human", "value": "Add a snippet (Python itertools).\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\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 a copy\n# of thi...
python
chosen
[ { "from": "human", "value": "Test the lifecycle shutdown API endpoint\n\n" }, { "from": "gpt", "value": "class TestShutdown:\n\n async def test(self, mocker, monkeypatch, do_get):\n \"\"\"\n Test that a ``GET /api/lifecycle/shutdown`` results in :meth:`aiohttp.web.Application.sh...
python
chosen
[ { "from": "human", "value": "Add a test that proves build_instance raises an exception if `make` (etc.) fails.\n\nFrom here, it's trivial to observe that dxr-build.py itself exits with a non-zero status code on build failure. Thus, our spurious deployment of a new instance even after the moz-central build f...
python
chosen
[ { "from": "human", "value": "Implement a method that fetches all the mentors for a given organization.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.5\n#\n# Copyright 2011 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use th...
python
chosen
[ { "from": "human", "value": "Add test for installed packages\n" }, { "from": "gpt", "value": "import pytest\n\n@pytest.mark.parametrize(\"name\", [\n (\"bash-completion\"),\n (\"bind-utils\"),\n (\"bridge-utils\"),\n (\"docker\"),\n (\"epel-release\"),\n (\"git\"),\n (\"iptables-services\...
python
chosen
[ { "from": "human", "value": "Add tests for timer functionality\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntests.test_timer\n~~~~~~~~~~~~~~~~~~~~~\n\n\"\"\"\n\nimport time\nimport re\n\nfrom yaspin import yaspin\n\n\ndef test_no_timer():\n sp = yaspin(timer=False)\n ...
python
chosen
[ { "from": "human", "value": "Add crawler for 'Sherman's Lagoon'\n" }, { "from": "gpt", "value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = \"Sherman's Lagoon\"\n language = 'en'\n url = 'ht...
python
chosen
[ { "from": "human", "value": "Add testing regressions of pydot vs graphviz\n" }, { "from": "gpt", "value": "from __future__ import division\nfrom __future__ import print_function\n\nimport glob\nimport os\nimport subprocess\nimport sys\nfrom hashlib import sha256\n\nimport pydot_ng as pydot\n\nPY...
python
chosen
[ { "from": "human", "value": "Add new method for abstraction\n" }, { "from": "gpt", "value": "\nclass MyMethod(object):\n def __init__(self, graph, clusters):\n self.graph = graph\n self.clusters = clusters\n self.count_partitions = {}\n\n def __get_count(self):\n ...
python
chosen
[ { "from": "human", "value": "Add state module to manage InfluxDB databases\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\nManagement of Influxdb databases\n================================\n\n(compatible with InfluxDB version 0.9+)\n'''\n\n\ndef __virtual__():\n '''\n Only ...
python
chosen
[ { "from": "human", "value": "Add plugin for bot testing\n" }, { "from": "gpt", "value": "\"\"\"\n# Config (valid YAML document) must be at __doc__.\nname: ping_pong # Name of plugin, lowercase, match with\n # file or package name.\ndescription: \"Example plugin for testing bot.\"\...
python
chosen
[ { "from": "human", "value": "Add module to handle ranked items (for Condorcet-Schulze voting method).\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\n# Suq1 -- An ad hoc Python toolbox for a web service\n# By: Emmanuel Raviart <emmanuel@raviart.com>\n#\n# Copyright (C) 2009, 2010, ...
python
chosen
[ { "from": "human", "value": "Add python script that uses the infupy library and streams to zmq\n" }, { "from": "gpt", "value": "import threading\nimport time\nfrom functools import partial\nfrom queue import Empty\n\nimport msgpack\nimport zmq\n\nimport infupy.backends.fresenius as fresenius\n\n...
python
chosen
[ { "from": "human", "value": "Add demo connection setting to git\n" }, { "from": "gpt", "value": "# This file is auto-generated by the `evennia connections` wizard.\n# Don't edit manually, your changes will be overwritten.\n\nGAME_INDEX_ENABLED = True\nGAME_INDEX_LISTING = \\\n{ 'game_status': ...
python
chosen
[ { "from": "human", "value": "Define casa tasks that fail with python errors\n" }, { "from": "gpt", "value": "\n'''\nDefine my own version of CASA tools that return python errors if they fail.\n'''\n\nfrom tasks import split, uvsub, concat, clean, rmtables\n\nfrom .graceful_error_catch import cat...
python
chosen
[ { "from": "human", "value": "Add conf file for Conakry devices\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\n\nLANGUAGE_CODE = 'fr'\nIDEASCUBE_NAME = 'CONAKRY'\nHOME_CARDS = STAFF_HOME_CARDS + [\n {\n 'id': 'koombookedu'...
python
chosen
[ { "from": "human", "value": "Test MARCS model atmosphere interpolator\n" }, { "from": "gpt", "value": "# coding: utf-8\n\n\"\"\" Test the model atmosphere interpolator \"\"\"\n\n__author__ = \"Andy Casey <andy@astrowizici.st>\"\n\nimport os\nimport logging\n\nimport numpy as np\nimport matplotli...
python
chosen
[ { "from": "human", "value": "Create initial tests for code maintenance\n" }, { "from": "gpt", "value": "__author__ = 'Michael'\n\nfrom src import PClass\n\n# Test for bias addition and correctness of range in init function\ntestClass = PClass(3)\nassert testClass.weightList.size() == 4\nfor x in...
python
chosen
[ { "from": "human", "value": "tests/thread: Add stress-test for creating many threads.\n" }, { "from": "gpt", "value": "# stress test for creating many threads\n\ntry:\n import utime as time\nexcept ImportError:\n import time\nimport _thread\n\ndef thread_entry(n):\n pass\n\nthread_num =...
python
chosen
[ { "from": "human", "value": "Add a test for simple_module_pass\n" }, { "from": "gpt", "value": "import sys, unittest\nfrom tools import SamplesTestCase\n\n\nOUTPUT_FOR_GLOBALS = '''\\\nFound global named \"gfloat\": type = float*\nFound global named \"gppfloat\": type = float***\nFound global na...
python
chosen
[ { "from": "human", "value": "Add process monitoring for Octavia\n\nThis change creates a octavia detection plugin and adds process\nmonitoring for octavia-api, octavia-worker, octavia-health-manager\nand octavia-housekeeping processes.\n\nChange-Id: I71411c640713ac0ab2b3bbb332dfab064b08379b\n" }, { ...
python
chosen
[ { "from": "human", "value": "Check we can create an url\n" }, { "from": "gpt", "value": "from takeyourmeds.utils.test import TestCase\n\nfrom ..enums import TypeEnum, SourceEnum\n\nfrom .enums import StateEnum\n\nclass TwimlCallbackTest(TestCase):\n def setUp(self):\n super(TwimlCallba...
python
chosen
[ { "from": "human", "value": "Add unit-tests for open port violation alert\n" }, { "from": "gpt", "value": "from positive_alert_test_case import PositiveAlertTestCase\nfrom negative_alert_test_case import NegativeAlertTestCase\n\nfrom alert_test_suite import AlertTestSuite\n\n\nclass TestAlertOpe...
python
chosen
[ { "from": "human", "value": "Add tests to validate that bigip module requests session verifies SSL\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\ntests.unit.modules.test_bigip\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nUnit tests for the bigip module\n\"\"\"\nfrom __future__ import abs...
python
chosen
[ { "from": "human", "value": "Add migration script for checksum column" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not...
python
chosen
[ { "from": "human", "value": "Add failing test: columnize called with very long entries.\n\nBug reported on-list.\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\"\"\"Tests for IPython.utils.text\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copy...
python
chosen
[ { "from": "human", "value": "Add one place to get JSONResponse from.\n" }, { "from": "gpt", "value": "from django.http import HttpResponse\nfrom rest_framework.renderers import JSONRenderer\n\n# Initially taken from\n# http://www.django-rest-framework.org/tutorial/1-serialization/\nclass JSONRes...
python
chosen
[ { "from": "human", "value": "Add some extra tests for Diagram\n" }, { "from": "gpt", "value": "import gaphas\nimport pytest\n\nfrom gaphor.services.eventmanager import EventManager\nfrom gaphor.UML import Diagram\nfrom gaphor.UML.elementfactory import ElementFactory\nfrom gaphor.UML.presentation...
python
chosen
[ { "from": "system", "value": "API: Make DataBroker and DataMuxer top-level.\n" }, { "from": "human", "value": "import sys\nimport logging\nfrom .sources import *\n\n\nlogger = logging.getLogger(__name__)\n__version__ = 'v0.0.5.post0'\n" }, { "from": "gpt", "value": "import sys\nimpor...
python
chosen
[ { "from": "human", "value": "Add view test cases for portal\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.urls import reverse\n\n# Create your tests here.\n\nclass HomeViewTestCase(TestCase):\n \"\"\"HomeView test suite\"\"\"\n\n expected_url = '/'\n\n d...
python
chosen
[ { "from": "human", "value": "Add population script for dionyziz\n" }, { "from": "gpt", "value": "from string import ascii_lowercase\nimport django\nimport os\nimport string\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')\ndjango.setup()\n\nfrom breach.models import Target,...
python
chosen
[ { "from": "human", "value": "Add example script for extracting history from the database.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"Extract a session from the IPython input history.\n\nUsage:\n ipython-get-history.py sessionnumber [outputfile]\n\nIf outputfile is not given, ...
python
chosen
[ { "from": "human", "value": "Add a migration for repopulating sha256s of older osfstorage file versions\n" }, { "from": "gpt", "value": "import sys\nimport logging\nfrom modularodm import Q\n\nfrom website.app import init_app\nfrom website.files.models import FileVersion\n\nfrom scripts import u...
python
chosen
[ { "from": "human", "value": "Add script to validate table metadata values exist\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Copyright 2017 Cargill Incorporated\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in co...
python
chosen
[ { "from": "human", "value": "Test workspace. Initial. Closes gh-181\n" }, { "from": "gpt", "value": "# coding=utf-8\n\nimport sys\nimport struct\nimport unittest\nfrom test_000_config import TestConfig\nfrom test_020_connection import TestConnection\n\nfrom gi.repository import Midgard\nfrom gi....
python
chosen
[ { "from": "human", "value": "Add Fedex command for tracking packages.\n" }, { "from": "gpt", "value": "import urllib\nimport webbrowser\n\nimport qmk\n\nclass FedexCommand(qmk.Command):\n '''Use the Fedex website to view the tracking info for the given\n tracking number.'''\n def __init...
python
chosen