conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Move ElasticSearch import script from buyer-frontend into search-api\n\nThis script should have moved when the search-api was split off from the buyer-frontend app.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n'''Process G6 JSON files into elasticsearch\n\nThi...
python
chosen
[ { "from": "human", "value": "Add is_active column for the 3 reply_to tables\n\nAdded a new boolean column, `is_active` to these tables\n* service_email_reply_to\n* service_sms_senders\n* service_letter_contacts\n\nThis has a database default of True in order to backfill the data, but\nthis default will be r...
python
chosen
[ { "from": "human", "value": "Rework the patch to handle ApiErrorException in a generic way in AMMethodContext. Create a specific file for ApiErrorException so as to be able to import it from am3.py and am_method_context.py.\n" }, { "from": "gpt", "value": "#--------------------------------------...
python
chosen
[ { "from": "human", "value": "Test conversion (e.g. float()) works\n" }, { "from": "gpt", "value": "import util\nimport sys\n\nclass test_conversion:\n def init(self):\n yield \"a = M.arange(1);\"\n\n def test_float(self, cmd):\n cmd += \"res = float(a);\"\n return cmd\...
python
chosen
[ { "from": "human", "value": "Add API for searching all PubMed abstracts and downloading\nthe abstract text.\n" }, { "from": "gpt", "value": "import urllib, urllib2\nimport xml.etree.ElementTree as ET\n\npubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi'\npubmed_fetch = '...
python
chosen
[ { "from": "human", "value": "Make migration file for Timetables administratorship\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-09-13 22:03\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migratio...
python
chosen
[ { "from": "human", "value": "Add missing migration for some reason\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.16 on 2018-10-19 12:11\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport multiselectfield.db.fields\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Allow initial user creation in syncdb when a profile model is managed by migrations and doesn't yet exist.\n" }, { "from": "human", "value": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\n\nfrom mezzanine.utils.models import g...
python
chosen
[ { "from": "human", "value": "Add test case for preprocessor\n" }, { "from": "gpt", "value": "from prismriver import preprocessor\n\ntest_cases = [('Artist', 'Title', 'Artist', 'Title'),\n (' Artist', ' Title', 'Artist', 'Title'),\n ('Artist ', 'Title ', 'Artist', 'Tit...
python
chosen
[ { "from": "human", "value": "Add basic tests for Evaluation class\n" }, { "from": "gpt", "value": "import pytest\nfrom src.data.Evaluation import Evaluation\nfrom src.data.EvaluationResult import EvaluationResult\n\n\n@pytest.fixture\ndef example_evaluation():\n evaluation = Evaluation(\"expe...
python
chosen
[ { "from": "human", "value": "Add file to get some basic statistics from the prediction.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Script which can be used to compare the features obtained of two different influenza models\n\nUsage:\n get_model_statistics.py <model> [--co...
python
chosen
[ { "from": "human", "value": "Add timestamp via op-return example\n\nQuick-n-dirty\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n\n# Distributed under the MIT/X11 software license, see the accompanying\n# file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n\"\"\"Example ...
python
chosen
[ { "from": "human", "value": "Add linear randomized select algorithm\n\nUsing the partitioning priciple from quicksort, linear select\nfinds the i-th smallest element in an array. It operates by\npartitioning around a pivot, checking whether the pivot index\nmatches the desired order statistic, and either re...
python
chosen
[ { "from": "human", "value": "Add QuerySet manager, for implementing chainable filters.\n" }, { "from": "gpt", "value": "from django.db import models\n\nclass QuerySetManager(models.Manager):\n def __getattr__(self, name, *args):\n if name.startswith('_'):\n raise AttributeEr...
python
chosen
[ { "from": "human", "value": "Add script to update project closure in bioinfo_analysis db\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport yaml\nfrom genologics.lims import Lims\nfrom genologics.entities import Project\nfrom genologics.config import BAS...
python
chosen
[ { "from": "human", "value": "Add the new version 1 API root\n" }, { "from": "gpt", "value": "# Package\n\nfrom .... import models as m\n\nclass Root(object):\n \"\"\"Root\n\n The main root object for v1 API traversal\n \"\"\"\n\n __name__ = None\n __parent__ = None\n\n def __in...
python
chosen
[ { "from": "human", "value": "Add robotpy files for uploading\n" }, { "from": "gpt", "value": "import sys\n\nclass RollbackImporter:\n def __init__(self):\n \"Creates an instance and installs as the global importer\"\n self.previousModules = sys.modules.copy()\n\n def uninstal...
python
chosen
[ { "from": "human", "value": "Add STATS type to display server uptime\n" }, { "from": "gpt", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom txircd.utils import now\nfrom zope.interface import implements\n\nclass StatsUptime(ModuleDa...
python
chosen
[ { "from": "human", "value": "Add placeholder test file for QtX11Extras\n" }, { "from": "gpt", "value": "import sys\nimport pytest\n\nfrom qtpy import PYQT6, PYSIDE2, PYSIDE6\nfrom qtpy.tests.utils import using_conda\n\n# @pytest.mark.skipif(\n# PYQT6 or PYSIDE6, reason=\"Not availible on Qt6...
python
chosen
[ { "from": "human", "value": "Create the service stub for peer grading\nThis stub just has some doc and empty functions so we can discuss if the contract is reasonable, then potentially build on this frame.\n" }, { "from": "gpt", "value": "\n\ndef get_next_submission(student_id, location):\n \...
python
chosen
[ { "from": "human", "value": "Add py solution for 529. Minesweeper\n\n529. Minesweeper: https://leetcode.com/problems/minesweeper/\n" }, { "from": "gpt", "value": "class Solution(object):\n def updateBoard(self, board, click):\n \"\"\"\n :type board: List[List[str]]\n :typ...
python
chosen
[ { "from": "human", "value": "Add a test for checkboxes and radio buttons\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\n\n\nclass MyTestClass(BaseCase):\n\n def test_checkboxes_and_radio_buttons(self):\n self.open(\"https://www.w3schools.com/tags/tryit.asp\"\n ...
python
chosen
[ { "from": "human", "value": "Add task to chatbase call\n" }, { "from": "gpt", "value": "from __future__ import print_function, unicode_literals\n\nimport logging\n\nfrom celery.task import task\nfrom temba.orgs.models import Org\nfrom .models import Chatbase\n\n\nlogger = logging.getLogger(__nam...
python
chosen
[ { "from": "system", "value": "Use full import path for parent class\n\nSomething seems off with the build for some reason. I'm trying to fix it this way.\n" }, { "from": "human", "value": "# Copyright (c) 2017 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom...
python
chosen
[ { "from": "human", "value": "Add migration to remove the unique constraint.\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 (...
python
chosen
[ { "from": "human", "value": "Create simple test for simple removing of useless symbols\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 17.08.2017 14:39\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import TestCase, main\n...
python
chosen
[ { "from": "human", "value": "Test that debug symbols have the correct order as specified by the order file.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107844 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "gpt", "value": "\"\"\"\nTest that debug symbols have the correct orde...
python
chosen
[ { "from": "human", "value": "Create a geojson dedicated to the parcelle we are interested in\n" }, { "from": "gpt", "value": "import json\nimport sys\nimport numpy as np\nfrom shapely.geometry import shape, Point\n\nf = open(sys.argv[1], 'r')\njs = json.load(f)\nf.close()\n\ntags = {}\nf = open(...
python
chosen
[ { "from": "human", "value": "Add script to convert the sporozyte data to something ilastik and our pipeline can use\n" }, { "from": "gpt", "value": "import vigra\nimport argparse\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser(description='Take two tiff files, one for the s...
python
chosen
[ { "from": "human", "value": "Add a management command to generate the liblouis tables\n\nbased on the contents of the dictionary database\n" }, { "from": "gpt", "value": "from daisyproducer.dictionary.brailleTables import writeWhiteListTables, writeLocalTables, writeWordSplitTable\nfrom daisypro...
python
chosen
[ { "from": "human", "value": "Test case for two web servers with different channels.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom circuits.web import Controller\nfrom circuits.web import BaseServer\n\nfrom circuits.core.handlers import handler\nfrom circuits.core.components impo...
python
chosen
[ { "from": "human", "value": "Add parse_angle() example to calculations page.\n" }, { "from": "gpt", "value": "# Copyright (c) 2015-2018 MetPy Developers.\r\n# Distributed under the terms of the BSD 3-Clause License.\r\n# SPDX-License-Identifier: BSD-3-Clause\r\n\"\"\"\r\nParse angles\r\n========...
python
chosen
[ { "from": "human", "value": "Add test for Python numeric types as parameters\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nimport unittest\nfrom jnius import autoclass\n\n\nclass ArrayListTest(unittest.TestCase):\n\n def test_output(self):\n alist = autoclass...
python
chosen
[ { "from": "human", "value": "Add Terminal class based on Qt\n" }, { "from": "gpt", "value": "import sys\nfrom PyQt4 import QtGui, QtCore\nfrom PyQt4.QtCore import Qt\n\n\nclass Terminal(QtGui.QWidget):\n VSIZE = 25\n HSIZE = 80\n HEIGHT = 378\n WIDTH = 644\n \n def __init__(sel...
python
chosen
[ { "from": "human", "value": "Add utility module for working with the Node type\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 informati...
python
chosen
[ { "from": "human", "value": "Add Unit/Integration test for Crossbar authorizer\n" }, { "from": "gpt", "value": "from django.core.cache import cache\nfrom django.test import TestCase\nfrom utils.crossbar import YunityAuthorizer\nfrom utils.session import SharedSessionData\n\n\nclass TestCrossbarA...
python
chosen
[ { "from": "human", "value": "Add remaining custom indexes that were created by South migrations\n\n(imported from commit 9798afa8161af4ae6b3fa0c5f4894a3211b77cd4)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, mi...
python
chosen
[ { "from": "human", "value": "Add py solution for 661. Image Smoother\n\n661. Image Smoother: https://leetcode.com/problems/image-smoother/\n" }, { "from": "gpt", "value": "class Solution(object):\n def imageSmoother(self, M):\n \"\"\"\n :type M: List[List[int]]\n :rtype: ...
python
chosen
[ { "from": "human", "value": "Add test for infinite recursion\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport unittest\n\nimport properties\n\n\nclass...
python
chosen
[ { "from": "human", "value": "Add basic example for using the LXDContainerDriver\n" }, { "from": "gpt", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information r...
python
chosen
[ { "from": "human", "value": "Add a script to update the coverity branch" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Update the coverity branch from the master branch.\n# It is not done automatically because Coverity Scan limits\n# the number of submissions per day.\n\nfrom __future__...
python
chosen
[ { "from": "human", "value": "Add test of Entropy algorithm\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Copyright (C) 2006-2022 Music Technology Group - Universitat Pompeu Fabra\n#\n# This file is part of Essentia\n#\n# Essentia is free software: you can redistribute it and/or mo...
python
chosen
[ { "from": "human", "value": "Add notification's url test case\n" }, { "from": "gpt", "value": "from django.core.urlresolvers import resolve\nfrom unittest import TestCase\nfrom ..views import device_token_receive\n\n\nclass NotificationUrlsTestCase(TestCase):\n\n def test_url_resolves_to_devi...
python
chosen
[ { "from": "human", "value": "Add py solution for 690. Employee Importance\n\n690. Employee Importance: https://leetcode.com/problems/employee-importance/\n" }, { "from": "gpt", "value": "\"\"\"\n# Employee info\nclass Employee(object):\n def __init__(self, id, importance, subordinates):\n ...
python
chosen
[ { "from": "human", "value": "Add test for CLI parse\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Author: Dominik Gresch <greschd@gmx.ch>\n\nimport os\n\nimport pytest\nimport tempfile\nfrom click.testing import CliRunner\n\nimport tbmodels\nfrom tbmodels...
python
chosen
[ { "from": "human", "value": "Add script to change party memberships from ACN, ANPP and CPC to APC.\n\nThis is currently a very hard-coded script for Nigeria, but could be\nworked on and moved later to make something more general.\n" }, { "from": "gpt", "value": "\"\"\"Change party of everyone cu...
python
chosen
[ { "from": "human", "value": "Test of TTLL5 page passes.\n" }, { "from": "gpt", "value": "\nimport unittest\nimport runserver\n\nclass GenePageTestCase(unittest.TestCase):\n\n def setUp(self):\n runserver.app.config['TESTING'] = True\n self.app = runserver.app.test_client()\n\n ...
python
chosen
[ { "from": "human", "value": "Add script to change version\n" }, { "from": "gpt", "value": "\"\"\"Change version.\"\"\"\nimport fileinput\nimport sys\n\nVERSION = sys.argv[1]\n\nfor line in fileinput.input('../PKGBUILD', inplace=True):\n if 'pkgver=' in line:\n line = 'pkgver=%s' % VERS...
python
chosen
[ { "from": "human", "value": "Add example server that restarts on SIGHUP\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport asyncio\nimport signal\n\nimport logbook.more\n\nimport saltyrtc\n\n\ndef env(name, default=None):\n return os.environ.get(name, default)\n\n\ndef require_env...
python
chosen
[ { "from": "human", "value": "Add bmi-test command that uses pytest.\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\nimport os\nimport textwrap\nimport argparse\n\nimport pkg_resources\nimport pytest\n\n\ndef test(package, input_file=None, verbosity=None, bmi_version='1.1'):\n tests =...
python
chosen
[ { "from": "human", "value": "Add script to filter gtf on seqnames in genome fasta\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\nimport logging\nfrom itertools import groupby\nimport argparse\n\n# Create a logger\nlogging.basicConfig(format='%(name...
python
chosen
[ { "from": "human", "value": "Add motion sensor log script.\n" }, { "from": "gpt", "value": "import os\nimport time\nfrom datetime import datetime\nimport RPi.GPIO as GPIO\nfrom blink2 import Blink\n\n\npir_pin = 23\nlog = True\nlog_file = 'motion_log'\nspeed = 2\n\nwith open(log_file, 'w') as lo...
python
chosen
[ { "from": "human", "value": "Add two basic tests for `on_failure`.\n" }, { "from": "gpt", "value": "from expects import expect, be\nfrom doublex import Spy\nfrom doublex_expects import have_been_called\n\nfrom pysellus import integrations\nfrom pysellus.integrations import on_failure\n\n\nwith d...
python
chosen
[ { "from": "human", "value": "Add SurveyScenario adapted to SenegalTaxBenFitSystem\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom openfisca_senegal import CountryTaxBenefitSystem as SenegalTaxBenefitSystem\n\nfrom openfisca_survey_manager.scenarios import AbstractSurveyScenario\...
python
chosen
[ { "from": "human", "value": "Add simple tests of newaxis and broadcastable python binding\n" }, { "from": "gpt", "value": "import pytest\n\nimport xchainer\n\n\ndef test_newaxis():\n assert xchainer.newaxis is None\n\n\ndef test_broadcastable():\n assert xchainer.broadcastable is xchainer....
python
chosen
[ { "from": "human", "value": "Add migration to first version of BREACH models\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-02-27 11:55\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.del...
python
chosen
[ { "from": "human", "value": "Revert \"Revert \"the util to combine message\"\"\n\nThis reverts commit 91537f48ebd3af6e5d74f14be8bcf12b225f7c81.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n__author__ = 'stefanie & DJ'\n\n\n'''\n\n'''\n\nimport sys, os, re, shutil\n\ndef analyzeTopic...
python
chosen
[ { "from": "human", "value": "Create the User & UserProfile API resources (probably needs restrictions to avoid anyone getting all entries in the DB…)." }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n\nfrom django.contrib.auth import get_user_model\n\nfrom tastypie.resou...
python
chosen
[ { "from": "human", "value": "Add tests for metrics functions\n" }, { "from": "gpt", "value": "from husc import metrics\nimport numpy as np\nimport os\nimport pandas as pd\nfrom pymongo import MongoClient\nimport subprocess as sp\n\nabspath = os.path.dirname(__file__)\n\ndef string2tuple(string_t...
python
chosen
[ { "from": "human", "value": "Add test to ensure that a proper output is recieved by client when proper request is made\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport socket_server, pytest, socket\n\naddress= ('127.0.0.1', 50000)\ntester_client= socket.socket(\n socket.AF_INET,...
python
chosen
[ { "from": "human", "value": "Add script to sync dashboards\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\nimport sys\nimport logging\n\nimport elasticsearch\nimport elasticsearch.helpers\n\n\nES_NODES = 'uct2-es-door.mwt2.org'\nVERSION = '0.1'\nSOURCE_INDEX = '.kibana...
python
chosen
[ { "from": "human", "value": "Add solutions script for ModelOutput\n" }, { "from": "gpt", "value": "import numpy as np\n\n# Set up an NCSS query from thredds using siphon\nquery = ncss.query()\nquery.accept('netcdf4')\nquery.variables('Temperature_isobaric', 'Geopotential_height_isobaric')\nquery...
python
chosen
[ { "from": "human", "value": "Add script to monitor for containers sharing an IP\n" }, { "from": "gpt", "value": "import sys\nfrom collections import defaultdict\n\nfrom paasta_tools.utils import get_docker_client\n\n\ndef main():\n docker_client = get_docker_client()\n ip_to_containers = d...
python
chosen
[ { "from": "human", "value": "Add tests for new defaults.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom jarn.mkrelease.mkrelease import Defaults\n\nfrom jarn.mkrelease.testing import JailSetup\n\n\nclass DefaultsTests(JailSetup):\n\n def test_defaults_defaults(self):\n self.m...
python
chosen
[ { "from": "human", "value": "Add skeleton for SFS algorithm\n" }, { "from": "gpt", "value": "\"\"\" Created by Max Robinson 9/20/2017 \"\"\"\n\n\nclass SFS:\n pass\n\n\n\"\"\"\nPseudo code\n\nfunction SFS(Features, D_train, D_valid, Learn()): \n F_0 = <>\n basePerf = -inf\n do:\n ...
python
chosen
[ { "from": "human", "value": "Add a fake es forms orm\n" }, { "from": "gpt", "value": "from copy import deepcopy\nfrom dateutil import parser\nfrom corehq.pillows.xform import transform_xform_for_elasticsearch\nfrom corehq.apps.es.fake.es_query_fake import HQESQueryFake\n\n\nclass FormESFake(HQES...
python
chosen
[ { "from": "human", "value": "Add tests for largest and smallest beams\n" }, { "from": "gpt", "value": "import pytest\nimport numpy as np\nfrom astropy import units as u\nfrom astropy import convolution\nfrom astropy.wcs import WCS\nfrom astropy import wcs\n\nfrom .test_spectral_cube import cube_...
python
chosen
[ { "from": "human", "value": "Manage cache in an elegent way\n" }, { "from": "gpt", "value": "#!/usr/bin/python2\n# -*- coding: utf-8 -*-\n\nimport os\nimport cPickle\n\n\nclass CacheManager(object):\n \"\"\"Manage cache saving and loading for a project\"\"\"\n\n def __init__(self, home, ta...
python
chosen
[ { "from": "human", "value": "Create tests for result class\n" }, { "from": "gpt", "value": "import unittest\nfrom performance_testing.result import Result, File\nimport os\nimport shutil\n\n\nclass ResultTestCase(unittest.TestCase):\n def setUp(self):\n self.current_directory = os.path...
python
chosen
[ { "from": "human", "value": "Add tests for the DownloadXLSXTemplateView\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.urls import reverse\n\nfrom apps.core.factories import PIXELER_PASSWORD, PixelerFactory\n\n\nclass DownloadXLSXTemplateViewTestCase(TestCase):\n\...
python
chosen
[ { "from": "human", "value": "Add General and Government article categories\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom knowledgebase.models import ArticleCategory\n\n\nclass Command(BaseCommand):\n def handle(self, *args, **options):\n sel...
python
chosen
[ { "from": "human", "value": "Add HelloWorld.py to test correct setup\n\n" }, { "from": "gpt", "value": "import cv2\n\ncam = cv2.VideoCapture(0)\nrunning = True\n\nwhile running:\n running, frame = cam.read()\n if running:\n # draw rectangle\n cv2.rectangle(frame,(100, 100), (...
python
chosen
[ { "from": "human", "value": "Check in a simple script to create and save a model based on old-style data\n\nSince the analysis pipeline has already been defined, this was pretty easy.\nAnd it is even tested.\n\nTesting done: Ran it, there was a json file created.\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "human", "value": "Add util function to translate from cc license urls\n" }, { "from": "gpt", "value": "from services.mixins.constants import LICENSE_UNKNOWN, LICENSE_CC0, LICENSE_CC_BY, LICENSE_CC_BY_NC, \\\n LICENSE_CC_BY_NC_ND, LICENSE_CC_BY_NC_SA, LICENSE_CC_BY_ND, LICENSE_CC_BY...
python
chosen
[ { "from": "human", "value": "Add other base script that will run addon and other snapshot scripts\n" }, { "from": "gpt", "value": "import logging\nfrom datetime import datetime\n\nfrom keen.client import KeenClient\n\nfrom website.app import init_app\nfrom website.settings import KEEN as keen_se...
python
chosen
[ { "from": "human", "value": "Add tests for Toggle LiveSync command\n" }, { "from": "gpt", "value": "from unittest import TestCase\nfrom unittest.mock import MagicMock, patch\nfrom sys import modules\n\n\nclass TestLiveSync(TestCase):\n @patch('nativescript-plugin.toggle_livesync_command.Toggl...
python
chosen
[ { "from": "human", "value": "Include analysis script to test for broken serum_id / serum_strain matches\n" }, { "from": "gpt", "value": "# Open downloaded titer table and check matches between serum_strain and serum_id\n# There should only be a single serum_strain for each serum_id\n# There can ...
python
chosen
[ { "from": "human", "value": "Add fullstack tests of the resource providers\n\nChange-Id: Ie4f769de3060fdb279320637ba965d5b452e2a2d\nCloses-Bug: #1578889\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in com...
python
chosen
[ { "from": "human", "value": "Add file to visualize nfq network evolution.\n" }, { "from": "gpt", "value": "\"\"\"Functions for plotting results, etc.\n\n\"\"\"\n\nimport numpy as np\nfrom mpl_toolkits.mplot3d import axes3d\nimport matplotlib.pyplot as plt\nimport pylab as pl\nfrom scipy import r...
python
chosen
[ { "from": "human", "value": "MICROB-3: Add MicroBachelors program_type\nCo-authored-by: Lise <albemarle>\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.11 on 2018-07-26 18:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nSEA...
python
chosen
[ { "from": "human", "value": "Add CDTA (for Albany, NY)\n" }, { "from": "gpt", "value": "\"\"\"Fetch Capital District Transportation Authority (Albany, New York) feed.\"\"\"\nimport logging\n\nfrom FeedSource import FeedSource\n\nURL = 'http://www.cdta.org/schedules/google_transit.zip'\n\nLOG = l...
python
chosen
[ { "from": "human", "value": "Add a method for generating GetManagedObjects() data wrappers\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...
python
chosen
[ { "from": "human", "value": "feat: Implement Lemniscate of Bernoulli trajectory\n\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom math import sqrt, cos, pi, sin\n\nfrom .trajectory import Trajectory\n\n\nclass LemniscateTrajectory(object, Trajectory):\n def __init__(self, radius,...
python
chosen
[ { "from": "human", "value": "Set up Code Fights circle of numbers problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Circle of Numbers Problem\n\n\ndef circleOfNumbers(n, firstNumber):\n pass\n\n\ndef main():\n tests = [\n [\"crazy\", \"dsbaz\"],\n ...
python
chosen
[ { "from": "human", "value": "Create test class for encryption client\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\n\nimport os\nimport unittest\n\nfrom qingstor.sdk.client.encryption_client import EncryptionClient\n\nRIGHT_OUT_KWARGS = {\n \"content_type\": \"video...
python
chosen
[ { "from": "human", "value": "Test suite for lda functionals\n" }, { "from": "gpt", "value": "import unittest\nimport numpy as np\nfrom pyquante2.dft.functionals import xs,cvwn\nfrom pyquante2.dft.reference import data\n\nclass test_dft(unittest.TestCase):\n def test_xs(self):\n na = da...
python
chosen
[ { "from": "human", "value": "Add script to generate box proto files from proposal mat files.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os, sys\nimport pdb\nimport argparse\nimport scipy.io as sio\nimport h5py\nsys.path.insert(1, '.')\nfrom vdetlib.utils.protocol import pro...
python
chosen
[ { "from": "human", "value": "Add helper function to ensure an input value is a tohu generator\n" }, { "from": "gpt", "value": "from .base import TohuBaseGenerator\nfrom .primitive_generators import Constant\n\n__all__ = ['as_tohu_generator']\n\n\ndef as_tohu_generator(g):\n \"\"\"\n If g i...
python
chosen
[ { "from": "human", "value": "Add ListConverter to url parser\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom werkzeug.routing import BaseConverter\n\n\nclass ListConverter(BaseConverter):\n\n _subtypes = {\n 'int': int,\n 'str': str,\n 'u': unicode,\n ...
python
chosen
[ { "from": "human", "value": "Add tests placeholder for pg_bawler.gen_sql\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nclass TestGenSql:\n\n def test_gen_drop_statement(self):\n pass\n\n def test_create_statement(self):\n pass\n" } ]
python
chosen
[ { "from": "human", "value": "Add 2D wing foil reader\n" }, { "from": "gpt", "value": "\"\"\"\nThis module enables XLFR5 data to numpy.array.\n\"\"\"\n\nimport numpy as np\n# import matplotlib.pyplot as plt\n\n\ndef read_xflr5_data(wing_foil_name):\n reynolds_numbers = np.arange(0, 1.01, 0.1)\...
python
chosen
[ { "from": "human", "value": "Add migration 18 - create the image_locations table\n\nThis migration simply creates the new image_locations table. It does\nnot yet use the table for anything.\n\nRelated to bp multiple-image-locations\n\nChange-Id: I1536c9276bc807aac26849e37556b465e8b5c9eb\n" }, { "fro...
python
chosen
[ { "from": "human", "value": "Add a test which directly calls the c function.\n" }, { "from": "gpt", "value": "import pytest\n\nfrom pyQuantuccia import quantuccia\n\n\ndef test_function_fails_correctly_on_bad_input():\n \"\"\"\n If we send in something which isn't three \n appropriate i...
python
chosen
[ { "from": "human", "value": "Add support for N0GSG csv and DMRX MostHeard.csv\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\nimport csv\n\n# dmrx.net uses SSL SNI, which urllib2 doesn't support\nimport requests\n\nfrom dmr_marc_users_cs750 import get_groups\n\nMOST_HEARD_URL = 'https:/...
python
chosen
[ { "from": "human", "value": "Add ASCII board for Quantum TicTacToe board\n\n- Add preliminary ASCII board for Quantum TicTacToe\n- Displays probability for blank (.) and X and O.\n" }, { "from": "gpt", "value": "# Copyright 2022 Google\n#\n# Licensed under the Apache License, Version 2.0 (the \"...
python
chosen
[ { "from": "human", "value": "Add script to update whatsnew file from PR snippets\n" }, { "from": "gpt", "value": "\"\"\"Update the What's New doc (development version)\n\nThis collects the snippets from whatsnew/pr/, moves their content into\nwhatsnew/development.rst (chronologically ordered), a...
python
chosen
[ { "from": "human", "value": "Add brute-force algorithm for discrete logarithm.\n" }, { "from": "gpt", "value": "def log(base, value, modulo):\n for power in range(0, modulo + 1):\n if value == base ** power % modulo:\n return power\n\n raise ValueError('log{}({}) does not...
python
chosen
[ { "from": "human", "value": "Add test that tabs through and clicks the active element\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass CycleTests(BaseCase):\r\n def test_cycle_elements_with_tab_and_press_enter(self):\r\n \"\"\" Test pressing the tab k...
python
chosen
[ { "from": "human", "value": "Test SVD of sparse matrix " }, { "from": "gpt", "value": "\n#Test if we can easily get the SVD of a set of matrices with low rank but under \n#a fixed structure \n\nimport numpy \nimport scipy.sparse \nfrom exp.util.SparseUtils import SparseUtils \n\nnumpy.set_printo...
python
chosen
[ { "from": "human", "value": "Add a simple demo code to use the ADS1015 driver\n" }, { "from": "gpt", "value": "#Demo code for the Adafruit ADS1015 board using the Raspberry Pi\n#The driver can also be used with the Ready pin using a GPIO to\n#be used in an interrupt mode.\n\nimport Rpi.spi as SP...
python
chosen