conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "ADD Domain groups unit tests\n" }, { "from": "gpt", "value": "\ndef test_create_group(client):\n result = client.post(\"/groups/\", data={\"group_name\": \"group test\", \"members\": [\"239y94asd\", \"whor244123\"]})\n assert result.status_code == 200\n asse...
python
chosen
[ { "from": "human", "value": "Add test case for Output class.\n" }, { "from": "gpt", "value": "import numpy as np\nimport pyfds as fds\n\n\ndef test_output():\n out = fds.Output(fds.LineRegion([0, 1, 2], [0, 0.2], 'test output'))\n out.signals = [np.linspace(0, 1) for _ in range(len(out.reg...
python
chosen
[ { "from": "human", "value": "Add script to extract the shape of all blocks contained in the 2000 MSA\n" }, { "from": "gpt", "value": "\"\"\"shape_msa_block.py\n\nOutput one shapefile per MSA featuring all the blocks it contains\n\"\"\"\nimport os\nimport csv\nimport fiona\n\n\n#\n# Import MSA to...
python
chosen
[ { "from": "human", "value": "Move out Apache specific Objects\n" }, { "from": "gpt", "value": "\"\"\"Module contains classes used by the Apache Configurator.\"\"\"\n\nclass Addr(object):\n \"\"\"Represents an Apache VirtualHost address.\"\"\"\n def __init__(self, addr):\n \"\"\":par...
python
chosen
[ { "from": "human", "value": "Create tests for basic angle computations\n" }, { "from": "gpt", "value": "import unittest\n\nfrom flatlib import angle\n\n\nclass AngleTests(unittest.TestCase):\n\n def setUp(self):\n pass\n\n def test_norm(self):\n \"\"\"Tests angle normalizatio...
python
chosen
[ { "from": "human", "value": "Add unique keys for non locking model\n\nThe unique key colums are part of the new non locking model.\nThe migration scripts adds 2 unique key columns to 2 tables.\n\nOne of the new columns is already in the model and the other is\nunder review.\n\nChange-Id: Icd352ed709f378a814...
python
chosen
[ { "from": "human", "value": "Test err handling in Py glue.\n\nCheck that a Clownfish exception gets transformed into a Python\nexception.\n" }, { "from": "gpt", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file ...
python
chosen
[ { "from": "human", "value": "Add compute swap when needed\n" }, { "from": "gpt", "value": "# The MIT License (MIT)\n#\n# Copyright (c) 2015 Taio Jia (jiasir) <jiasir@icloud.com>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated ...
python
chosen
[ { "from": "human", "value": "Fix bad chip ID error when using MPU9250 class with MPU9255 sensor\n" }, { "from": "gpt", "value": "# mpu9255.py MicroPython driver for the InvenSense MPU9255 inertial measurement unit\n# Authors Peter Hinch, Sebastian Plamauer\n# V0.1 7th October 2022\n\n'''\nmpu925...
python
chosen
[ { "from": "human", "value": "Add test for gpu datetime\n" }, { "from": "gpt", "value": "from __future__ import print_function\n\nimport numpy as np\n\nfrom numba import cuda\nfrom numba import unittest_support as unittest\nfrom numba.tests.support import TestCase\nfrom numba.cuda.testing import ...
python
chosen
[ { "from": "human", "value": "Add a few error classes\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n" }, { "from": "gpt", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed...
python
chosen
[ { "from": "human", "value": "Test for handling hyphenated agents in biopax\n\nAlso agents including spaces, etc.\n" }, { "from": "gpt", "value": "from belpy.biopax import biopax_api\nfrom belpy.pysb_assembler import PysbAssembler\n\ndef test_hyphenated_agent_names():\n \"\"\"This query should...
python
chosen
[ { "from": "human", "value": "Add a function to say whether or not chef is the current host.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n\ndef is_this_chef():\n from socket import gethostname\n return gethostname() == 'chef.compbio.ucsf.edu'\n\ndef require_chef():\n if not i...
python
chosen
[ { "from": "human", "value": "Add letter to possible template types in DB\n\nA letter type was added to the `enum` in the `Template` model at the\nsame it was added to the `Notification` model. But the migration was\nonly done for the `notifications` table, not the `templates` table.\n\nSee: https://github.c...
python
chosen
[ { "from": "human", "value": "Implement h264 and png as ext hooks\n" }, { "from": "gpt", "value": "import os\nfrom . import hooks\nfrom .viewport import playblast\n\n\ndef default_handler(data, options):\n\n _, ext = os.path.splitext(data['filename'])\n is_qt = ext == '.mov'\n\n kwargs =...
python
chosen
[ { "from": "human", "value": "Add the concepts required for the neuron catalogue Django application\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom common import db_connection\n\nimport sys\n\nif len(sys.argv) != 3:\n print >> sys.stderr, \"Usage: %s <PROJECT-ID> <USER-ID>\"\n ...
python
chosen
[ { "from": "human", "value": "Add a new example test\n" }, { "from": "gpt", "value": "\"\"\"\nThis test demonstrates the use of encryption/decryption.\n(Technically, obfuscation/unobfuscation.)\n\"\"\"\n\nfrom seleniumbase import BaseCase\nfrom seleniumbase import encryption\n\n\nclass MyTestClas...
python
chosen
[ { "from": "human", "value": "Add testbed file for mlab\n" }, { "from": "gpt", "value": "from fabric.api import env\n\n#Management ip addresses of hosts in the cluster\nhost1 = 'root@10.84.19.42'\nhost2 = 'root@10.84.19.43'\nhost3 = 'root@10.84.19.44'\nhost4 = 'root@10.84.19.45'\nhost5 = 'root@10...
python
chosen
[ { "from": "human", "value": "Add unit tests for proposal method getter methods\n\ncloses #448\n" }, { "from": "gpt", "value": "# Third Party Stuff\nimport pytest\nfrom tests import factories as f\n\n\n@pytest.mark.parametrize('method', [\n 'get_absolute_url',\n 'get_delete_url',\n 'get_...
python
chosen
[ { "from": "human", "value": "Remove forward slashes from wiki page names\n" }, { "from": "gpt", "value": "\"\"\"\nRemove forward slashes from wiki page titles, since it is no longer an allowed character and\nbreaks validation.\n\"\"\"\nimport logging\nimport sys\n\nfrom framework.mongo import da...
python
chosen
[ { "from": "human", "value": "Add tests for new skeleton class\n" }, { "from": "gpt", "value": "import os, sys\nfrom collections import defaultdict\nimport numpy as np\nfrom numpy.testing import assert_equal, assert_allclose\nfrom skan.csr import Skeleton\n\nfrom skan._testdata import (tinycycle,...
python
chosen
[ { "from": "human", "value": "Add utility t print out detector information from an image file\n" }, { "from": "gpt", "value": "\"\"\"\nDetector utilities\n\"\"\"\n\n__license__ = \"\"\"\nThis file is part of RAPD\n\nCopyright (C) 2016, Cornell University\nAll rights reserved.\n\nRAPD is free soft...
python
chosen
[ { "from": "human", "value": "Add missing test from functionality in previous commit\n" }, { "from": "gpt", "value": "\"\"\"\r\nTests for https://github.com/jic-dtool/dtoolcore/issues/20\r\n\"\"\"\r\n\r\nimport os\r\nimport time\r\n\r\nfrom . import tmp_dir_fixture # NOQA\r\n\r\nimport dtoolcore...
python
chosen
[ { "from": "human", "value": "Add functional test for command-line interface\n" }, { "from": "gpt", "value": "# Copyright (c) 2013, Sascha Peilicke <saschpe@gmx.de>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License v...
python
chosen
[ { "from": "human", "value": "Add utility/example for downloading single sciobj from CN or MN\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE. For\n# mo...
python
chosen
[ { "from": "human", "value": "Add tests for hybrid properties\n" }, { "from": "gpt", "value": "from pytest import raises\nimport sqlalchemy as sa\nfrom sqlalchemy.ext.hybrid import hybrid_property\nfrom wtforms_alchemy import ModelForm\nfrom wtforms_alchemy.exc import AttributeTypeException\nfrom...
python
chosen
[ { "from": "human", "value": "Add management command to set all user profiles to defaults\n" }, { "from": "gpt", "value": "from django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.core.management.base import NoArgsCommand, CommandError\n\nclass Command(NoArgsComm...
python
chosen
[ { "from": "human", "value": "Add script to check UI languages coverage\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os.path\nimport sys\nimport subprocess\n\nfrom txclib import utils\nfrom txclib.project import Project\ntry:\n from json import loads as...
python
chosen
[ { "from": "human", "value": "Add a command to start the WebUI using oq\n\nThe django development server is started in foreground\non localhost:8800. Meant to be used with multi_user = false\nbut works also if true.\n\n\nFormer-commit-id: 5df6e6b3ec523376906abeb8a52eb6c5dc5d46ec [formerly bbfc5549fb632d535ed...
python
chosen
[ { "from": "human", "value": "Add a Korean example test\n" }, { "from": "gpt", "value": "# Korean Language Test - Python 3 Only!\nfrom seleniumbase.translate.korean import 셀레늄_테스트_케이스 # noqa\n\n\nclass 테스트_클래스(셀레늄_테스트_케이스): # noqa\n\n def test_실시예_1(self):\n self.URL_열기(\"https://ko.w...
python
chosen
[ { "from": "human", "value": "Add spider for Loves Travel Stops\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport json\n\nfrom locations.items import GeojsonPointItem\n\nHEADERS = {'Content-Type': 'application/json'}\n\n\nclass LovesSpider(scrapy.Spider):\n name =...
python
chosen
[ { "from": "human", "value": "Add Hamming Distance in Python\n" }, { "from": "gpt", "value": "def HammingDistance(s1, s2):\n\tif len(s1) != len(s2):\n\t\traise ValueError(\"ERROR: Strings must have the same length\")\n\treturn sum(c1 != c2 for c1, c2 in zip(s1, s2))" } ]
python
chosen
[ { "from": "human", "value": "Add python script to project\n\nTemperature measurement using raspberry pi. Temperatures are save to MySql database." }, { "from": "gpt", "value": "import os\nimport glob\nimport time\nimport datetime\nimport MySQLdb as mdb\n\nos.system('modprobe w1-gpio')\nos.system...
python
chosen
[ { "from": "human", "value": "Set up module to map to the correct package manager for the OS\n" }, { "from": "gpt", "value": "'''\nTop level package command wrapper, used to translate the os detected by facter\nto the correct package manager\n'''\nimport salt.modules.pacman\nimport salt.modules.y...
python
chosen
[ { "from": "human", "value": "Add db data correcting script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2014 Google Inc. All Rights Reserved.\n\nimport models\nimport uma\n\n\ndef CorrectPropertyName(bucket_id):\n if bucket_id in uma.CSS_PROPERTY_B...
python
chosen
[ { "from": "human", "value": "Add basic test for aiodataloader\n" }, { "from": "gpt", "value": "from collections import namedtuple\nfrom unittest.mock import Mock\nfrom pytest import mark\nfrom aiodataloader import DataLoader\n\nfrom graphene import ObjectType, String, Schema, Field, List\n\n\nCH...
python
chosen
[ { "from": "human", "value": "Add elliptope manifold test skeleton.\n" }, { "from": "gpt", "value": "import unittest\n\nimport numpy as np\nimport numpy.linalg as la\nimport numpy.random as rnd\nimport numpy.testing as np_testing\n\nfrom pymanopt.manifolds import Elliptope\n\n\nclass TestElliptop...
python
chosen
[ { "from": "human", "value": "Add script to run/test the mojo media renderer.\n\nThe script follows mojo/services/html_viewer/view_url.py. See the script for\nhow to use it.\n\nBUG=410451\nTEST=Run the script to test.\n\nReview URL: https://codereview.chromium.org/991963003\n\nCr-Commit-Position: 972c6d2dc6d...
python
chosen
[ { "from": "human", "value": "Add script for a simple test\n" }, { "from": "gpt", "value": "import earthpy.io as eio\nimport rasterio as rio\n\nwith rio.open(eio.path_to_example('rmnp-dem.tif')) as src:\n dem = src.read()\n" } ]
python
chosen
[ { "from": "human", "value": "Add useful script for standartizing data in beta simulator and the normal one\n" }, { "from": "gpt", "value": "import sys\nimport os\nimport pandas as pd\n\nfrom utils import get_driving_log_dataframe\nfrom utils import img_folder\n\nfrom shutil import copyfile\n\ndi...
python
chosen
[ { "from": "human", "value": "Add migration script that appends node and client IPs to indy env file.\n\nSigned-off-by: Sergey Shilov <064bbdfaeb89a0bebebfe7b388747a73c8941704@dsr-company.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/python3.5\nimport os\nimport sys\nimport traceback\n\nfrom i...
python
chosen
[ { "from": "human", "value": "Add parsing for describing UIElement start/stop\n\nSigned-off-by: xcgspring <8f4f8d15922e4269158d45cde01dc3497961f40d@126.com>\n" }, { "from": "gpt", "value": "'''\nIn app map, sometimes need to describe how to start and close one UI element\nSo create a simple comma...
python
chosen
[ { "from": "human", "value": "Add py solution for 450. Delete Node in a BST\n\n450. Delete Node in a BST: https://leetcode.com/problems/delete-node-in-a-bst/\n" }, { "from": "gpt", "value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# s...
python
chosen
[ { "from": "human", "value": "Add example CTL Prep Plug-in\n\nCan be referenced or used to save CTL credentials in CB and add a public\nIP.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"\nUsed to configure some prerequisites that a CenturyLink VM needs before we can\nsuccessfull...
python
chosen
[ { "from": "human", "value": "Move the Python end of blog-fetch to LASS.\n" }, { "from": "gpt", "value": "\"\"\"Fetches the blogs configured on the website to local files.\n\nThe local files dumped to are 'BLOGNAME.incoming.yml' in the\nassets/blogs directory.\n\nShould be run as a regular cron-j...
python
chosen
[ { "from": "human", "value": "Add proper view_osfuser permission to read_only and admin groups\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-04-05 17:30\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django....
python
chosen
[ { "from": "human", "value": "Implement MissingInteger (microsoft oa demo)\n" }, { "from": "gpt", "value": "'''\nhttps://app.codility.com/demo/results/demoHZEZJ5-D8X/\n\n\n\nThis is a demo task.\nWrite a function:\n\n def solution(A)\n\nthat, given an array A of N integers, returns the smalles...
python
chosen
[ { "from": "human", "value": "resources: Add git hook to auto-stage docs files\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThis script provides automatic update and staging of documentation files when\n\"raw\" documentation files have been changed.\...
python
chosen
[ { "from": "human", "value": "Add a management command for accepting invites\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\n\nfrom corehq.apps.users.models import WebUser\n\nfrom corehq.apps.users.models import Invitation, CouchUser\n\n\nclass Command(BaseCo...
python
chosen
[ { "from": "human", "value": "Add crawler for 'Gun show'\n" }, { "from": "gpt", "value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Gun Show'\n language = 'en'\n url = 'http://www.gunshowco...
python
chosen
[ { "from": "human", "value": "Add conf file for ifb burundi\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"KoomBook conf\"\"\"\n\nfrom .base import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\n# SECURITY WARNING: don't run with debug turned on in produc...
python
chosen
[ { "from": "human", "value": "Add solution to lintcode question 116\n" }, { "from": "gpt", "value": "class Solution:\n # @param A, a list of integers\n # @return a boolean\n def canJump(self, A):\n # write your code here\n\n # Brute Force\n jumpable = [False] * len(A...
python
chosen
[ { "from": "human", "value": "Add some tests for the console module\n\n... better late than never?\n\nSigned-off-by: Zack Cerza <d7cdf09fc0f0426e98c9978ee42da5d61fa54986@redhat.com>\n" }, { "from": "gpt", "value": "from teuthology.config import config as teuth_config\n\nfrom .. import console\n\n...
python
chosen
[ { "from": "human", "value": "Add letter logo for Welsh Revenue Authority\n\nDepends on:\n- [ ] https://github.com/alphagov/notifications-template-preview/pull/94\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0165_another_letter_org\nRevises: 0164_add_organisation_to_servic...
python
chosen
[ { "from": "human", "value": "Remove drafts with no serviceName\n\nIn production we have 1237 draft services from 806 suppliers that only have a lot selected but no other data.\n\nThese have never been counted or shown to suppliers, but with the new lot changes for DOS they will be counted in G-7 draft servi...
python
chosen
[ { "from": "human", "value": "Add script to build cutline map\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom osgeo import ogr\nfrom osgeo import osr\nfrom glob import glob\nimport os.path\n\ndriver = ogr.GetDriverByName(\"ESRI Shapefile\")\nds = driver.CreateDataSource(\"cutline-map...
python
chosen
[ { "from": "human", "value": "Create example for Counting Bloom Filter\n" }, { "from": "gpt", "value": "\"\"\"Example how to use Counting Bloom Filter.\"\"\"\n\nfrom pdsa.membership.counting_bloom_filter import CountingBloomFilter\n\n\nLOREM_IPSUM = (\n \"Lorem ipsum dolor sit amet, consectetu...
python
chosen
[ { "from": "human", "value": "Add profile reader plugin base class\n\nThis class is identical to the mesh reader base class. It simply defines a read() function that will give an exception if the plugin is not implemented properly.\n\nContributes to issue CURA-34.\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "human", "value": "Add script to create statedecoded index\n" }, { "from": "gpt", "value": "\n\nsettings = {\n \"mappings\": {\n \"law\": {\n \"properties\": {\n \"text\": {\n \"type\": \"string\",\n \"term_vector\": \"with_positions_...
python
chosen
[ { "from": "human", "value": "Add test case for Schulze method\n" }, { "from": "gpt", "value": "from mclearn.aggregators import schulze_method\n\n\nclass TestAggregators:\n @classmethod\n def setup_class(cls):\n cls.voters = \\\n [['A', 'C', 'B', 'E', 'D']] * 5 + \\\n ...
python
chosen
[ { "from": "human", "value": "Clean up old, incomplete jobs\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0203_fix_old_incomplete_jobs\nRevises: 0202_new_letter_pricing\nCreate Date: 2017-06-29 12:44:16.815039\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision ...
python
chosen
[ { "from": "human", "value": "Add script for listing available / installed action runners.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this wo...
python
chosen
[ { "from": "human", "value": "Add unit tests for certificates_client\n\nThis patch adds unit tests for certificates_client module\n\nChange-Id: If5427832a7446590c3a4b5d62bfe61d70bd1d112\n" }, { "from": "gpt", "value": "# Copyright 2015 NEC Corporation. All rights reserved.\n#\n# Licensed unde...
python
chosen
[ { "from": "human", "value": "Add missing OldTestPlugin for PluginRegistry test\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\ndef getMetaData():\n return { \"name\": \"OldTestPlugin\" }\n\ndef register(ap...
python
chosen
[ { "from": "human", "value": "Add a brew house yield calculator\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom .sugar import sg_to_gu\n\n__all__ = [\n u'calculate_brew_house_yield',\n]\n\n\ndef calculate_brew_house_yield(wort_volume, sg, grain_additions):\n\n gravity_units...
python
chosen
[ { "from": "human", "value": "Add functions for reading MNIST dataset int numpy arrays.\n" }, { "from": "gpt", "value": "# this file defines function for parsing the MNIST dataset as available to\n# download here:\n# http://yann.lecun.com/exdb/mnist/index.html\n# The extracted files are expected ...
python
chosen
[ { "from": "human", "value": "Add pdf render file to VCS\n" }, { "from": "gpt", "value": "from io import BytesIO\nfrom django.http import HttpResponse\nfrom django.template.loader import get_template\nimport xhtml2pdf.pisa as pisa\n\n\nclass Render:\n\n @staticmethod\n def render(path: str,...
python
chosen
[ { "from": "human", "value": "Solve Code Fights primary school problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Primary School Problem\n\n\nclass Rectangle(object):\n def __init__(self, height, width):\n self.height = height\n self.width = width\n\n...
python
chosen
[ { "from": "human", "value": "Add a warning things have been moved back.\n" }, { "from": "gpt", "value": "raise DeprecationWarning(\"\"\"DEPRECATED:\n\nAfter Popular request and decision from the BDFL:\n`IPython.terminal.ptshell` has been moved back to `IPython.terminal.interactiveshell`\nduring ...
python
chosen
[ { "from": "human", "value": "Add tempest config for swift compact environment\n" }, { "from": "gpt", "value": "import unittest\nfrom devops.helpers import ssh\nfrom fuel_test.helpers import safety_revert_nodes, tempest_write_config, make_tempest_objects, tempest_build_config_essex\nfrom fuel_tes...
python
chosen
[ { "from": "human", "value": "Add an example simulation setup for an ultracold neutral plasma.\n" }, { "from": "gpt", "value": "import ucilib.Sim as Sim\nimport ucilib.BorisUpdater as BorisUpdater\nimport numpy as np\n\n\n# Some helpful constants.\nfund_charge = 1.602176565e-19\n\n\n# Mass of Be^...
python
chosen
[ { "from": "human", "value": "Add management command for listing opt outs.\n" }, { "from": "gpt", "value": "from optparse import make_option\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.contrib.auth.models import User\n\nfrom go.base.utils import vumi_api_for_...
python
chosen
[ { "from": "human", "value": "[python] Add example: submit survey result.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\nsys.path += ['..']\n\ntry:\n import json\nexcept ImportError:\n import simplejson as json\n\nfrom epidb.client import EpiDBClient\n\napi_key = 'you...
python
chosen
[ { "from": "human", "value": "Add migration to add correct provider_name\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Migration to add the correct provider_name for Zotero and Mendeley ExternalAccounts that\nare missing it.\n\"\"\"\nimport sys\nimport logging\nfrom scripts impo...
python
chosen
[ { "from": "human", "value": "Add CLI entry point for cluster management.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\nimport sys\n\nimport ipcluster_tools\nimport purge_cluster\n\n\nclass ArgumentParser(argparse.ArgumentParser):\n def error(self, message):\n ...
python
chosen
[ { "from": "human", "value": "Add script for doing MI pivots the original blitzer way.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\nfrom sklearn.datasets import load_svmlight_file\nfrom sklearn.feature_selection import mutual_info_classif as mi\nimport numpy as np\nimport...
python
chosen
[ { "from": "human", "value": "Fix missing quoting module for schema.\n" }, { "from": "gpt", "value": "##\n# Copyright (c) 2016 MagicStack Inc.\n# All rights reserved.\n#\n# See LICENSE for details.\n##\n\n\nimport re\n\nfrom .parser.grammar import keywords\n\n\n_re_ident = re.compile(r'(?:[^\\W\\...
python
chosen
[ { "from": "human", "value": "Add example usage of DNS Test Template\n" }, { "from": "gpt", "value": "from ooni.templates.dnst import DNSTest\n\nclass ExampleDNSTest(DNSTest):\n def test_a_lookup(self):\n def gotResult(result):\n # Result is an array containing all the A reco...
python
chosen
[ { "from": "human", "value": "Add utility to get categories and their IDs from NFLC sites\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport argparse\nimport json\nfrom urllib.request import urlopen\n\n\ndef get_data(domain):\n response = urlopen('http://{}/media/nflc-playlist-v...
python
chosen
[ { "from": "human", "value": "Add inbound pifacedigitalio module which uses twisted\n" }, { "from": "gpt", "value": "import argparse\nimport json\nfrom datetime import datetime\n\nimport pifacedigitalio as pfdio\nfrom twisted.internet import reactor\nfrom txzmq import ZmqEndpoint, ZmqFactory, Zmq...
python
chosen
[ { "from": "human", "value": "Add test for index view\n" }, { "from": "gpt", "value": "import pytest\n\n\n@pytest.mark.django_db\nclass TestIndexView(object):\n\n def test_index(self, client):\n response = client.get('/')\n assert response.template_name == ['keybar/web/index.html...
python
chosen
[ { "from": "human", "value": "Add test for parent grouping function.\n" }, { "from": "gpt", "value": "import unittest\n\n\nclass TestCoordsByParent(unittest.TestCase):\n\n def test_empty(self):\n from tilequeue.utils import CoordsByParent\n\n cbp = CoordsByParent(10)\n\n c...
python
chosen
[ { "from": "human", "value": "Add incomplete _pruning function for IteratedTverberg.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport numpy as np\n\nfrom .interfaces import CenterpointAlgo\n\n\nclass IteratedTverberg(CenterpointAlgo):\n\n def centerpoint(self, points):\n ...
python
chosen
[ { "from": "human", "value": "Add simple example for extracting comments via pyslang\n" }, { "from": "gpt", "value": "from pyslang import *\n\ntestfile = \"\"\"\n//! Module description\n//! ***this is code*** sample\n//! | Tables | Are | Cool |\n//! |----------|:------------:|------:|...
python
chosen
[ { "from": "human", "value": "Add missing migrations for changed image field\n\nCommit fda90cf modified the image field of Group, but neglected to inlude\nmigrations.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models,...
python
chosen
[ { "from": "human", "value": "Add a script to normalize user accounts\n\nPatch by: Sverre Rabbelier\n" }, { "from": "gpt", "value": "#!/usr/bin/python2.5\n#\n# Copyright 2008 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ...
python
chosen
[ { "from": "human", "value": "Test some of the digest building functions.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfrom collections import OrderedDict\n\nfrom exam import fixture\n\nfrom sentry.digests import Record\nfrom sentry.digests.notifications import (\n ...
python
chosen
[ { "from": "human", "value": "Add test data generator tool\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom getopt import getopt, GetoptError\nfrom random import randint\nimport os\n\nSUITE=\\\n\"\"\"*** Settings ***\nResource resource.txt\n\n*** Test Cases ***\n%TESTCASES%\n\n**...
python
chosen
[ { "from": "human", "value": "Create tool to count morph length from annotation file\n\nSmall bit a quick hack at the moment, should be tranformed to a real script maybe?\n" }, { "from": "gpt", "value": "from __future__ import division\nimport fileinput\n\n\ndef main():\n tot_morph_count = 0\n...
python
chosen
[ { "from": "human", "value": "Add a test to check properties of device paths assigned to formats.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nimport unittest\n\nimport blivet\n\nclass DeviceFormatTestCase(unit...
python
chosen
[ { "from": "human", "value": "Add initial (non-working) ApiRequest class.\n" }, { "from": "gpt", "value": "import enum\nimport requests\n\n_defaults = {\n 'page': 1,\n 'per_page': 20,\n}\n\n@enum.unique\nclass RequestType(Enum):\n GET = 1\n POST = 2\n PUT = 3\n DELETE = 4\n\ncla...
python
chosen
[ { "from": "human", "value": "Add an example test for the \":contains()\" selector\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass MyTestClass(BaseCase):\r\n\r\n def test_contains_selector(self):\r\n self.open(\"https://xkcd.com/2207/\")\r\n se...
python
chosen
[ { "from": "human", "value": "Add some tests for session authentication\n" }, { "from": "gpt", "value": "\"\"\"\nTests for session-based authentication.\n\"\"\"\nfrom axiom import store\nfrom exponent.auth import errors, session, user\nfrom twisted.trial import unittest\nfrom txampext import comm...
python
chosen
[ { "from": "human", "value": "Set up cli executor for salt command lin\n" }, { "from": "gpt", "value": "'''\nThe management of salt command line utilities are stored in here\n'''\n# Import python libs\nimport optparse\nimport os\nimport sys\n\n# Import salt components\nimport salt.client\n\nclass...
python
chosen
[ { "from": "human", "value": "Add test cases for linalg\n\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2818 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "gpt", "value": "\"\"\" Test functions for linalg module\n\"\"\"\n\nfrom numpy.testing import *\nset_package_path()\nfrom num...
python
chosen
[ { "from": "human", "value": "Add rudimentary status check for memcached\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport os\nimport socket\nimport subprocess\nimport telnetlib\n\n\ndef can_connect(host, port):\n \"\"\"Check that we can make a connection to Memcached.\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Fix import error when compiling without OpenSSL support\n" }, { "from": "human", "value": "####################################################################\n#Dtool_funcToMethod(func, class) \n#del func\n####################################################...
python
chosen
[ { "from": "human", "value": "Add a short script for plotting successive trials.\n" }, { "from": "gpt", "value": "import climate\nimport lmj.plot\nimport source\n\n\ndef main(subject):\n subj = source.Subject(subject)\n ax = lmj.plot.axes(111, projection='3d', aspect='equal')\n for i, bl...
python
chosen
[ { "from": "system", "value": "Make Engine public importable name\n" }, { "from": "human", "value": "\"\"\"Optional support for sqlalchemy.sql dynamic query generation.\"\"\"\n\nfrom .engine import create_engine, dialect\nfrom .connection import SAConnection\nfrom .exc import (Error, ArgumentErro...
python
chosen
[ { "from": "human", "value": "Add a test which lets us see what's in our module.\n" }, { "from": "gpt", "value": "import pyQuantuccia\n\n\ndef test_not_a_real_test():\n _dir = str(pyQuantuccia.__dir__())\n _dict = str(pyQuantuccia.__dict__)\n s = \" \".join([_dict, _dir])\n print(s)\n...
python
chosen