conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add tests for the explorer app\n" }, { "from": "gpt", "value": "from django.apps import apps\nfrom django.test import TestCase\n\nfrom ..apps import ExplorerConfig\n\n\nclass ExplorerConfigTestCase(TestCase):\n\n def test_config(self):\n\n expected = 'explo...
python
chosen
[ { "from": "human", "value": "Add PE detectors pe1, pe2\n" }, { "from": "gpt", "value": "from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,\n AreaDetectorFileStoreTIFF)\n\nshctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', nam...
python
chosen
[ { "from": "human", "value": "Add tool to parse AWOS maint records provided monthly" }, { "from": "gpt", "value": "\"\"\"\n Parse the monthly maint file I get from the DOT\n \n id | integer | not null default nextval('iem_calibrati\non_id_seq'::regclass)\n station | c...
python
chosen
[ { "from": "human", "value": "Add ImageMarker class, overriding Champlain.Point\n" }, { "from": "gpt", "value": "from gi.repository import Champlain\n\nclass ImageMarker(Champlain.Point):\n\n def __init__(self, treeiter, filename, lat, lon, clicked):\n Champlain.Point.__init__(self)\n ...
python
chosen
[ { "from": "human", "value": "Add script for dumping database to txt.\n" }, { "from": "gpt", "value": "from pmg_backend import db\nfrom pmg_backend.models import *\nimport json\nimport os\n\nbills = Bill.query.filter_by(is_deleted=False).all()\n\nprint len(bills)\n\nout = []\nfor bill in bills:\n...
python
chosen
[ { "from": "human", "value": "Add regression tests for saving with force_insert\n" }, { "from": "gpt", "value": "from django.contrib.gis.geos import Point\nfrom django.test import TestCase\n\nfrom cities import models\n\n\nclass SlugModelTest(object):\n \"\"\"\n Common tests for SlugModel s...
python
chosen
[ { "from": "human", "value": "Test script based on README file\n" }, { "from": "gpt", "value": "__author__ = 'adam'\n\nimport pv\nimport serial\nimport sys\n\npv.debug()\npv.debug_color()\n\nport = serial.Serial('/dev/tty.usbserial')\n#port.open()\n\nfrom pv import cms\ninv = cms.Inverter(port)\n...
python
chosen
[ { "from": "human", "value": "Test the failed-unicode-decoding bug in PyArg_ParseTuple().\n" }, { "from": "gpt", "value": "\"\"\"Test the internal getargs.c implementation\n\n PyArg_ParseTuple() is defined here.\n\nThe test here is not intended to test all of the module, just the\nsingle case tha...
python
chosen
[ { "from": "human", "value": "Add test for concurrent compilation of cuda.jit kernels\n" }, { "from": "gpt", "value": "from numba import cuda\nimport numpy as np\nfrom numba import unittest_support as unittest\nfrom numba.cuda.testing import skip_on_cudasim\n\ntry:\n from concurrent.futures im...
python
chosen
[ { "from": "human", "value": "Add test script for shot items\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom db.shot import Shot\n\n\ndef test_find_by_event_id():\n shot = Shot.find_by_event_id(20160207550053)\n assert shot.team_id == 15\n assert s...
python
chosen
[ { "from": "human", "value": "Add a function to test socket connections\n" }, { "from": "gpt", "value": "import socket\n\nfrom contextlib import closing\n\ndef test_connection(host, port):\n \"\"\" Test a connection to a host/port \"\"\"\n\n with closing(socket.socket(socket.AF_INET, socket...
python
chosen
[ { "from": "human", "value": "Add simple HTML scraper that generates CSVs\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\nimport re\nimport csv\nfrom bs4 import BeautifulSoup\n\ndef row_to_dict(row):\n date_str = row.find(id = re.compile(r'transactionView\\.output\\.trans...
python
chosen
[ { "from": "human", "value": "Add first draft of upper incomplete Bose-Einstein integral\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom astropy import constants\nfrom astropy import units\nfrom sympy.mpmath import polylog\n\n\ndef uibei(order, energy_lo, temp...
python
chosen
[ { "from": "human", "value": "Define the slot transfer data model.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.5\n#\n# Copyright 2009 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the...
python
chosen
[ { "from": "human", "value": "[dfg] Add NRF device data extractor\n" }, { "from": "gpt", "value": "from pathlib import Path\nimport urllib.request\nimport zipfile\nimport shutil\nimport io\nimport os\n\npackurl = \"https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/n...
python
chosen
[ { "from": "human", "value": "Add more fields to Form and Database and have complaint_sytem page reflect that. Change 'categories' from dropdown to checkboxes.\n" }, { "from": "gpt", "value": "from django import forms\nfrom django.forms.widgets import CheckboxSelectMultiple\n\nfrom complaint_syst...
python
chosen
[ { "from": "human", "value": "Add quick test for finding crashes and errors\n" }, { "from": "gpt", "value": "import os\nimport subprocess as sp\nimport base64\n\n\ndef test_crash():\n CLI_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), \"../../cli.py\")\n\n # Test that comma...
python
chosen
[ { "from": "human", "value": "Add an agent of q-learning\n" }, { "from": "gpt", "value": "# coding: utf-8\nimport random\nimport gym\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns # noqa\nenv = gym.make('FrozenLake-v0')\n\n\nclass Agent(object):\n\n def __init__(...
python
chosen
[ { "from": "human", "value": "Add the script used to collect file popularity and size information\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport hashlib\nimport os\nimport os.path\nimport stat\nimport sys\n\n\"\"\"\nA script for counting file popularity information in given dire...
python
chosen
[ { "from": "human", "value": "Add lab 07 template for class C\n" }, { "from": "gpt", "value": "def main():\n matkul = #buat sebuah dictionary\n\n while #buat agar meminta input terus :\n masukkan = input(\">>> \")\n\n ######\n \n #buat agar program berhenti saat ...
python
chosen
[ { "from": "human", "value": "TEST Added tests of TimeManager\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"Test suite for aospy.utils module.\"\"\"\nimport sys\nimport unittest\n\nimport numpy as np\nimport xarray as xr\nfrom datetime import datetime\n\nfrom aospy.timedate import...
python
chosen
[ { "from": "human", "value": "Add py solution for 443. String Compression\n\n443. String Compression: https://leetcode.com/problems/string-compression/\n" }, { "from": "gpt", "value": "class Solution(object):\n def compress(self, chars):\n \"\"\"\n :type chars: List[str]\n ...
python
chosen
[ { "from": "human", "value": "Move parsing utilities to separate module\n" }, { "from": "gpt", "value": "from numpy import asarray, vstack, newaxis, zeros, nonzero, concatenate, transpose, atleast_2d\n\ndef check_colors(clrs):\n \n clrs = asarray(clrs)\n if clrs.ndim == 2 and clrs.shape...
python
chosen
[ { "from": "system", "value": "Remove forgotten bits of buildbot 0.7.12 compatibility code.\n\nA second take of https://chromiumcodereview.appspot.com/13560017 but should work now.\n\nR=iannucci@chromium.org\nBUG=\n\nReview URL: https://chromiumcodereview.appspot.com/20481003\n\ngit-svn-id: 239fca9b83025a0b6...
python
chosen
[ { "from": "human", "value": "Add example for Tic-Tac-Toe with a Q-Network via Self-play\n" }, { "from": "gpt", "value": "'''\nThe Q-learning algorithm is used to learn the state-action values for all\nTic-Tac-Toe positions by playing games against itself (self-play).\n'''\nfrom capstone.game.gam...
python
chosen
[ { "from": "system", "value": "Add a bug link field\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\nclass Project(models.Model):\n name = models.CharField(max_length=200)\n language = models.CharField(max_length=200)\n icon_url = models.URLF...
python
chosen
[ { "from": "human", "value": "Add migration that cascades deletion of handover/draft on delete\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-06-16 15:00\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport dja...
python
chosen
[ { "from": "human", "value": "Add ValBST for Zest Skype\n" }, { "from": "gpt", "value": "\"\"\"\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.right = None, None\n\"\"\"\nclass Solution:\n \"\"\"\n @param root: The ro...
python
chosen
[ { "from": "human", "value": "Add file for info dialog\n" }, { "from": "gpt", "value": "##\n## patts-qt - Qt GUI client for PATTS\n## Copyright (C) 2015 Delwink, LLC\n##\n## This program is free software: you can redistribute it and/or modify\n## it under the terms of the GNU Affero General P...
python
chosen
[ { "from": "human", "value": "Add unit tests for netready\n\nChange-Id: I45f9209c55bd65c9538fc3b1181ccbcfbdd23a40\nSigned-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Copyright (c) 2017 Orange and others....
python
chosen
[ { "from": "human", "value": "Add script for copying strings from one project/app to another\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os\nimport os.path\nimport sys\n\nimport lxml.etree\n\nsource_path = os.path.expanduser('~/workspace/git/android/platform/packages/apps/Mms...
python
chosen
[ { "from": "human", "value": "Add ACAS to dvla_org_id table\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0241_another_letter_org\nRevises: 0240_dvla_org_non_nullable\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0241_another_letter_org'\ndown_revision ...
python
chosen
[ { "from": "human", "value": "Add migration for related podcasts\n\nChange was discovered by makemigrations, even though no change was made in the\nsource.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-02-07 17:10\nfrom __future__ import unicode_lit...
python
chosen
[ { "from": "human", "value": "Add nilrt_ip module unit tests\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Import python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Libs\nimport salt.modules.nilrt_ip as nilrt_ip\n\n# Import Salt ...
python
chosen
[ { "from": "human", "value": "Add unitest for restclient PoolManager and http proxy\n" }, { "from": "gpt", "value": "# Copyright 2017 The Kubernetes Authors.\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....
python
chosen
[ { "from": "human", "value": "Add example of spatial query\n" }, { "from": "gpt", "value": "from pprint import pprint\nfrom amigocloud import AmigoCloud\n\n# Use amigocloud version 1.0.5 or higher to login with tokens\n# This will raise an AmigoCloudError if the API token is invalid or has expire...
python
chosen
[ { "from": "human", "value": "Add a command to generate xform archives on the remote server\n(without downloading)\n" }, { "from": "gpt", "value": "\"\"\" This script generates all the necessary data to \nsynchronize with a remote CommCareHQ server on that server.\nThis is only really useful if y...
python
chosen
[ { "from": "human", "value": "Add one-off to recalculate migrated cases\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom collections import namedtuple\n\nfrom corehq.apps.userreports.models import AsyncIndicator, get_datasource_config\nfrom corehq.apps.us...
python
chosen
[ { "from": "human", "value": "Test that asserts all public classes have pydoc\n" }, { "from": "gpt", "value": "\"\"\"Test code format and coding standards.\"\"\"\nimport importlib\nimport inspect\nimport pkgutil\nimport unittest\n\n\ndef setUpModule():\n global modules\n modules = [name for...
python
chosen
[ { "from": "system", "value": "Use proper namespace for constants.\n" }, { "from": "human", "value": "'''Helper code for theanets unit tests.'''\n\nimport numpy as np\n\n\nclass MNIST(object):\n NUM_DIGITS = 100\n DIGIT_SIZE = 784\n\n def setUp(self):\n # we just create some rando...
python
chosen
[ { "from": "human", "value": "Add gcl presubmit script to the dart src tree.\n\nCurrently I just added a tree status check but we can extend this over time.\nReview URL: https://chromiumcodereview.appspot.com//10891021\n\ngit-svn-id: c93d8a2297af3b929165606efe145742a534bc71@11575 260f80e4-7a28-3924-810f-c041...
python
chosen
[ { "from": "human", "value": "Add unit test for Contact view\n" }, { "from": "gpt", "value": "from django.contrib.auth.models import User\nfrom django.test import TestCase\nfrom rest_framework.test import APIRequestFactory\n\nfrom feed.views import ContactViewSet\nfrom workflow.models import Cont...
python
chosen
[ { "from": "human", "value": "Add script for stratified partitioning instances\n" }, { "from": "gpt", "value": "\"\"\"\nThis script is different from `ycml.scripts.partition_lines` because it takes labels into account and produces stratified partitions.\n\"\"\"\n\nfrom argparse import ArgumentPar...
python
chosen
[ { "from": "human", "value": "Add MCP3008 spi interface implementation\n" }, { "from": "gpt", "value": "import spidev\n\n\nclass MCP3008SpiReader(object):\n\n def __init__(self, device_id):\n self.device = spidev.SpiDev()\n self.device.open(0, device_id)\n self.device.max_speed_hz = 100...
python
chosen
[ { "from": "human", "value": "Add Period delta extraction test.\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nfrom __future__ import unicode_literals\n\nfrom datetime import timedelta\n\nfrom common import FieldExam\nfrom marrow.mongo.field import Period\n\n\nclass TestHourPeriodField(Fie...
python
chosen
[ { "from": "human", "value": "Add functional tests for telementry resource\n\nChange-Id: I8192452971a0f04fbd6a040c3c048f9284d58bb3\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the Licens...
python
chosen
[ { "from": "human", "value": "Add example of using counties with different resolutions.\n" }, { "from": "gpt", "value": "# Copyright (c) 2018 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"\nUS Counties\n===========\n\...
python
chosen
[ { "from": "human", "value": "Add a script to rename directories if a missing layer was really a removed duplicate\n\nThis is quite specific to a situation we encountered, where\na layer that I regarded as missing was really a duplicated\nlayer that was removed without adjusting the z coordinates.\nThis scri...
python
chosen
[ { "from": "human", "value": "Add migration script to update indicators\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom django.db import models, migrations\nfrom django.db.models import Q\n\nimport datetime\n\ndef populate_pivoteer_indicat...
python
chosen
[ { "from": "human", "value": "Make count files which works correctly for words, but not yet for morphed count files\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport argparse\n\nimport collections\nimport os\nfrom fractions import Fraction\n\n\ndef main(countfile, origcount, order...
python
chosen
[ { "from": "human", "value": "Add script for adding addresses from file to mailing list on server\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport MySQLdb\n\n# Ask for root password in mysql\npasswd = raw_input(\"Enter password for user root in mysql: \")\n\n# Open database connection...
python
chosen
[ { "from": "human", "value": "Add distance to camera document\n" }, { "from": "gpt", "value": "# Import image library necessary for file\nimport SimpleCV\nimport sys\nfrom SimpleCV import Image\n \ndef check_image(image_path):\n\t#Find file by path and import. File currently resides in same dire...
python
chosen
[ { "from": "human", "value": "Add a way to run all the tests at once\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nfrom common import *\n\nfrom test_cpu_collector import *\nfrom test_disk import *\nfrom test_disk_space_collector import *\nfrom test_disk_usage_collector import *\nfrom test...
python
chosen
[ { "from": "human", "value": "Add script to set fvOptions\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nGenerate fvOptions and topoSetDict for turbines\n\"\"\"\nfrom __future__ import division, print_function\nimport numpy as np\nimport os\nimport sys\nimport argparse\n\n\ndef m...
python
chosen
[ { "from": "human", "value": "Add a pip scanning tool that can compare whats in a distro yaml against what source pip/test-requires may desire\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport re\n\npossible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),\n ...
python
chosen
[ { "from": "human", "value": "Add a script to compute powers of 10\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Compute 10 ** exp with exp in the range [min_exponent, max_exponent] and print\n# normalized (with most-significant bit equal to 1) significands in hexadecimal.\n\nfrom __f...
python
chosen
[ { "from": "human", "value": "Add unit tests for counting sort\n" }, { "from": "gpt", "value": "import unittest\n\nfrom aids.sorting_and_searching.counting_sort import counting_sort\n\nclass CountingSortTestCase(unittest.TestCase):\n '''\n Unit tests for counting sort\n\n '''\n\n def ...
python
chosen
[ { "from": "human", "value": "Call the new presubmit checks from chrome/ code, with a blacklist.\n\nReview URL: http://codereview.chromium.org/400014\n\ngit-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@32190 4ff67af0-8c30-449e-8e8b-ad334ec8d88c\n" }, { "from": "gpt", "value": "# Copyright (c)...
python
chosen
[ { "from": "human", "value": "Change interpolation using TL's LagrangeApproximation\n" }, { "from": "gpt", "value": "import numpy as np\nimport scipy as sp\n\nfrom pySDC.core.ConvergenceController import ConvergenceController\nfrom pySDC.core.Lagrange import LagrangeApproximation\n\n\nclass Switc...
python
chosen
[ { "from": "human", "value": "Add initial code for whole image evaluation script\n" }, { "from": "gpt", "value": "import os\nimport cppyy\n\ndef get_naoth_dir():\n script_path = os.path.abspath(__file__)\n return os.path.abspath(os.path.join(script_path, \"../../../../../\"))\n\ndef init_si...
python
chosen
[ { "from": "human", "value": "Add db connector and insert function\n" }, { "from": "gpt", "value": "import os\nfrom shutil import copyfile\nfrom datetime import datetime\n\nfrom infi.clickhouse_orm import models, fields, engines\nfrom infi.clickhouse_orm.database import Database\n\nif not os.path...
python
chosen
[ { "from": "human", "value": "Add auto migration for responsive images\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 ('feedb...
python
chosen
[ { "from": "human", "value": "Add register plate camera endpoint placeholder\n" }, { "from": "gpt", "value": "\"\"\"\nPLATECAMERA endpoint.\n\nYou must declare environment variable PLATECAMERA_URL to activate this plugin.\n\nIf you are running development server (`python manage.py runserver`), yo...
python
chosen
[ { "from": "system", "value": "Fix a potential error in the TwitterCacheManager.\n\nThis looks like it would fail at some point. Python\nmagic is keeping it going I guess. Referencing the manager\ninstance from the manager class seems bad though.\n" }, { "from": "human", "value": "from django.cor...
python
chosen
[ { "from": "human", "value": "Add simple python RF example.\n" }, { "from": "gpt", "value": "import sys\nimport json\n\nsys.path.extend(['.','..','py'])\nimport h2o, h2o_cmd, h2o_import as h2i\n\n\n#\n# This is intended to be the simplest possible RF example.\n# Look at sandbox/commands.log for R...
python
chosen
[ { "from": "human", "value": "Add simple python file for doing Arch API sanity checks.\n\nSigned-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>\n" }, { "from": "gpt", "value": "\"\"\" Script to do Arch API sanity checking.\n\nThis python script can be us...
python
chosen
[ { "from": "human", "value": "Add monitor script for taints\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\" Node taints check for OpenShift V3 \"\"\"\n\n# Adding the ignore because it does not like the naming of the script\n# to be different than the class name\n# pylint: disable=i...
python
chosen
[ { "from": "human", "value": "Add basic user management controller\n" }, { "from": "gpt", "value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Publish What You Fund\n#\n# This...
python
chosen
[ { "from": "human", "value": "Add a test that proves that constraints are not specialised\n" }, { "from": "gpt", "value": "from unittest.mock import Mock\n\nfrom jacquard.cli import main\nfrom jacquard.storage import DummyStore\n\n\nDUMMY_DATA_PRE_LAUNCH = {\n 'experiments/foo': {\n 'br...
python
chosen
[ { "from": "human", "value": "Add Chuanping Yu's solutions to Problem03" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\"This script is written by Chuanping Yu, on Jul 24, 2017,\nfor the Assignment#1 in IDEaS workshop\"\"\"\n\n#Problem 3\nI = 3\nN = 600851475143\nF = []\nwhile I*I <...
python
chosen
[ { "from": "human", "value": "Add unit test for QGraphicsItem.isBlockedByModalPanel()\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport unittest\n\nfrom PySide import QtGui, QtCore\nfrom helper import UsesQApplication\n\nclass Item(QtGui.QGraphicsItem):\n \n def __init__(self):\n...
python
chosen
[ { "from": "human", "value": "Add docker image info tests\n" }, { "from": "gpt", "value": "import pytest\n\nfrom django.conf import settings\n\nfrom docker_images.image_info import get_image_name, get_image_info, get_tagged_image\nfrom factories.factory_build_jobs import BuildJobFactory\nfrom tes...
python
chosen
[ { "from": "human", "value": "Add test for byte serialisation\n" }, { "from": "gpt", "value": "from ...neural import Maxout\nfrom ...api import chain\n\n\ndef test_simple_model_roundtrip_bytes():\n model = Maxout(5, 10, pieces=2)\n model.b += 1\n data = model.to_bytes()\n model.b -= 1...
python
chosen
[ { "from": "human", "value": "Add a consolidated test suite which could be imported by the tryton test suite\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n __init__\n\n Nereid Tryton module test cases\n\n :copyright: (c) 2011 by Openlabs Technologies & Consulting (P) ...
python
chosen
[ { "from": "human", "value": "Add tool for inspection of bruker directories\n" }, { "from": "gpt", "value": "import glob\nimport sys\nimport os\n\n#directory = input(\"Enter Directory: \")\n#print(\"Directory: \", directory)\n\n\n\nfolder = \"/home/benno/Dropbox/RESEARCH/bullet/experiments/H2O17a...
python
chosen
[ { "from": "human", "value": "Add script that compares WAVE and FLAC reads.\n" }, { "from": "gpt", "value": "from pathlib import Path\nimport random\nimport time\n\nimport soundfile as sf\n\n\nDIR_PATH = Path('/Users/harold/Desktop/NFC/FLAC Test')\n# DIR_PATH = Path('/Volumes/Recordings1/FLAC Tes...
python
chosen
[ { "from": "human", "value": "Add script to convert infernal output to full_region\n" }, { "from": "gpt", "value": "\"\"\"\nCopyright [2009-2019] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in complian...
python
chosen
[ { "from": "human", "value": "Add test for word class converter\n" }, { "from": "gpt", "value": "import unittest\nfrom werkzeug.routing import ValidationError\n\nfrom app import create_app, db\nfrom app.models import Noun, Verb\nfrom app.converters import WordClassConverter\n\n\nclass TestUtils(u...
python
chosen
[ { "from": "system", "value": "Use find_packages to find migrations and management commands\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\n\ninstall_requires = ['Django>=1.5']\ntry:\n from collections import OrderedDict\nexcept ImportError:\n ins...
python
chosen
[ { "from": "human", "value": "chore: Add helpers for creating images\n" }, { "from": "gpt", "value": "import os\nfrom alpha_vantage.timeseries import TimesSeries\nfrom alpha_vantage.techindicators import TechIndicators\nimport matplotlib.pyplot as plt\n\nif __name__ == '__main__':\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add basic test for the client and server APIs.\n" }, { "from": "gpt", "value": "import unittest\n\nimport tulip\n\nfrom .client import *\nfrom .server import *\n\n\n@tulip.coroutine\ndef echo(ws, uri):\n ws.send((yield from ws.recv()))\n\n\nclass ClientServerTests...
python
chosen
[ { "from": "human", "value": "Add a test to check that ghostscript is installed.\n" }, { "from": "gpt", "value": "import subprocess\nimport unittest\n\n\nclass GhostscriptTest(unittest.TestCase):\n\n def test_installed(self):\n process = subprocess.Popen(\n ['gs', '--version'...
python
chosen
[ { "from": "human", "value": "Add basic unit test for index status code\n" }, { "from": "gpt", "value": "import unittest\nfrom app import app\n\nclass TestScorepy(unittest.TestCase):\n def setUp(self):\n self.app = app.test_client()\n self.app.testing = True\n\n def tearDown(s...
python
chosen
[ { "from": "human", "value": "Add Telemetry measurement for Polymer demo app\n\nThis is a rough first version that simply measures time until\nfirst full layout.\n\nCurrent timing of ten runs:\n\n*RESULT Total: Total= [2828,2292,2477,2454,2491,2463,2515,2501,2484,2595] ms\nAvg Total: 2510.000000ms\nSd Total...
python
chosen
[ { "from": "human", "value": "Add test for ENSURE INDEPENDENT. Depdendent is disabled for now, pending conditional models.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# The MIT License (MIT)\n\n# Copyright (c) 2015-2016 MIT Probabilistic Computing Project\n\n# Lead Developer: Fera...
python
chosen
[ { "from": "human", "value": "Add tests for GPG signature handling\n\nThis will ideally prevent #137 from regressing.\n" }, { "from": "gpt", "value": "# Copyright 2015 Ian Cordasco\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compl...
python
chosen
[ { "from": "human", "value": "Add tests for Model properties\n" }, { "from": "gpt", "value": "import pytest\n\nfrom ....base import Model\nfrom ....ops import NumpyOps\n\n\n@pytest.fixture\ndef model():\n model = Model(ops=NumpyOps())\n return model\n\ndef test_can_get_describe_params(model...
python
chosen
[ { "from": "human", "value": "Add functional tests for rally verify\n\nFunctional tests for:\n - launch verification for \"image\" set\n - launch verification for \"smoke\" set\n\nChange-Id: Ia7073e1ed57fb3efd18800a51289316a922b9d19\n" }, { "from": "gpt", "value": "# Copyright 2014: Mirantis Inc....
python
chosen
[ { "from": "human", "value": "Add a Python solution for Hide&Seek game\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\n# -*- coding: utf-8 -*-\n\nfrom itertools import permutations, chain\n\n# Board\n\nEmpty = 1\nElephant = 2\nLion = 3\nZebra = 5\nGazelle = 7\nRhino = 11\n\n# E L | G...
python
chosen
[ { "from": "human", "value": "Add out persistent storage backed shuffler\n" }, { "from": "gpt", "value": "# Condenses all the feature files into a single location,\n# Split by the names of the features\n\n\nimport sys\nfrom os.path import isfile\nimport os\nimport json\n\npath = sys.argv[1]\nout_...
python
chosen
[ { "from": "human", "value": "Add utility script for creating LM trie\n" }, { "from": "gpt", "value": "import pytorch_ctc\nimport json\nimport argparse\n\nparser = argparse.ArgumentParser(description='LM Trie Generation')\nparser.add_argument('--labels', help='path to label json file', default='l...
python
chosen
[ { "from": "human", "value": "Make script for parsing elastic mappings and generating statistics\n" }, { "from": "gpt", "value": "import json\n\ndef packaged(data):\n for o in data.values():\n for mtype, typemapping in o.items():\n props = typemapping['properties']\n ...
python
chosen
[ { "from": "system", "value": "Remove separate execute mif command.\n" }, { "from": "human", "value": "from sim import Sim\nfrom mesh import Mesh\nfrom exchange import Exchange\nfrom demag import Demag\nfrom zeeman import Zeeman\n\n# Mesh specification.\nlx = ly = lz = 50e-9 # x, y, and z dimens...
python
chosen
[ { "from": "human", "value": "Move to a type field\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9b1 on 2015-11-16 09:44\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\ndef populate_type_field(apps, schema_editor):\n f...
python
chosen
[ { "from": "human", "value": "Add testcase for readline-using-libedit on OSX\n" }, { "from": "gpt", "value": "\"\"\"\nVery minimal unittests for parts of the readline module.\n\nThese tests were added to check that the libedit emulation on OSX and\nthe \"real\" readline have the same interface fo...
python
chosen
[ { "from": "human", "value": "Solve Code Fights cracking password problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Cracking Password Problem\n\nfrom itertools import product\n\n\ndef crackingPassword(digits, k, d):\n def createNumber(digs):\n return \"\".j...
python
chosen
[ { "from": "human", "value": "Add unit tests for flight_is_active\n" }, { "from": "gpt", "value": "from mock import MagicMock, Mock, patch\nfrom random import randint\n\nfrom r2.tests import RedditTestCase\n\nfrom reddit_adzerk.adzerkpromote import flight_is_active\n\n\nclass TestIsActive(RedditT...
python
chosen
[ { "from": "human", "value": "Add new tracker for by overlap status gene profile plots in pipeline_intervals\n" }, { "from": "gpt", "value": "import os, sys, re, types, itertools\nimport matplotlib.pyplot as plt\nimport numpy\nimport numpy.ma\nimport Stats\nimport Histogram\nimport Annotations\n\...
python
chosen
[ { "from": "human", "value": "Add migration for user_assignee Case field\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nfrom django.conf import settings\n\n\nclass Mig...
python
chosen
[ { "from": "human", "value": "Add a script to analyse ring topology simulations\n" }, { "from": "gpt", "value": "import h5manager as hm\nimport tables\nimport matplotlib.pyplot as plt\nimport numpy as np\n\ndef main(dbfile):\n # Get the simulations\n db = tables.openFile(dbfile)\n simus ...
python
chosen