conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add unit test for method list_aggregates\n\nThis patch adds unit test for aggregates_client.\nSpecific about method list_aggregates.\n\nChange-Id: If66b8f8688432e6bd28c7ab6a4d0551675ef5114\n" }, { "from": "gpt", "value": "# Copyright 2015 NEC Corporation. All rights...
python
chosen
[ { "from": "human", "value": "Add script for reading plists.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# This script reads system launch daemons and agents.\n#\n# Python 3.4 is required to read binary plists, or convert them first with,\n# find /System/Library/Launch* -type f -ex...
python
chosen
[ { "from": "human", "value": "Add a python unit test\n" }, { "from": "gpt", "value": "\"\"\"Tests for gcld3.\"\"\"\n\nimport gcld3\nimport unittest\n\n\nclass NnetLanguageIdentifierTest(unittest.TestCase):\n\n def testLangIdentification(self):\n detector = gcld3.NNetLanguageIdentifier(min_num...
python
chosen
[ { "from": "human", "value": "Add JSON converter for database objects\n" }, { "from": "gpt", "value": "# This file is part of Redmill.\n#\n# Redmill is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as published by\n# the Free S...
python
chosen
[ { "from": "human", "value": "Convert json with primary author to cypher script format\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport json\n\ncypher = \"seeds.cql\"\n\nfor file in os.listdir(os.getcwd()):\n if file.find(\"docentes-\") >= 0:\n with open(cypher, \"a\", enc...
python
chosen
[ { "from": "human", "value": "Add types for describing expression trees\n" }, { "from": "gpt", "value": "\"\"\"\nThe expression language is fully parsed out before passing it to a backend. This\nprevents the backend from having to keep excess context in order to understand\nthe expression. For ex...
python
chosen
[ { "from": "human", "value": "Add analysis and plotting of prediction errors\n" }, { "from": "gpt", "value": "import os\nimport pandas as pd\nimport seaborn as sns\nfrom matplotlib import pyplot as plt\nfrom motion_tracker.model.model import make_model\nfrom motion_tracker.utils.image_generator i...
python
chosen
[ { "from": "human", "value": "ENH: Add function that run any callback using broker data instead of strema.\n" }, { "from": "gpt", "value": "from dataportal import DataBroker as db\nfrom metadatastore.commands import find_event_descriptors, find_run_starts\n\n\ndef post_run(callback):\n \"\"\"\...
python
chosen
[ { "from": "human", "value": "Add script to check for deleted icon and banners\n" }, { "from": "gpt", "value": "import os\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\nfrom games.models import Game\n\n\nclass Command(BaseCommand):\n def handle(self, *a...
python
chosen
[ { "from": "human", "value": "Add script to request creating all material PDFs\n" }, { "from": "gpt", "value": "from django.db import connection\nfrom vpr_storage.views import requestMaterialPDF\nfrom vpr_content.models import Material\n\n\ndef getAllMaterialIDs():\n \"\"\" \"\"\"\n cursor ...
python
chosen
[ { "from": "human", "value": "Add fabric file for deployment\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport os\n\nfrom fabric.api import *\nfrom fabric.contrib.console import confirm\nfrom fabric.contrib.files import exists, upload_template\nfrom fabric.colors...
python
chosen
[ { "from": "human", "value": "Set up Code Fights is cool team problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Is Cool Team Problem\n\n\nclass Team(object):\n def __init__(self, names):\n self.names = names\n\n # TO DO\n\n\ndef isCoolTeam(team):\n re...
python
chosen
[ { "from": "human", "value": "Add a simple NB regression test to compare coefficients with R function glm.nb\n\n\nFormer-commit-id: 0ab35ca5ae619fc4f9c2233598f4d7563afdf214" }, { "from": "gpt", "value": "import numpy as np\nfrom autoencoder.io import read_text\nfrom autoencoder.network import mlp...
python
chosen
[ { "from": "human", "value": "Add code to show nonzero table\n" }, { "from": "gpt", "value": "# ----------------------------------------------------------------------\n# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement\n# with N...
python
chosen
[ { "from": "human", "value": "Migrate old passwords to be unusable\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.16 on 2018-10-11 17:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef forwards_func(apps, schema_editor):\...
python
chosen
[ { "from": "human", "value": "Add script to make database\n" }, { "from": "gpt", "value": "import boto.dynamodb\n\nconn = boto.dynamodb.connect_to_region('us-east-1')\n\ntable_schema = conn.create_schema(hash_key_name='MAC',hash_key_proto_value=str)\n\nconn.create_table(name='dev-ysniff',schema=t...
python
chosen
[ { "from": "human", "value": "[AIRFLOW-1842] Add gcs to gcs copy operator with renaming if required\n\nCopies an object from a Google Cloud Storage\nbucket to another Google\nCloud Storage bucket, with renaming if required.\n\nCloses #2808 from litdeviant/gcs_to_gcs\n" }, { "from": "gpt", "value"...
python
chosen
[ { "from": "human", "value": "Add script for printing google calendar events" }, { "from": "gpt", "value": "import pprint\nimport pytz\nfrom datetime import datetime, timedelta\nimport httplib2\n\nfrom apiclient.discovery import build\nfrom oauth2client.client import SignedJwtAssertionCredentials...
python
chosen
[ { "from": "human", "value": "feat: Add script to build a model by which to predict the values of a dependent variable from the values of one or more independent variables using machine learning techniques with the linear regression algorithm.\n" }, { "from": "gpt", "value": "'''\n\n'''\n\n# Impo...
python
chosen
[ { "from": "human", "value": "Add celery-oriented management command to update a thumbnail\n" }, { "from": "gpt", "value": "# This file is part of Miro Community.\n# Copyright (C) 2010 Participatory Culture Foundation\n# \n# Miro Community is free software: you can redistribute it and/or modify i...
python
chosen
[ { "from": "human", "value": "Add simple tests for print_tree.\n" }, { "from": "gpt", "value": "import unittest\nfrom contextlib import redirect_stdout\n\nfrom conllu import print_tree\nfrom conllu.tree_helpers import TreeNode\nfrom io import StringIO\n\n\nclass TestPrintTree(unittest.TestCase):\...
python
chosen
[ { "from": "human", "value": "TST: Verify that output of estimate_sigma is a proper input to nlmeans.\n" }, { "from": "gpt", "value": "import numpy as np\nimport numpy.testing as npt\nfrom dipy.denoise.noise_estimate import estimate_sigma\nfrom dipy.denoise.nlmeans import nlmeans\nimport dipy.dat...
python
chosen
[ { "from": "human", "value": "Add migration for job -> project rename\n" }, { "from": "gpt", "value": "\"\"\"\nRename \"job\" models to \"project\" models\n\"\"\"\nimport py.path\n\n\njobs_path = py.path.local().join('data', 'jobs')\nprojects_path = py.path.local().join('data', 'projects')\n\njob...
python
chosen
[ { "from": "human", "value": "Add test of spectral methods\n" }, { "from": "gpt", "value": "\"\"\"\nUnit tests for the spectral analysis module.\n\nThomas Ogden <t@ogden.eu>\n\n\"\"\"\n\nimport sys\nimport os\n\nimport unittest\n\nfrom maxwellbloch import mb_solve, spectral\n\n# Absolute path of ...
python
chosen
[ { "from": "human", "value": "Add module for data manipulation\n" }, { "from": "gpt", "value": "from keras.utils import np_utils\nimport numpy as np\n\n\ndef get_labels_number(batches):\n size = batches[0]['data'].shape[1]\n return size\n\n\ndef get_empty_batch(size):\n merged_batch = {'...
python
chosen
[ { "from": "human", "value": "Add PACKAGE_INFO to devil in Catapult\n\nThis CL adds the PACKAGE_INFO in pylib to devil in Catapult.\nSo adb_profile_chrome can use this in Catapult.\n\nBUG=catapult:#1937\n\nReview URL: https://codereview.chromium.org/1685803002\n" }, { "from": "gpt", "value": "# C...
python
chosen
[ { "from": "human", "value": "Add zbarlight recipe (also compatible with python2 and python3)\n" }, { "from": "gpt", "value": "from os.path import join\nfrom pythonforandroid.recipe import PythonRecipe\n\n\nclass ZBarLightRecipe(PythonRecipe):\n\n version = '2.1'\n\n url = 'https://github.c...
python
chosen
[ { "from": "human", "value": "Add py solution for 390. Elimination Game\n\n390. Elimination Game: https://leetcode.com/problems/elimination-game/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd or it's a left-to-right\n...
python
chosen
[ { "from": "human", "value": "Add API test for profile show\n\nAdd API test for profile show\n\nChange-Id: Ie782839c1f4703507f0bfa71817cd96fd7dfc2a4\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in complian...
python
chosen
[ { "from": "human", "value": "Demo: Print to terminal using colors." }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nprinter.py: Simple demo of how to print to console using colors.\n\"\"\"\n\n__author__ = \"Breno RdV\"\n__copyright__ = \"Breno RdV @...
python
chosen
[ { "from": "human", "value": "Add module with error code constants\n" }, { "from": "gpt", "value": "# See https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref\n\nINVALID_JSON = 'INVALID_JSON'\nBAD_REGISTRATION = 'BAD_REGISTRATION'\nDEVICE_UNREGISTERED = 'DEVICE_UNREGISTERED'\nBAD_ACK ...
python
chosen
[ { "from": "human", "value": "Add a default user when syncdb is called.\n" }, { "from": "gpt", "value": "\nfrom django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth import models as auth_app\nfrom django.db.models.signals import post_syncdb\n\n\ndef c...
python
chosen
[ { "from": "human", "value": "Add start of util function that will return current people\n" }, { "from": "gpt", "value": "\n\nfrom opencivicdata.models.people_orgs import Person\n\n\ndef get_current_people(position):\n\n if position == 'senator':\n return Person.objects.filter(membershi...
python
chosen
[ { "from": "human", "value": "Add example for nuclear gradients\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''\nScan molecule dissociation curve and the force on the curve.\n'''\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom pyscf import gto, dft\n\nbond = np.arange...
python
chosen
[ { "from": "human", "value": "[Discord] Add Tweepy cog and application command group\n\n" }, { "from": "gpt", "value": "\nfrom discord import app_commands\nfrom discord.ext import commands\n\n\nasync def setup(bot):\n await bot.add_cog(Tweepy())\n\n\nclass Tweepy(commands.Cog, app_commands.Gro...
python
chosen
[ { "from": "human", "value": "Add init Trax research models.\n\nPiperOrigin-RevId: 247220362\n" }, { "from": "gpt", "value": "# coding=utf-8\n# Copyright 2019 The Tensor2Tensor Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in ...
python
chosen
[ { "from": "human", "value": "Add a test for the reverse of request-never-answered.py\n\nWhen the race in test-group-race.py had the wrong result, it triggered a\nbug in the requestotronned roster code.\n" }, { "from": "gpt", "value": "\"\"\"\nExhibit a bug where RequestChannel times out when req...
python
chosen
[ { "from": "human", "value": "Add unittests for Github object creation scenarios.\n\nSimply run with `./agithub_test.py`.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport agithub\nimport unittest\n\nclass TestGithubObjectCreation(unittest.TestCase):\n def test_user_pw(self):\n ...
python
chosen
[ { "from": "human", "value": "Add a helper class to wait for event handlers to complete\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n###############################################################################\n# Copyright Kitware Inc.\n#\n# Licensed und...
python
chosen
[ { "from": "human", "value": "Add test on check user with filter users, business and verified\n" }, { "from": "gpt", "value": "import pytest\nimport responses\n\nfrom instabot.api.config import API_URL\n\nfrom .test_bot import TestBot\nfrom .test_variables import TEST_USERNAME_INFO_ITEM\n\n\nclas...
python
chosen
[ { "from": "human", "value": "Implement shell files searching by pattern\n\nChange-Id: I6bd6743a1b9f15fd704dfa38b1cce34b5948f0df\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os\n\nfrom fnmatch import fnmatch\n\n\ndef filename_match(filename, patterns, default=True):\n \"\"\...
python
chosen
[ { "from": "human", "value": "Add Python binary search implementation (recursive and iterative)\n" }, { "from": "gpt", "value": "from __future__ import division\n\n\ndef recursive_binary_search(sorted_sequence, key, start=0, end=None):\n '''Returns the index of `key` in the `sorted_sequence`, ...
python
chosen
[ { "from": "human", "value": "Add Python data types for sample data\n" }, { "from": "gpt", "value": "#!/usr/in/env python\n# -*- coding: utf-8 -*-\nimport numpy as np\n\n\n# TODO: generate following sizes with templates\nstate_size = 4\ninput_size = 2\noutput_size = 2\nsecond_order_size = 2\n\nna...
python
chosen
[ { "from": "human", "value": "Add defaults to last name of organizers\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-01-20 18:10\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mig...
python
chosen
[ { "from": "human", "value": "Add make theme manage script\n" }, { "from": "gpt", "value": "from django.apps import apps\nfrom django.core.management.base import BaseCommand\nimport os.path\nimport re\n\nfrom shutil import copyfile\n\n\nclass Command(BaseCommand):\n def get_folders(self):\n ...
python
chosen
[ { "from": "human", "value": "Add a test for AdminRegisteringAppConfig.\n" }, { "from": "gpt", "value": "from unittest import mock\n\nfrom django.test import TestCase\n\nimport groups # Needed for instantiating AppConfig classes.\nfrom groups import _apps_base\nfrom groups.admin import GroupAdmi...
python
chosen
[ { "from": "human", "value": "Add plugin for my server.\n" }, { "from": "gpt", "value": "import curio\n\nfrom curious.commands import command\nfrom curious.commands.context import Context\nfrom curious.commands.plugin import Plugin\nfrom curious.dataclasses import Member\n\n\ndef has_admin(ctx: C...
python
chosen
[ { "from": "human", "value": "Add Prim's algorithm for finding MST\n" }, { "from": "gpt", "value": "# Prim's algorithm is a greedy algorithm that\n# finds a minimum spanning tree\n# for a weighted undirected graph.\n#\n# Time complexity: O(m * n)\n\n# Input Format:\n# First line has two integers,...
python
chosen
[ { "from": "human", "value": "Add a \"producer consumer\" demo using QueueTask and PeriodicTask\n" }, { "from": "gpt", "value": "from sparts.tasks.periodic import PeriodicTask\nfrom sparts.tasks.queue import QueueTask\nfrom sparts.vservice import VService\nimport random\nimport threading\n\n\ncla...
python
chosen
[ { "from": "human", "value": "Add first version of openfda3\n" }, { "from": "gpt", "value": "import http.server\nimport json\nimport socketserver\n\nPORT = 8000\n\n# HTTPRequestHandler class\nclass testHTTPRequestHandler(http.server.BaseHTTPRequestHandler):\n # GET\n def do_GET(self):\n ...
python
chosen
[ { "from": "human", "value": "Solve Code Fights digits degree problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Digits Degree Problem\n\n\ndef digitsDegree(n):\n degree = 0\n if n < 10:\n return 0\n while n > 0:\n dig = n % 10\n n = n //...
python
chosen
[ { "from": "human", "value": "Add Graphviz magic methods module\n" }, { "from": "gpt", "value": "\"\"\"\nGraphviz IPython magic extensions\n\nMagic methods:\n %dot <dot graph>\n %%dot <dot ...\n ... graph>\n %dotstr \"<dot graph>\"\n %dotobj obj.to_dot()\n %dotobjs obj[0].to_dot...
python
chosen
[ { "from": "human", "value": "Add example test case in python\n" }, { "from": "gpt", "value": "import json\nimport logging\n\nlog = logging.getLogger(__name__)\nsh = logging.StreamHandler()\nlog.addHandler(sh)\n\n\ndef test_gear_add(as_admin):\n r = as_admin.post('/gears/test-case-gear', json=...
python
chosen
[ { "from": "human", "value": "Make sure MarkupItem is stored under it's proxy class type ID\n\nThis is needed for proper formset saving/retrieval,\nin combination with django-polymorphic 1.4-git\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\ni...
python
chosen
[ { "from": "human", "value": "Add short script to create a raw hdf5 file from a tiff stack\n" }, { "from": "gpt", "value": "import vigra\nimport argparse\n\ndef convert_to_volume(options):\n data = vigra.impex.readVolume(options.input_file)\n print(\"Saving h5 volume of shape {}\".format(da...
python
chosen
[ { "from": "human", "value": "Add script to update index\n" }, { "from": "gpt", "value": "# Rebuild asset indices\n# Usage: python3 rebuild-index.py in the project root\n\nimport io\nimport json\nimport pathlib\n\nindex = {}\n\ntry:\n stream = open(\"assets/index.json\")\n index = json.loads(st...
python
chosen
[ { "from": "system", "value": "Fix __all__ usage for sympy/series\n" }, { "from": "human", "value": "\"\"\"A module that handles series: find a limit, order the series etc.\n\"\"\"\nfrom order import Order\nfrom limits import limit, Limit\nfrom gruntz import gruntz\nfrom series import series\n\nO...
python
chosen
[ { "from": "human", "value": "Add default columns to the configuration table\n" }, { "from": "gpt", "value": "\"\"\" Add default columns to the configuration table\n\nRevision ID: f1393877871d\nRevises: 546b04c886f0\nCreate Date: 2018-12-09 16:15:42.317104\n\n\"\"\"\n\n# revision identifiers, use...
python
chosen
[ { "from": "human", "value": "Add migration for wiki and osffiles addons\n" }, { "from": "gpt", "value": "import logging\n\nfrom nose.tools import *\n\nfrom tests.base import OsfTestCase\nfrom tests.factories import NodeFactory\n\nfrom website.app import init_app\nfrom website.project.model impor...
python
chosen
[ { "from": "human", "value": "Connect to the management API\n" }, { "from": "gpt", "value": "from pyrabbit.api import Client\n\nfrom exceptions import InvalidUser\n\n\ndef connect_to_management_api(host, user, password):\n client = Client(host, user, password)\n if not client.has_admin_righ...
python
chosen
[ { "from": "human", "value": "Add initial python vector interface.\n" }, { "from": "gpt", "value": "\nINNER_PRODUCT = '*'\nADD = '+'\n\ndef tupleToVec(t):\n\tif type(t) is int: return str(t)\n\treturn '[%s]' % ' '.join(map(tupleToVec,t))\n\ndef vecToTuple(v):\n\treturn tuple(map(int, v.strip('[]'...
python
chosen
[ { "from": "human", "value": "Add a migration for updating the triggers\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom entity_history.sql.triggers import EntityActivationTrigger, EntityRelationshi...
python
chosen
[ { "from": "human", "value": "Complete linear regression using TF\n\nLinear regression using gradient descent\n" }, { "from": "gpt", "value": "# Implementing Gradient Descent using TensorFlow\n\nimport numpy as np\nimport tensorflow as tf\nfrom sklearn.datasets import fetch_california_housing\nfr...
python
chosen
[ { "from": "human", "value": "Add lists to an account in data schema\n" }, { "from": "gpt", "value": "\"\"\"Add account_id to list\n\nRevision ID: 56fbf79e705\nRevises: 4d93f81e7c0\nCreate Date: 2013-09-07 16:54:04.163852\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '56fbf79e...
python
chosen
[ { "from": "human", "value": "Add a simple HTML parser for testing.\n\nSigned-off-by: CyberZHG <9ba3659efa42549cffa53a0bc35ef0cabfb20593@gmail.com>\n" }, { "from": "gpt", "value": "\n\nclass SimpleHTMLParser(object):\n \"\"\"\n A simple HTML parser for testing.\n\n Not suitable for harsh...
python
chosen
[ { "from": "human", "value": "Add unit test for garbage collection\n" }, { "from": "gpt", "value": "# coding=utf-8\n#\n# fysom - pYthOn Finite State Machine - this is a port of Jake\n# Gordon's javascript-state-machine to python\n# https://github.com/jakesgordon/javascript-state-m...
python
chosen
[ { "from": "human", "value": "Write script to connect to postgres\n" }, { "from": "gpt", "value": "import os\nimport psycopg2\nimport urlparse\n\nurlparse.uses_netloc.append(\"postgres\")\nurl = urlparse.urlparse(os.environ[\"DATABASE_URL\"])\n\nconn = psycopg2.connect(\n database=url.path[1:]...
python
chosen
[ { "from": "human", "value": "Add missed migration for ddf77b1\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n depende...
python
chosen
[ { "from": "human", "value": "Add migration for adding subtitle and caption fields\n" }, { "from": "gpt", "value": "from django.db import models\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('zinnia', '0001_initial'),\n ]\n\n ...
python
chosen
[ { "from": "human", "value": "Add aggregate-if source with support to Sum" }, { "from": "gpt", "value": "# coding: utf-8\n'''\nImplements conditional aggregates.\n\nThis code was based on the work of others found on the internet:\n\n1. http://web.archive.org/web/20101115170804/http://www.voteruni...
python
chosen
[ { "from": "human", "value": "Add script to make RDF Eidos ontology\n" }, { "from": "gpt", "value": "import yaml\nimport requests\nfrom os.path import join, dirname, abspath\nfrom rdflib import Graph, Namespace, Literal\n\neidos_ont_url = 'https://raw.githubusercontent.com/clulab/eidos/master/' +...
python
chosen
[ { "from": "human", "value": "Add a testcase for PyPI\n" }, { "from": "gpt", "value": "from tests.helper import ExternalVersionTestCase\n\n\nclass PyPITest(ExternalVersionTestCase):\n def test_pypi(self):\n self.assertEqual(self.sync_get_version(\"example\", {\"pypi\": None}), \"0.1.0\"...
python
chosen
[ { "from": "human", "value": "Add tests for util submodule\n" }, { "from": "gpt", "value": "\"\"\"Tests for util submodule.\"\"\"\n\n\nfrom pathlib import Path\n\nimport requests\nimport xdg\n\nfrom mccurse import util\n\n\ndef test_cache_use_default():\n \"\"\"Use cache dir when no dir specif...
python
chosen
[ { "from": "human", "value": "Add ports column to certificate_associations - alembic migration only\n" }, { "from": "gpt", "value": "\"\"\"Add 'ports' column to certificate_associations table\n\nRevision ID: 4fe230f7a26e\nRevises: c301c59688d2\nCreate Date: 2021-05-07 10:57:16.964743\n\n\"\"\"\n\...
python
chosen
[ { "from": "human", "value": "Add mode2 raw code parser script.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- encoding:utf8 -*-\n\nfrom __future__ import print_function\nimport argparse\n\n\nclass Parser(object):\n\n @classmethod\n def parse(cls, target_file):\n print...
python
chosen
[ { "from": "human", "value": "Add a script to determine package dependencies.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"depends.py - print package dependencies\n\nUsage: python depends.py [-h | --help]\n\"\"\"\n\n\nfrom __future__ import print_function\n\nimport os\nimport s...
python
chosen
[ { "from": "human", "value": "Add script to plot histogram of peak distances\n\nUseful to see if any bistability occurs.\n" }, { "from": "gpt", "value": "\"\"\"\nAnalyse the distribution of peak distances to make appear the bistability.\n\nTo be used for two glomeruli simulations.\n\n\"\"\"\n\n\n...
python
chosen
[ { "from": "human", "value": "Add mandatory attributes to support PyTables HDF5 file format.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n#\n# Fix HDF5 files and add mandatory attributes for support PyTables file format \n#\n\nimport h5py\nimport sys\n\n# open HDF5 file\nhdf5_filenam...
python
chosen
[ { "from": "human", "value": "tests/cpydiff: Add difference-test for second arg of builtin next().\n" }, { "from": "gpt", "value": "\"\"\"\ncategories: Modules,builtins\ndescription: Second argument to next() is not implemented\ncause: MicroPython is optimised for code space.\nworkaround: Instead...
python
chosen
[ { "from": "human", "value": "Add basic test case for the age check view.\n\nOnly check if the page can actually be rendered, need more info on how to deal with cookies and user authentication inside tests to expand this.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.5\n#\n# Copyright 2...
python
chosen
[ { "from": "human", "value": "Add experiment getting pixel values from gtk DrawingArea\n" }, { "from": "gpt", "value": "__author__ = 'Joel Wright'\n\nimport pygtk\npygtk.require('2.0')\nimport gtk\nimport math\nimport cairo\nimport struct\n\nclass DrawingAreaExample(gtk.Window):\n def __init__...
python
chosen
[ { "from": "human", "value": "Add an example tour for DriverJS\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\n\n\nclass MyTestClass(BaseCase):\n\n def test_basic(self):\n self.open(\"https://www.google.com/maps/@42.3598616,-71.0912631,15z\")\n self.wait_for_e...
python
chosen
[ { "from": "human", "value": "ENH: Add William Playfair Wheat and Wages example\n" }, { "from": "gpt", "value": "\"\"\"\nWheat and Wages\n---------------\nA recreation of William Playfair's classic chart visualizing\nthe price of wheat, the wages of a mechanic, and the reigning British monarch.\n...
python
chosen
[ { "from": "human", "value": "Add custom exceptions for TextBoxDrawer\n\nThis is a skeleton for now, with docstrings etc. to follow\n" }, { "from": "gpt", "value": "class TextBoxDrawerError(Exception):\n pass\n\nclass MissingSVGFile(TextBoxDrawerError):\n pass\n\nclass TextBoxNotFoundInSVG(...
python
chosen
[ { "from": "human", "value": "Add script to generate tags, taken from vimwiki/utils\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\n\nimport sys\nimport re\n\nif len(sys.argv) < 3:\n exit()\n\nsyntax = sys.argv[1]\nfile...
python
chosen
[ { "from": "human", "value": "Revert \"Revert \"Added the number assignment test for numeric.\"\"\n\nThis reverts commit acbd86165ea6c5cd566928292c095ae570aa00ce.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, print_function\n\nfrom random import randrange\n\nfrom myhdl ...
python
chosen
[ { "from": "human", "value": "Add a test for sorting sigma-algebras.\n" }, { "from": "gpt", "value": "\nfrom nose.tools import *\n\nfrom dit.algorithms.lattice import sigma_algebra_sort\n\ndef test_sigalg_sort():\n\tsigalg = frozenset([\n\t\tfrozenset([]),\n\t\tfrozenset([1]),\n\t\tfrozenset([2])...
python
chosen
[ { "from": "human", "value": "Add migrations to clean up org config\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.12 on 2018-04-27 12:04\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\...
python
chosen
[ { "from": "human", "value": "Add script to fetch builds from Jenkins\n\n- uses dataset library to store data in sqlite database,\n- supports fetching data from Jenkins via JSON API or from file.\n" }, { "from": "gpt", "value": "import json\nimport requests\nimport dataset\n\n\ndef fetch_builds_d...
python
chosen
[ { "from": "human", "value": "Debug extension plan is once again an interactive debugger.\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\n\"\"\"Interactive tracebacks for WebCore.\"\"\"\n\n\n\nclass DebuggingExtension(object):\n\tprovides = ['debug']\n\tlast = True\n\t\n\tdef __init__(self)...
python
chosen
[ { "from": "human", "value": "Add example which demonstrates issue (works in this branch, fails otherwise).\n" }, { "from": "gpt", "value": "\"\"\"\nScatter plot with panning and zooming\n\nShows a scatter plot of a set of random points,\nwith basic Chaco panning and zooming.\n\nInteracting with ...
python
chosen
[ { "from": "human", "value": "Add student author names script\n" }, { "from": "gpt", "value": "# Run this script with `python ghnames.py` until it is correct then\n# run `python ghnames.py >> _config.yml` to add it its output to the\n# end of our _config.yml. All students will be added as site a...
python
chosen
[ { "from": "human", "value": "Tests: Add first test for 'preferred_masters'\n\nThis commit adds a first test for 'preferred_masters', by copying the\nexisting 'system_tests_preferred' test, and changing it slightly to use\n'preferredMasters' instead of 'forceMaster' with 'preferred=True'.\n\nSee: 98d74321f5d...
python
chosen
[ { "from": "human", "value": "OWBoxPlot: Fix crash with missing values\n" }, { "from": "gpt", "value": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom unittest import skip\n\nimport numpy as np\nfrom Orange.data import Table, ContinuousVa...
python
chosen
[ { "from": "human", "value": "Add test for method plugin\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Simon Jagoe\n# All rights reserved.\n#\n# This software may be modified and distributed under the terms\n# of the 3-clause BSD license. See the LICENSE.txt file...
python
chosen
[ { "from": "human", "value": "Add migrations file for adding andausian instruments\n" }, { "from": "gpt", "value": "# Generated by Django 2.1.7 on 2019-07-09 09:32\n\nfrom django.db import migrations, models\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n dependen...
python
chosen
[ { "from": "human", "value": "Test script for running curtailment\n" }, { "from": "gpt", "value": "\"\"\"\nThis \"test\" runs curtailment for different curtailment requirements and\nmethods `voltage-based` and `feedin-proportional`.\nIt requires a ding0 grid called ding0_grid_example.pkl in the s...
python
chosen
[ { "from": "human", "value": "Add missing legacy support file." }, { "from": "gpt", "value": "from .layers import Merge\n\n\ndef needs_legacy_support(model):\n return isinstance(model.layers[0], Merge)\n\n\ndef legacy_sequential_layers(model):\n layers = []\n if model.layers:\n if...
python
chosen
[ { "from": "human", "value": "Add unit test of SeriesConnect() and ParallelConnect()\n" }, { "from": "gpt", "value": "\"\"\"\nThis unit test tests the cells connected in series or parallel\n\n\n\"\"\"\nimport unittest\nimport numpy as np\nfrom pypvcell.solarcell import ResistorCell, SeriesConnect...
python
chosen
[ { "from": "human", "value": "Add migration for nullable messages\n" }, { "from": "gpt", "value": "\"\"\"Make message nullable\n\nRevision ID: b4e662a73272\nRevises: 1a73867b1e79\nCreate Date: 2019-04-30 09:04:34.330485\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision id...
python
chosen