conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add plugin for Nova hypervisor metrics\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom argparse import ArgumentParser\nimport socket\nimport time\n\nfrom novaclient.v3 import Client\n\nDEFAULT_SCHEME = '{}.nova.hypervisors'.format(socket.gethostname())\n...
python
chosen
[ { "from": "human", "value": "Add test for api-doc view\n" }, { "from": "gpt", "value": "\"\"\" Unit tests for the main web views \"\"\"\n\nfrom django.test import TestCase\nfrom django.urls import reverse\nfrom django.contrib.auth import get_user_model\n\nimport os\n\n\nclass ViewTests(TestCase)...
python
chosen
[ { "from": "human", "value": "Add a node for simple gpio control\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport rospy\nfrom std_msgs.msg import String\n\ndef motion_topic_callback(data):\n rospy.loginfo(rospy.get_caller_id() + \"Moving %s\", data.data)\n\ndef motion_topic_liste...
python
chosen
[ { "from": "human", "value": "Add missing publish_start and publish_end migration.\n" }, { "from": "gpt", "value": "# Generated by Django 2.1.3 on 2018-11-20 11:37\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('base', '00...
python
chosen
[ { "from": "human", "value": "Add search and replace script\n" }, { "from": "gpt", "value": "# Copyright (c) 2017 Ruben Dulek\n# The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.\n\nimport re #To perform the search and replace.\n\nfrom ..Script import Script\n\n## Per...
python
chosen
[ { "from": "human", "value": "bots: Add management command for making outgoing webhook bot.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\n\nfrom typing import Any\n\nfrom argparse import ArgumentParser\nfrom django.core.management....
python
chosen
[ { "from": "human", "value": "Add API test for profile update\n\nAdd API test for profile update\n\nChange-Id: I82a15c72409013c67a1f99fadeea45c52977588d\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in comp...
python
chosen
[ { "from": "human", "value": "Add unit tests for faker_schema module\n" }, { "from": "gpt", "value": "import unittest\n\nfrom faker_schema.faker_schema import FakerSchema\n\n\nclass MockFaker(object):\n\n def name(self):\n return 'John Doe'\n\n def address(self):\n return '457...
python
chosen
[ { "from": "human", "value": "Test for Shift/Reduce conflict in non-SLR grammar when SLR tables are used.\n" }, { "from": "gpt", "value": "import pytest\nfrom parglare import Grammar, Parser\nfrom parglare.exceptions import ShiftReduceConflict\n\n\ndef test_slr_conflict():\n \"\"\"\n Unambi...
python
chosen
[ { "from": "human", "value": "Add fa->gfa script for testing assembly stats\n" }, { "from": "gpt", "value": "import sys\n\nif __name__ == \"__main__\":\n\n id_ctr = 0\n print \"\\t\".join([\"H\", \"VZ:i:2.0\"])\n with open(sys.argv[1],\"r\") as ifi:\n for line in ifi:\n ...
python
chosen
[ { "from": "human", "value": "Add basic tests for rendering_markdown\n\n* wqflask/tests/unit/wqflask/test_markdown_routes.py: New tests.\n" }, { "from": "gpt", "value": "\"\"\"Test functions in markdown utils\"\"\"\n\nimport unittest\nfrom unittest import mock\n\nfrom wqflask.markdown_routes impo...
python
chosen
[ { "from": "human", "value": ":white_check_mark: Add tests for tutorial006 in First Steps, to test help from docstring\n" }, { "from": "gpt", "value": "import subprocess\n\nimport typer\nfrom typer.testing import CliRunner\n\nfrom first_steps import tutorial006 as mod\n\nrunner = CliRunner()\n\na...
python
chosen
[ { "from": "human", "value": "Add code to demonstrate quantization flow\n" }, { "from": "gpt", "value": "import numpy as np\n\ndef to_8(M_real, scale, offset):\n result = (M_real / scale - offset).round()\n result[result < 0] = 0\n result[result > 255] = 255\n return result.astype(np.uint8)\n...
python
chosen
[ { "from": "human", "value": "Add script to create more precise pathways from simulations\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport argparse\nimport glob\nimport itertools\nfrom AdaptivePELE.utilities import utilities\n\n\ndef parseArguments():\n desc = \"Write the informa...
python
chosen
[ { "from": "human", "value": "Remove name attribute from service [WAL-496]\n\nUse settings name instead of service name.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mi...
python
chosen
[ { "from": "human", "value": "Add a basic integration test for the update command\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport pathlib\n\n\ndef test_should_write_json(cli_runner, tmp_rc, tmp_templates_file):\n result = cli_runner([\n '-c', tmp_rc, 'update'\n ])\...
python
chosen
[ { "from": "human", "value": "Add tests for import statements\n" }, { "from": "gpt", "value": "from ...foo import bar as spam, baz\nimport time as ham, datetime\n\n\n\nfrom : keyword.control.flow.python, source.python\n .. : source.python\n. : source.python\nfoo ...
python
chosen
[ { "from": "human", "value": "Add a tool to decompose TTC files.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n# Copyright 2014 Google Inc. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ...
python
chosen
[ { "from": "human", "value": "Test that debug flag is off\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nTest that the debug flag is disabled, especially for releases.\n\"\"\"\n\nfrom __future__ import print_function, division, absolute_import\nimport unittest\nfrom numba2.co...
python
chosen
[ { "from": "human", "value": "Add a test case for load_config\n\nThis is just a basic test to make sure loading from file works.\n\nChange-Id: I074f36023ac4198c436fcee1668d32f9d1f0e61b\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may ...
python
chosen
[ { "from": "human", "value": "Add migration for creating special osf user\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-07-12 16:31\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom django.contrib.auth.management i...
python
chosen
[ { "from": "human", "value": "Add script to run benchmarks and submit to web service.\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 with this\n# file, You can obtain one at http:/...
python
chosen
[ { "from": "human", "value": "Add helper script to fix names in auth_user.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\" Fix names in auth_users.\n\n Usage: ./fix_names data/site/epcon.db\n\n Uses nameparser package to do the hard work of splitting names into\n first ...
python
chosen
[ { "from": "human", "value": "Add script to add user to the database\n" }, { "from": "gpt", "value": "import argparse\nimport pdb\n\nfrom flask import Flask\n\nfrom flask_sqlalchemy import SQLAlchemy\n\nfrom models import User\n\n\ndb = SQLAlchemy()\n\n\ndef main():\n\n parser = argparse.Argum...
python
chosen
[ { "from": "human", "value": "Add theme column to chat users (alembic revision).\n" }, { "from": "gpt", "value": "\"\"\"Add theme column to chat users.\n\nRevision ID: 40975dd21696\nRevises: 43912ab8304e\nCreate Date: 2015-09-22 21:53:34.160708\n\n\"\"\"\n\n# revision identifiers, used by Alembic...
python
chosen
[ { "from": "human", "value": "Add a basic selfcheck easily callable from the command line.\n" }, { "from": "gpt", "value": "\nimport argparse\nimport sys\n\nfrom . import eccodes\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument('--selfcheck', default=False, action...
python
chosen
[ { "from": "human", "value": "Implement a function that returns the sum of the longest run\n" }, { "from": "gpt", "value": "# Problem 4\n# 20.0 points possible (graded)\n# You are given the following definitions:\n\n# A run of monotonically increasing numbers means that a number at position k+1 i...
python
chosen
[ { "from": "human", "value": "Add test demonstrating set_attribute() and set_attributes()\n" }, { "from": "gpt", "value": "\"\"\" Testing the \"self.set_attribute()\" and \"self.set_attributes()\" methods\n to modify a Google search into becoming a Bing search.\n set_attribute() -> Modifies...
python
chosen
[ { "from": "human", "value": "Add examples for diff formatting\n" }, { "from": "gpt", "value": "from diffr import diff\n\n\na = [0] * 5 + ['-' * 5 + 'a' + '-' * 5] + [0] * 5\nb = [0] * 5 + ['-' * 5 + 'b' + '-' * 5] + [0] * 5\nd = diff(a, b)\nprint('Print out the diff in full by default')\nprint(d...
python
chosen
[ { "from": "human", "value": "Add example for dicts as Handler structure.\n" }, { "from": "gpt", "value": "import asyncio\nimport aiozmq\nimport aiozmq.rpc\n\n\n@aiozmq.rpc.method\ndef a():\n return 'a'\n\n\n@aiozmq.rpc.method\ndef b():\n return 'b'\n\n\nhandlers_dict = {'a': a,\n ...
python
chosen
[ { "from": "human", "value": "Fix where user_data and location_id don't match\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.users.models import CommCareUser\nfrom corehq.apps.es import UserES\nfrom corehq.apps.locations.models import Locati...
python
chosen
[ { "from": "human", "value": "Add migration for calibration_wait, confidence_threshold, records, iteration, Victim recordscardinality\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-07-29 14:49\nfrom __future__ import unicode_literals\n\nfrom django.d...
python
chosen
[ { "from": "human", "value": "Add Python version of the benchmark\n" }, { "from": "gpt", "value": "import sys\nsys.path.append(\"..\")\nfrom timeit import default_timer as clock\nfrom csympy import var\nvar(\"x y z w\")\ne = (x+y+z+w)**15\nf = e*(e+w)\nprint f\nt1 = clock()\ng = f.expand()\nt2 = ...
python
chosen
[ { "from": "human", "value": "Set up a package for modules\n" }, { "from": "gpt", "value": "from twisted.plugin import pluginPackagePaths\nimport os\n\n\n# From txircd:\n# https://github.com/ElementalAlchemist/txircd/blob/8832098149b7c5f9b0708efe5c836c8160b0c7e6/txircd/modules/__init__.py\n__path...
python
chosen
[ { "from": "human", "value": "Add tests for no-args default on base class.\n" }, { "from": "gpt", "value": "import pytest\nfrom flexmock import flexmock\n\nfrom .... import base\n\n\n@pytest.fixture\ndef model_with_no_args():\n flexmock(base.Model)\n base.Model.should_receive('_args2kwargs'...
python
chosen
[ { "from": "human", "value": "Add script to print components installed on executor\n\nIt reads them from the YAML file output from `cmt-config`.\n" }, { "from": "gpt", "value": "\"\"\"Prints the names of components installed on a WMT executor.\"\"\"\nimport os\nimport yaml\n\nwmt_executor = os.en...
python
chosen
[ { "from": "human", "value": "Add the basic flask app\n" }, { "from": "gpt", "value": "import praw\nfrom flask import Flask\nfrom flask import request, render_template\nfrom prawoauth2 import PrawOAuth2Mini\n\nfrom settings import (app_key, app_secret, access_token, refresh_token,\n ...
python
chosen
[ { "from": "human", "value": "Trim a fasta alingment based on coverage and final sequence length.\n" }, { "from": "gpt", "value": "\"\"\"\nTrim a fasta alignment file based on the columns with - and then remove sequences that don't have enough coverage.\nWe assume all the sequences are the same l...
python
chosen
[ { "from": "system", "value": "Add parameterized test for nids.\n" }, { "from": "human", "value": "import os.path\nfrom numpy.testing import TestCase\nfrom metpy.io.nexrad import Level2File, Level3File\n\ncurdir, f = os.path.split(__file__)\ndatadir = os.path.join(curdir, '../../../examples/testd...
python
chosen
[ { "from": "human", "value": "Add test case for urljoin\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom nose.tools import eq_\n\nfrom steve.restapi import urljoin\n\n\nclass UrlJoinTestCase(TestCase):\n def test_urljoin(self):\n for base, args, expected in [\n ...
python
chosen
[ { "from": "human", "value": "Add Django 1.7 migration for gist plugin\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 ('fluen...
python
chosen
[ { "from": "human", "value": "Add data loader script with a couple classes. Not finished yet...\n" }, { "from": "gpt", "value": "\"\"\"\nCreates a nice tidy pickle file of the data in the data/ directory.\n\"\"\"\n\nimport os\nimport csv\nfrom collections import defaultdict\n\nclass Position:\n ...
python
chosen
[ { "from": "human", "value": "Add script to compute LQR gains\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport numpy as np\nimport scipy\nimport control\nfrom dtk.bicycle import benchmark_state_space_vs_speed, benchmark_matrices\n\n\ndef compute_whipple_lqr_...
python
chosen
[ { "from": "human", "value": "Add missing migration from proposals application.\n\nSee e4b9588275dda17a70ba13fc3997b7dc20f66f57.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.12 on 2017-01-19 05:30\nfrom __future__ import unicode_literals\n\nfrom django.db im...
python
chosen
[ { "from": "human", "value": "Add 1 deg MOM grid.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport numpy as np\nimport netCDF4 as nc\n\nfrom base_grid import BaseGrid\n\nclass Mom1Grid(BaseGrid):\n\n def __init__(self, h_grid_def, v_grid...
python
chosen
[ { "from": "human", "value": "Create set of thing pv-slices across the disk\n" }, { "from": "gpt", "value": "\n'''\nCreate a set of thin PV slices\n'''\n\nfrom spectral_cube import SpectralCube, Projection\nfrom astropy.io import fits\nfrom astropy import units as u\nimport numpy as np\n\nfrom cu...
python
chosen
[ { "from": "human", "value": "Add simple midi input example script\n" }, { "from": "gpt", "value": "import pyb\n\nfrom mid.midiin import MidiIn\n\n\ndef midi_printer(msg):\n print(tuple(msg))\n\ndef loop(midiin):\n while True:\n midiin.poll()\n pyb.udelay(500)\n\nuart = py.UAR...
python
chosen
[ { "from": "human", "value": "Add super model class via upload" }, { "from": "gpt", "value": "\r\nclass CWModel(object):\r\n def __init__(self, json_dict=None):\r\n if json_dict is not None:\r\n self.__dict__.update(json_dict)\r\n\r\n def __repr__(self):\r\n string ...
python
chosen
[ { "from": "human", "value": "Add migration from django conrib comments update" }, { "from": "gpt", "value": "# Generated by Django 3.1.8 on 2021-05-05 15:20\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('comments', '0001...
python
chosen
[ { "from": "system", "value": "Update to work with the latest iteration\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\nimport argparse\nfrom argparse import RawDescriptionHelpFormatter\nimport sys\n\nfrom conda.cli import common\n\n\ndescripti...
python
chosen
[ { "from": "human", "value": "Test file for multiproc experiments.\n" }, { "from": "gpt", "value": "import cv2\nimport CameraReaderAsync\n\n# Initialize\ndebugMode = True\ncamera = cv2.VideoCapture(0)\ncamera.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 640)\ncamera.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 48...
python
chosen
[ { "from": "human", "value": "Load and test the iris data\n\ngit-svn-id: f502b99eb1c95a567c3db4e21cd7828f3e46dcfd@123 2a83181e-c148-0410-bf7c-9f1693d9d8f0\n" }, { "from": "gpt", "value": "'''\nCreated on Jan 14, 2010\n\n@author: bolme\n'''\n\nimport pyvision as pv\nimport numpy as np\nimport csv\...
python
chosen
[ { "from": "human", "value": "Add a module to test the memory usage with large libaries\n" }, { "from": "gpt", "value": "\"\"\"\nThis is a convenience script to test the speed and memory usage of Jedi with\nlarge libraries.\n\nEach library is preloaded by jedi, recording the time and memory consu...
python
chosen
[ { "from": "human", "value": "migrations: Set initial value for is_private flags.\n\nThis initializes the is_private flag to have the correct value for\nhistorical messages.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport sys\nfrom django.db import migrations\n\nfrom django.db im...
python
chosen
[ { "from": "human", "value": "Add python turtle to DXF converter.\n" }, { "from": "gpt", "value": "from turtle import Vec2D\n\nclass Turtle(object):\n def __init__(self):\n self.position = Vec2D(0, 0)\n self.direction = Vec2D(1, 0)\n self.isDrawing = True\n\n def penup(...
python
chosen
[ { "from": "human", "value": "Set up requests to get the body of text\n" }, { "from": "gpt", "value": "# http://www.pythonchallenge.com/pc/def/linkedlist.php\n\nimport requests, re\n\nnothing = 12345 # Initial nothing value\nurl = \"http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=%d...
python
chosen
[ { "from": "human", "value": "Add start of tests for CLI package\n" }, { "from": "gpt", "value": "import json\nimport os\n\nfrom click.testing import CliRunner\n\nfrom chalice import cli\n\n\ndef assert_chalice_app_structure_created(dirname):\n app_contents = os.listdir(os.path.join(os.getcwd(...
python
chosen
[ { "from": "human", "value": "Update PostgreSQL sequence names for zones/quotas.\n\nFixes LP Bug #993667.\nFixes LP Bug #993669.\n\nChange-Id: Ifcc33929ced617916bd6613fc941257494f4a99b\n" }, { "from": "gpt", "value": "# Copyright (c) 2012 Red Hat, Inc.\n# All Rights Reserved.\n#\n# Licensed un...
python
chosen
[ { "from": "human", "value": "Add step to delete old acl\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport logging\nfrom util import full_stack\nfrom workflow.steps.util.base import BaseStep\nfrom workflow.exceptions.error_codes import DBAAS_0020\nfrom dbaas_aclapi.tasks import des...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"[HOTFIX] Remove replaces line on 0001_squashed\"\"\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n re...
python
chosen
[ { "from": "human", "value": "Test added for Payload builder\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# FOGLAMP_BEGIN\n# See: http://foglamp.readthedocs.io/\n# FOGLAMP_END\nimport pytest\nimport json\nfrom foglamp.storage.payload_builder import PayloadBuilder\n\n__author__ = \"...
python
chosen
[ { "from": "human", "value": "[RM-11742] Add argparse tests for ceph-deploy config\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n" }, { "from": "gpt", "value": "import pytest\n\nfrom ceph_deploy.cli import get_parser\n\nSUBCMDS_WITH_ARGS = ['push', 'pull']...
python
chosen
[ { "from": "human", "value": "Add solution to lintcode question 85\n" }, { "from": "gpt", "value": "\"\"\"\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.right = None, None\n\"\"\"\nclass Solution:\n \"\"\"\n @param r...
python
chosen
[ { "from": "human", "value": "Add empty file stub for pointing math operations.\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 by the parties listed in the AUTHORS file.\n# All rights reserved. Use of this source code is governed by \n# a BSD-style license that can be found in the LICENSE...
python
chosen
[ { "from": "human", "value": "Add tests for basic --config-settings parsing\n" }, { "from": "gpt", "value": "import pytest\n\nfrom pip._internal.commands import create_command\n\n\n@pytest.mark.parametrize(\n (\"command\", \"expected\"),\n [\n (\"install\", True),\n (\"wheel\"...
python
chosen
[ { "from": "human", "value": "Add test of inverse transformation of chomsky form\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 28.08.2017 14:37\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import TestCase, main\nfrom gr...
python
chosen
[ { "from": "human", "value": "Add file for rule iteration tests\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Grammar, Nonter...
python
chosen
[ { "from": "human", "value": "Add test of IFrame element, creation and rendering\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\"\nFolium Element Module class IFrame\n----------------------\n\"\"\"\nimport branca.element as elem\nfrom selenium import webdriver\nimport base64\nde...
python
chosen
[ { "from": "human", "value": "Add script to ease manual testing and manipulation\n" }, { "from": "gpt", "value": "#!/usr/bin/python -i\nimport fore.action as action\nfrom echonest.remix.audio import LocalAudioFile\nprint(\"You can load MP3 files with LocalAudioFile()\")\nprint(\"and manipulate th...
python
chosen
[ { "from": "human", "value": "Add test for EdgeDriver and Edge (Chromium) Browser\n" }, { "from": "gpt", "value": "\"\"\"\nThis test is only for Microsoft Edge (Chromium)!\n\"\"\"\nfrom seleniumbase import BaseCase\n\n\nclass EdgeTestClass(BaseCase):\n\n def test_edge(self):\n if self.b...
python
chosen
[ { "from": "human", "value": "Add script to fetch PDG particle info and store in sqlite.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport urllib.request\nimport sqlite3\n\n\n### PDG file containing particle info\npdgurl = 'http://pdg.lbl.gov/2012/mcdata/mass_width_2012.mcd'\n\n# ...
python
chosen
[ { "from": "human", "value": "Add skipped migration in resale app connected with ordering.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2018-09-11 21:35\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(mig...
python
chosen
[ { "from": "human", "value": "Add unit tests for common rest.utils module\n\nAdd unit tests for common json conversions and exception handling.\n\nChange-Id: I71ab992bb09114f4fd9c9752820ab57b4c51577a\n" }, { "from": "gpt", "value": "# Copyright 2016 OpenStack Foundation\n#\n# Licensed under the A...
python
chosen
[ { "from": "human", "value": "Add initial unit tests for read-only functions\n" }, { "from": "gpt", "value": "import os\nimport unittest\n\nENV_KEY = 'DREAMHOST_API_KEY'\nPUBLIC_DREAMHOST_KEY = '6SHU5P2HLDAYECUM'\n\n# Set the public DreamHost API key before importing the client, since it will\n# ...
python
chosen
[ { "from": "human", "value": "Add missing migration to document app" }, { "from": "gpt", "value": "# Generated by Django 2.2.4 on 2020-01-17 20:01\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "human", "value": "Add migration to update related field name" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Add 8 test cases for linkedListCycle problem.\n" }, { "from": "gpt", "value": "import unittest\nfrom linkedListCycle import Solution, ListNode\n\nclass TestLinkedListCycle(unittest.TestCase):\n def setUp(self):\n self.solution = Solution()\n\n def testNo...
python
chosen
[ { "from": "human", "value": "Add a sample update command\n" }, { "from": "gpt", "value": "\"\"\"\n\"\"\"\n\nfrom paper_to_git.commands.base import BaseCommand\n\n\n__all__ = [\n 'UpdateCommand',\n ]\n\n\nclass UpdateCommand(BaseCommand):\n \"\"\"Pull the list of Paper docs and update th...
python
chosen
[ { "from": "human", "value": "Add a script to easily integrate a tool using toolshed\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom bioblend import galaxy\nfrom bioblend import toolshed\n\n\nif __name__ == '__main__':\n gi_url = \"http://172.21.23.6:808...
python
chosen
[ { "from": "human", "value": "Add a calculator example test\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass CalculatorTests(BaseCase):\r\n def test_6_times_7_plus_12_equals_54(self):\r\n self.open(\"seleniumbase.io/apps/calculator\")\r\n self.c...
python
chosen
[ { "from": "human", "value": "Add host embedding (embeds host by dictionary used in lower dimensions)\n" }, { "from": "gpt", "value": "import pandas as pd \nfrom sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.manifold import TSNE\n\n\nall_data = pd.read_csv('data/main_data_f...
python
chosen
[ { "from": "human", "value": "Implement simple REPL behaviour in Python.\n" }, { "from": "gpt", "value": "my_globals = globals().copy()\nmy_locals = locals().copy()\nwhile True:\n try:\n x = input('--> ')\n except:\n break\n try:\n print(eval(x, my_globals, my_locals))\n except:\n ...
python
chosen
[ { "from": "human", "value": "Make a test for where\n" }, { "from": "gpt", "value": "import unittest\n\nimport numpy\n\nimport chainer\nfrom chainer import cuda\nimport chainer.functions as F\nfrom chainer.testing import attr\n\n\nclass TestWhere(unittest.TestCase):\n\n shape = (3, 2, 4)\n\n ...
python
chosen
[ { "from": "human", "value": "Add an example showing how to list VMs on a host\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# Copyright 2010 Jonathan Kinred\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the Li...
python
chosen
[ { "from": "human", "value": "Add basic test for Mix2\n" }, { "from": "gpt", "value": "import numpy as np\n\nfrom tensorprob import Model, Parameter, Normal, Exponential, Mix2\n\n\ndef test_mix2_fit():\n with Model() as model:\n mu = Parameter()\n sigma = Parameter(lower=1)\n ...
python
chosen
[ { "from": "human", "value": "Add py solution for 381. Insert Delete GetRandom O(1) - Duplicates allowed\n\n381. Insert Delete GetRandom O(1) - Duplicates allowed: https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/\n\ngetRandom may not be O(1). I'm not sure..\n" }, { "from":...
python
chosen
[ { "from": "human", "value": "Print the number of bpm y elements in the machine\n" }, { "from": "gpt", "value": "import pytac.load_csv\nimport pytac.epics\n\ndef main():\n lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem())\n bpms = lattice.get_elements('BPM')\n bpms_n...
python
chosen
[ { "from": "human", "value": "Add converter to xyz value data frame\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# -*- coding: utf-8 -*-\n\n# Imports\nfrom skimage import io\n\nimport pandas as pd\n\nimport fastparquet as fp\n\nimport numpy as np\n\nimport os\n\nimport tempfile\n\nde...
python
chosen
[ { "from": "human", "value": "Add script to check for unsupported edge cases\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.reminders.models import (CaseReminderHandler,\n UI_COMPLEX, ON_DATETIME, REMINDER_TYPE_DEFAULT,\n RECIPIENT_SUR...
python
chosen
[ { "from": "human", "value": "Add data migration for storing feedback.reflection in updated format\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.13 on 2021-05-19 15:21\n\nfrom django.db import migrations\nimport json\n\ndef update_feedback_reflection(apps, schema_editor):\n Feedba...
python
chosen
[ { "from": "human", "value": "Add tests for treecache directly and test del_multi at the LruCache level too.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Copyright 2015, 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t...
python
chosen
[ { "from": "human", "value": "Add test script to build repo\n" }, { "from": "gpt", "value": "# This script should run without errors whenever we update the\n# kaggle/python container. It checks that all our most popular packages can\n# be loaded and used without errors.\n\nimport numpy as np\npri...
python
chosen
[ { "from": "system", "value": "Add dvb_subtitle to the bad codec list.\n" }, { "from": "human", "value": "valid_input_extensions = ['mkv', 'avi', 'ts', 'mov', 'vob', 'mpg', 'mts']\nvalid_output_extensions = ['mp4', 'm4v']\nvalid_audio_codecs = ['aac', 'ac3', 'dts', 'eac3']\nvalid_poster_extension...
python
chosen
[ { "from": "human", "value": "Add missing migration for 4503f10\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2016-02-03 02:56\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass...
python
chosen
[ { "from": "human", "value": "Add tests for TruthTable class static methods\n" }, { "from": "gpt", "value": "from ._helpers import TruthTableTestCase\nfrom ....tables import TruthTable\n\n\nclass TestStaticMethodsTruthTable(TruthTableTestCase):\n\n def test_generate_symbols_0(self):\n \...
python
chosen
[ { "from": "human", "value": "Call of Duty 4: Modern Warfare plugin\n" }, { "from": "gpt", "value": "import os\nfrom lib.base_plugin import BasePlugin\nfrom lib.paths import SteamGamesPath\n\n\nclass CoD4MWPlugin(BasePlugin):\n Name = \"Call of Duty 4: Modern Warfare\"\n support_os = [\"Win...
python
chosen
[ { "from": "human", "value": "Create pytest version of frmwrk_1 test" }, { "from": "gpt", "value": "import os\nimport pathlib\nimport subprocess\n\n\ndef setup_module():\n rm_paths = [\n '.*testsuite.sv',\n '.testrunner.gold',\n '.testrunner.gold.tmp',\n '.testrunne...
python
chosen
[ { "from": "human", "value": "Add test to make sure our server certificate check stays up to date.\n\nSigned-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# Copyright 2016 Mender Software AS\n#\n# Licensed under ...
python
chosen
[ { "from": "human", "value": "Add Internet Storm Center IP API expert.\n" }, { "from": "gpt", "value": "import idiokit\nfrom abusehelper.core import bot, events, utils\nfrom combiner import Expert\nimport socket\nimport json\n\nISC_IP_API_URL = \"http://isc.sans.edu/api/ip\"\n\ndef is_ipv4(ip):\n...
python
chosen
[ { "from": "human", "value": "Add py solution for 500. Keyboard Row\n\n500. Keyboard Row: https://leetcode.com/problems/keyboard-row/\n" }, { "from": "gpt", "value": "class Solution(object):\n def findWords(self, words):\n \"\"\"\n :type words: List[str]\n :rtype: List[str...
python
chosen