conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add an auto join script\n" }, { "from": "gpt", "value": "__module_name__ = \"autojoin on invite\"\n__module_version__ = \"1.0\"\n\nimport hexchat\n\n\ndef join(word, word_eol, userdata):\n\thexchat.command('join ' + word[0])\n\n\nhexchat.hook_print('Invited', join)\n...
python
chosen
[ { "from": "human", "value": "Add migration script to fix templated orphans.\n\nRestore parents to orphaned nodes created during templating.\nSee scripts/fix_templated_orphans.py for details.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Find orphaned templated nodes without p...
python
chosen
[ { "from": "human", "value": "Add a hybridization example using Slate manually\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\n\nqflag = False\ndegree = 1\n\nmesh = UnitSquareMesh(8, 8, quadrilateral=qflag)\nn = FacetNo...
python
chosen
[ { "from": "human", "value": "Add recognize decoding typedef or local type\n" }, { "from": "gpt", "value": "from pida_types import IDA_TYPES\nfrom pida_tlocal_type import IdaTLocalType\n\n\ndef decode_step(ida_type):\n # TODO :\n pass\n\n\ndef decode_hybrid_type(ida_type):\n value = {'id...
python
chosen
[ { "from": "human", "value": "Create tests for custom exceptions and warnings\n" }, { "from": "gpt", "value": "import pytest\nimport warnings\n\nfrom .. import (PlasmaPyError,\n PhysicsError,\n RelativityError,\n AtomicError)\n\nfrom .. import (PlasmaP...
python
chosen
[ { "from": "human", "value": "Add check for 'not guilty beyond a reasonable doubt'\n\nCloses issue #242\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Not guilty beyond a reasonable doubt.\n\n---\nlayout: post\nsource: Garner's Modern American Usage\nsource_url: http://bi...
python
chosen
[ { "from": "human", "value": "Add missing migration for audit app.\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 ('audit', '...
python
chosen
[ { "from": "human", "value": "Add a couple of simple tests for LPD geometry\n" }, { "from": "gpt", "value": "from matplotlib.figure import Figure\nimport numpy as np\n\nfrom karabo_data.geometry2 import LPD_1MGeometry\n\ndef test_inspect():\n geom = LPD_1MGeometry.from_quad_positions([\n ...
python
chosen
[ { "from": "human", "value": "Add result classes for update/insert/delete ops\n" }, { "from": "gpt", "value": "try:\n from pymongo.results import InsertOneResult\n from pymongo.results import InsertManyResult\n from pymongo.results import UpdateResult\n from pymongo.results import Del...
python
chosen
[ { "from": "human", "value": "Add ip-restriction plugin to declare ip whitelists/blacklists\nand restrict api access\n" }, { "from": "gpt", "value": "import ipaddress\n\nfrom django.http import JsonResponse\n\nfrom ..models import Plugin\n\n\ndef get_client_ip(request):\n x_forwarded_for = req...
python
chosen
[ { "from": "human", "value": "Fix - add missed migrations\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-05-13 13:34\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Rename test module and add test for login page content\n" }, { "from": "gpt", "value": "import unittest\nfrom unittest import TestCase\nfrom user import User\nfrom bucketlist import BucketList\nfrom flask import url_for\n\nfrom app import app\n\n\nclass BucketListTes...
python
chosen
[ { "from": "human", "value": "Add conversions for MIDI to hertz and hertz to MIDI\n" }, { "from": "gpt", "value": "# midi-beeper-orchestra - program to create an orchestra from PC speakers\n# Copyright (C) 2015 The Underscores\n# This program is free software: you can redistribute it and/or modif...
python
chosen
[ { "from": "human", "value": "Add Graham's Scan in Python\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport Tkinter as tk\nfrom random import random\n\ndef make_a_right_turn(a, b, c):\n \"\"\"Going from a to b to c involves a right turn?\"\"\"\n\n u = (c[0] - b[0], c[1] - b[1...
python
chosen
[ { "from": "human", "value": "Add test for iteration loop bytecode generation\n" }, { "from": "gpt", "value": "from tests.compiler import compile_local, LST_ID, IMPLICIT_ITERATOR_ID, IMPLICIT_ITERATION_ID\nfrom thinglang.compiler.opcodes import OpcodePushLocal, OpcodeCallInternal, OpcodePopLocal,...
python
chosen
[ { "from": "human", "value": "Add some source cache tests.\n" }, { "from": "gpt", "value": "import pytest\n\nimport large_image\nfrom large_image.cache_util import cachesClear\n\nfrom .datastore import datastore\n\n\n@pytest.mark.singular\ndef testCacheSourceStyle():\n cachesClear()\n image...
python
chosen
[ { "from": "human", "value": "Test ConfigItem created in __init__ goes to parent\n" }, { "from": "gpt", "value": "# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT\n# All rights reserved. This work is under a BSD license, see LICENSE.TXT.\n\nfrom multiconf import mc_config, ConfigItem\nfrom...
python
chosen
[ { "from": "human", "value": "Test prototype for WOA from a netCDF file.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\"\"\"\n\nfrom datetime import datetime\n\nfrom WOA.woa import WOA\n\ndef test_import():\n # A shortcut\n from WOA import WOA\n...
python
chosen
[ { "from": "human", "value": "Implement tests for a new _config_file fixture\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\ndef test_config(testdir):\n \"\"\"Make sure that pytest accepts the `cookies` fixture.\"\"\"\n\n # create a temporary pytest test module\n testdir.ma...
python
chosen
[ { "from": "human", "value": "Add py solution for 605. Can Place Flowers\n\n605. Can Place Flowers: https://leetcode.com/problems/can-place-flowers/\n" }, { "from": "gpt", "value": "from itertools import groupby\nclass Solution(object):\n def canPlaceFlowers(self, flowerbed, n):\n \"\"\...
python
chosen
[ { "from": "human", "value": "Add new utility script to add sample feeds as files\n" }, { "from": "gpt", "value": "from smoke_signal import app, init_db\nfrom smoke_signal.database.helpers import add_feed\nfrom utils.generate_feed import SampleFeed\n\nfrom os import walk\n\nfeeds_dir = app.root_p...
python
chosen
[ { "from": "human", "value": "Add an example that uses the interators\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\ntry:\n import binaryninja\nexcept ImportError:\n sys.path.append(\"/Applications/Binary Ninja.app/Contents/Resources/python/\")\n import binaryninja...
python
chosen
[ { "from": "human", "value": "Add marker for 105 error\n" }, { "from": "gpt", "value": "\"\"\"Marks all fixed errors #105 on ruwiki's CheckWikipedia.\"\"\"\nimport re\nimport pywikibot\nfrom checkwiki import load_page_list, mark_error_done, log\n\nNUMBER = \"105\"\n\ndef main():\n \"\"\"Main s...
python
chosen
[ { "from": "human", "value": "Add test for nova-compute and nova-network main database blocks\n\nWe block the database objects when conductor is not local for compute\nand network, but we don't test this code anywhere because it's in the\nmain() function of the actual executable.\n\nFix that.\n\nChange-Id: I...
python
chosen
[ { "from": "human", "value": "Add a test for clickthrough\n" }, { "from": "gpt", "value": "import openliveq as olq\nimport os\n\nclass TestClickthrough(object):\n\n def test_load(self):\n filepath = os.path.join(os.path.dirname(__file__),\n \"fixtures\", \"sample_clickthrough...
python
chosen
[ { "from": "human", "value": "Add expectation that all Python code is correct\n" }, { "from": "gpt", "value": "from importlib import import_module, reload\nfrom os.path import join as join_path, dirname\nfrom os import walk\nfrom sys import modules\n\nfrom yunity.utils.tests.abc import BaseTestCa...
python
chosen
[ { "from": "human", "value": "Enh: Test - Trigger AttributeError with an get_name call in daemonlinks\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors\n#\n# This file is part of Align...
python
chosen
[ { "from": "human", "value": "Add simple tests for DAP validator wrappers.\n\nIncidentally, add the test file `distarray/tests/test_testing.py`." }, { "from": "gpt", "value": "# encoding: utf-8\n# ---------------------------------------------------------------------------\n# Copyright (C) 2008-2...
python
chosen
[ { "from": "human", "value": "Implement Naive Bayes Classifier builder method\n" }, { "from": "gpt", "value": "import numpy as np\nimport cv2\n\n# pos and neg are positive and negative instances\n# each is a list of files of nparray dumps,\n# nparray of BoW histograms; shape = (n, 101)\n# of the ...
python
chosen
[ { "from": "human", "value": "Add tests for sonify submodule\n" }, { "from": "gpt", "value": "\"\"\" Unit tests for sonification methods \"\"\"\n\nimport mir_eval\nimport numpy as np\n\n\ndef test_clicks():\n # Test output length for a variety of parameter settings\n for times in [np.array(...
python
chosen
[ { "from": "human", "value": "feat: Add scripts which Define a function to compute color histogram features\n" }, { "from": "gpt", "value": "# Code given by Udacity, complete by Andres Guijarro\n# Purpose: Define a function to compute color histogram features\n\nimport numpy as np\nimport matplot...
python
chosen
[ { "from": "human", "value": "Add fake limited composite example\n" }, { "from": "gpt", "value": "# -----------------------------------------------------------------------------\n# User configuration\n# -----------------------------------------------------------------------------\noutputDir = '/U...
python
chosen
[ { "from": "human", "value": "Add index to the `created_at` column in `published_award_financial_assistance` and the `updated_at` column in `detached_award_procurement`\n" }, { "from": "gpt", "value": "\"\"\"FABS created_at and FPDS updated_at indexes\n\nRevision ID: 7597deb348fb\nRevises: b168f0...
python
chosen
[ { "from": "human", "value": "Make a simple infinite while loop to run tests.\n" }, { "from": "gpt", "value": "import time\nimport subprocess\n\n\nif __name__ == \"__main__\":\n while True:\n subprocess.call([\n \"python\", \"setup.py\", \"test\", \"--test-path=tardis/tests/t...
python
chosen
[ { "from": "human", "value": "Test users app URL patterns\n\nFor the sake of completeness, and since regular expressions can be error-prone." }, { "from": "gpt", "value": "from django.core.urlresolvers import reverse, resolve\n\nfrom test_plus.test import TestCase\n\n\nclass TestUserURLs(TestCase...
python
chosen
[ { "from": "human", "value": "Add (simple) test cases for Stock API\n\n- Still a lot of work to do here\n" }, { "from": "gpt", "value": "from rest_framework.test import APITestCase\nfrom rest_framework import status\nfrom django.urls import reverse\nfrom django.contrib.auth import get_user_model\...
python
chosen
[ { "from": "human", "value": "Create dynamic image & draw some text on it" }, { "from": "gpt", "value": "import requests\nimport json\n\n# Dynamically create a 300x300 PNG image with a yellow background and draw some text on the center of it later.\n# Refer to https://pixlab.io/#/cmd?id=newimage ...
python
chosen
[ { "from": "human", "value": "Add script for cleaning up old SMS/MMS text messages\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n''' Deletes old messages from a backup file created by Titanium Backup Pro\n'''\n\nimport datetime\nimport lxml.etree\nimport shutil\nimport sys\n\nMAXIMUM...
python
chosen
[ { "from": "human", "value": "Add GDB pretty-printer for short_vector<T,N>\n" }, { "from": "gpt", "value": "import gdb\nimport re\n \nclass ShortVectorPrinter:\n def __init__(self, val):\n self.val = val\n\n def to_string(self):\n size = int(self.val['_size'])\n N = int...
python
chosen
[ { "from": "system", "value": "Support of old profile names\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n'''Generates the main page.'''\n\nimport re\n\nfrom google.appengine.ext import webapp\n\nimport vkfeed.util\n\n\nclass MainPage(webapp.RequestHandler):\n '''Generates the ...
python
chosen
[ { "from": "human", "value": "Add script to find out click annotations missing help text\n" }, { "from": "gpt", "value": "import ast\nimport argparse\nimport sys\n\n\ndef stringify_name(name: ast.AST):\n if isinstance(name, ast.Attribute):\n return f\"{stringify_name(name.value)}.{strin...
python
chosen
[ { "from": "human", "value": "Create attr-utils module; create attribute memoization helper\n" }, { "from": "gpt", "value": "def _set_attr( obj, attr_name, value_to_set ):\n setattr( obj, attr_name, value_to_set )\n return getattr( obj, attr_name )\n\ndef _memoize_attr( obj, attr_name, value_to...
python
chosen
[ { "from": "human", "value": "Add unit test of utils module.\n\nSigned-off-by: Kouhei Maeda <c9f1823971fa1a4c79cdb50b3311094021cee31e@palmtb.net>\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport unittest\nimport re\nimport sys\nimport os.path\nsys.path.insert(0, os.path.dirname(os...
python
chosen
[ { "from": "human", "value": "Add dependency function (not finished yet)\n" }, { "from": "gpt", "value": "import networkx as nx\n\n\nclass Dependency(object):\n def __init__(self, package_name):\n self.package_name = package_name\n\n self.dependency_graph = nx.DiGraph()\n ...
python
chosen
[ { "from": "human", "value": "Add tests for new complext date time field.\n" }, { "from": "gpt", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding ...
python
chosen
[ { "from": "human", "value": "Create a model-based form for whitelist requests\n" }, { "from": "gpt", "value": "from django.forms import ModelForm\nfrom whitelist.models import Player\n\n\nclass WhitelistForm(ModelForm):\n \"\"\" Automatically generate a form based on the Player model\n \"\...
python
chosen
[ { "from": "human", "value": "Add script for uploading bdists\n" }, { "from": "gpt", "value": "from __future__ import (division, print_function, absolute_import,\n unicode_literals)\n\nimport os\nimport glob\n\nfrom conda import config\n#from conda_build.metadata import Met...
python
chosen
[ { "from": "system", "value": "Add \"dbm\" to \"python-imports\" test\n" }, { "from": "human", "value": "import curses\nimport readline\n\nimport bz2\nassert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')\n\nimport platform\nif platform.python_implem...
python
chosen
[ { "from": "human", "value": "Test for ISO NC creator" }, { "from": "gpt", "value": "from posts.nc import *\r\nimport posts.iso\r\n\r\noutput('POST_TEST.txt')\r\n\r\nprogram_begin(123, 'Test program')\r\nabsolute()\r\nmetric()\r\nset_plane(0)\r\n\r\nfeedrate(420)\r\nrapid(100,120)\r\nrapid(z=50)\...
python
chosen
[ { "from": "human", "value": "Add common tests for query endpoint\n" }, { "from": "gpt", "value": "'''\r\n Biothings Query Component Common Tests\r\n'''\r\n\r\nimport os\r\n\r\nfrom nose.core import main\r\n\r\nfrom biothings.tests import BiothingsTestCase\r\n\r\n\r\nclass QueryTests(Biothings...
python
chosen
[ { "from": "human", "value": "Add unit tests for utility methods.\n" }, { "from": "gpt", "value": "from scripts.init import utils\nimport unittest\n\n\nclass TestUtils(unittest.TestCase):\n @classmethod\n def setUpClass(self):\n pass\n\n def test_get_parameter(self):\n api ...
python
chosen
[ { "from": "human", "value": "Add test suite for SettingFunction\n\nIt currently tests only the initialisation.\n\nContributes to issue CURA-1278.\n" }, { "from": "gpt", "value": "# Copyright (c) 2016 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nimport pytest\...
python
chosen
[ { "from": "human", "value": "Create a copy of the Netgen reader example and add some statistics calculation.\n\nThese additions calculate the elapsed time (the time that the reader has taken in order to read the mesh file), the number of vertices in the domain and the number of cells in the segmentation (if...
python
chosen
[ { "from": "human", "value": "Add demo case storage integration\n" }, { "from": "gpt", "value": "from edisgo.grid.components import Storage, Line\nfrom edisgo.grid.tools import select_cable\n\nimport logging\n\ndef integrate_storage(network, position, operation):\n \"\"\"\n Integrate storag...
python
chosen
[ { "from": "human", "value": "Add small demo for a monochrome GST pipeline\n" }, { "from": "gpt", "value": "import gst\nimport gobject\nimport os\n\nVIDEODEVICE = \"/dev/video1\"\nWIDTH = 1280\nHEIGHT = 960\nFRAMERATE = \"15/1\"\n\ntry:\n import psutil\nexcept ImportError:\n psutil = None\n...
python
chosen
[ { "from": "human", "value": "Add stub unit test for options resolving\n" }, { "from": "gpt", "value": "import unittest\n \nfrom protoplot.engine.item import Item\nfrom protoplot.engine.item_container import ItemContainer\n\nclass Series(Item):\n pass\n\nSeries.options.register(\"color\", True...
python
chosen
[ { "from": "human", "value": "Add a script to add mapit area IDs to new Place objects for 2013\n\nThis is variant of the existing core_match_places_to_mapit_areas\ncommand by Edmund von der Burg, but which is also aware of\nParliamentarySesssions and has some extra debugging output.\n" }, { "from": "...
python
chosen
[ { "from": "human", "value": "tests: Add test for semantics of for-loop that optimisation can break.\n" }, { "from": "gpt", "value": "# test assigning to iterator within the loop\nfor i in range(2):\n print(i)\n i = 2\n\n# test assigning to range parameter within the loop\n# (since we optim...
python
chosen
[ { "from": "human", "value": "Create a script to parse .mat and write .csv file\n" }, { "from": "gpt", "value": "\nimport csv\n\nimport numpy as np\nimport scipy.io as sio\n\ndef process_gridworld_data(input, imsize):\n # run training from input matlab data file, and save test data prediction in...
python
chosen
[ { "from": "human", "value": "[dbscan] Add python / sklearn comparison script\n" }, { "from": "gpt", "value": "'''\nGenerate dummy data, and compare output from scikit-learn's DBSCAN.\n\nExample code based on:\n http://scikit-learn.org/stable/auto_examples/cluster/plot_dbscan.html#sphx-glr-auto-...
python
chosen
[ { "from": "human", "value": "Add unit test for tuning estimations\n" }, { "from": "gpt", "value": "# coding: utf-8\n\"\"\"\nTest suite for PgTune.\n\"\"\"\n\nfrom unittest.mock import MagicMock, patch\nimport pytest\nimport smdba.postgresqlgate\n\n\nclass TestPgTune:\n \"\"\"\n Test PgTune...
python
chosen
[ { "from": "human", "value": "Add some basic tests for RRTM scheme.\n" }, { "from": "gpt", "value": "from __future__ import division\nimport numpy as np\nimport climlab\nimport pytest\nfrom climlab.radiation import RRTMG, RRTMG_LW, RRTMG_SW, CAM3Radiation_LW\n\ndef test_rrtm_creation():\n # in...
python
chosen
[ { "from": "human", "value": "Add example script for evaluating setiment\n" }, { "from": "gpt", "value": "# authenticates with twitter, searches for microsoft, evaluates overall\n# sentiment for microsoft\n\nimport numpy as np\nimport twitter\nfrom textblob import TextBlob\n\nf = open('me.auth')\...
python
chosen
[ { "from": "human", "value": "Test Case for adding groups\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom selenium.webdriver.firefox.webdriver import WebDriver\nfrom selenium.webdriver.common.action_chains import ActionChains\nimport time, unittest\n\ndef is_alert_present(wd):\n ...
python
chosen
[ { "from": "human", "value": "Add Django REST Framework authentication helpers for JWT\n" }, { "from": "gpt", "value": "from django.utils.translation import ugettext as _\nfrom django.contrib.auth import get_user_model\nfrom rest_framework_jwt.authentication import JSONWebTokenAuthentication\nfro...
python
chosen
[ { "from": "human", "value": "Add tool for building custom packages\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport sys, os, subprocess\n\nsys.argv.pop(0)\nlanguages = sys.argv\nlanguages.sort()\n\njs_path = os.path.dirname(__file__) + '/../js/'\n\njs_files_to_include = [js_path + ...
python
chosen
[ { "from": "human", "value": "Fix for django-tagging and automcomplete\n" }, { "from": "gpt", "value": "from dal_select2_tagging.widgets import TaggingSelect2\nfrom django import VERSION\nfrom tagging.utils import parse_tag_input\n\n\nclass IxxyTaggingSelect2(TaggingSelect2):\n\n # TaggingSele...
python
chosen
[ { "from": "human", "value": "Add three shutters and open/close functions\n" }, { "from": "gpt", "value": "from __future__ import print_function\nimport epics\nimport logging\n\nfrom ophyd.controls import EpicsSignal\nfrom ophyd.controls.signal import SignalGroup\n\n\nclass Shutter(SignalGroup):\...
python
chosen
[ { "from": "human", "value": "Add python script to read receiver file\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\nimport numpy\nfrom matplotlib import pyplot as plt\nimport matplotlib.colors as colors\nimport os\nimport sys\n\nimport seaborn\n\ndef ParseVariableBinaryHeader(header)...
python
chosen
[ { "from": "human", "value": "Add unittests for some methods of runner\n" }, { "from": "gpt", "value": "from twisted.trial import unittest\n\n\nfrom ooni.inputunit import InputUnit\nfrom ooni.nettest import NetTestCase\nfrom ooni.reporter import OReporter\n\nfrom ooni.runner import loadTestsAndOp...
python
chosen
[ { "from": "human", "value": "Add the app config for osf registrations\n" }, { "from": "gpt", "value": "from share.provider import ProviderAppConfig\nfrom .harvester import OSFRegistrationsHarvester\n\n\nclass AppConfig(ProviderAppConfig):\n name = 'providers.io.osf.registrations'\n version...
python
chosen
[ { "from": "human", "value": "Add tests for nbgrader update\n" }, { "from": "gpt", "value": "from os.path import join\n\nfrom .. import run_nbgrader\nfrom .base import BaseTestApp\n\n\nclass TestNbGraderUpdate(BaseTestApp):\n\n def test_help(self):\n \"\"\"Does the help display without ...
python
chosen
[ { "from": "human", "value": "Add simple integration test for memory profiler\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (c) Spyder Project Developers\n#\n# Licensed under the terms of the ...
python
chosen
[ { "from": "human", "value": "Add a file allowing you to try it manually\n" }, { "from": "gpt", "value": "import json\nfrom ranch import Address, InvalidAddressException\n\n\nfilename = input('Read data from: [data/export.json] ')\nif filename == '':\n filename = 'data/export.json'\n\nwith ope...
python
chosen
[ { "from": "human", "value": "Add test utility for creating users.\n" }, { "from": "gpt", "value": "\"\"\"Utilities for testing wafer.\"\"\"\n\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.models import Permission\n\n\ndef create_user(username, email=None, superuser=Fa...
python
chosen
[ { "from": "human", "value": "Add tests for exclude passing\n" }, { "from": "gpt", "value": "import pytest\nimport salt.modules.saltutil as saltutil\nimport salt.states.saltmod as saltmod\nfrom tests.support.mock import create_autospec, patch\n\n\n@pytest.fixture(autouse=True)\ndef setup_loader(r...
python
chosen
[ { "from": "human", "value": "Add unit test for TimedProc regression\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Import python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Testing libs\nfrom tests.support.unit import TestCase\n\...
python
chosen
[ { "from": "human", "value": "Add a new version of dump source that actually marches along the nodes\n\nThe content of the nodes need to better done. However, this example does show that we can access the elements of the source AST including annotations.\n" }, { "from": "gpt", "value": "# Import ...
python
chosen
[ { "from": "human", "value": "Add script to convert tests from RethinkDB core.\n" }, { "from": "gpt", "value": "import re\n\ntry:\n import yaml\nexcept:\n print('PyYAML not installed')\n\nfrom pathlib import Path\n\ndef mkdir(path):\n try:\n path.mkdir(parents=True)\n except Fi...
python
chosen
[ { "from": "human", "value": "Add test for early stopping trigger\n" }, { "from": "gpt", "value": "import unittest\n\nimport chainer\nimport numpy\n\nfrom chainer import testing\nfrom chainer import training\nfrom chainer.training import triggers\nfrom chainer.training import util\n\n\nclass Dumm...
python
chosen
[ { "from": "human", "value": "Test script for the bsddb C extension module.\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\"\"\"Test script for the bsddb C module\n Roger E. Masse\n\"\"\"\nimport bsddb\nimport tempfile\nfrom test_support import verbose\n\ndef test(openmethod, what):\...
python
chosen
[ { "from": "human", "value": "Add some useful finder tests\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (C) 2016 GoDaddy Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in com...
python
chosen
[ { "from": "system", "value": "Telemetry: Add name attribute to each Page in ServiceWorkerPageSet\n\nServiceWorkerPerfTest loads the same page three times, but these should\nhave different characteristics because ServiceWorker works differently.\nThis patch gives each page load a name so we can track them se...
python
chosen
[ { "from": "human", "value": "Add coin flip simulator (hw02)\n" }, { "from": "gpt", "value": "'''\nFor Homework 02, Exercieses 01-02. EdX Learning From Data course.\nJonathan Miller\n'''\n\nimport random\n\n# FUNCTIONS ###########################\n\ndef runTrial(numCoins, numFlips):\n\n def fl...
python
chosen
[ { "from": "human", "value": "Add simple test for FormDesignerPlugin\n" }, { "from": "gpt", "value": "import pytest\nfrom cms import api\nfrom cms.page_rendering import render_page\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.utils.crypto import get_random_string\n\nfrom for...
python
chosen
[ { "from": "human", "value": "Test the console scripts entry point\n" }, { "from": "gpt", "value": "from i8c.tests import TestCase\nimport i8c\nimport sys\n\nclass TestEntryPoint(TestCase):\n \"\"\"Test the console scripts entry point.\"\"\"\n\n def setUp(self):\n self.saved_argv = s...
python
chosen
[ { "from": "human", "value": "Add test trek_dtail_pdf language none\n" }, { "from": "gpt", "value": "import os\n\nfrom django.test import TestCase\nfrom django.conf import settings\n\nfrom geotrek.trekking.factories import TrekFactory\nfrom geotrek.trekking.models import Trek\n\n\nclass Altimetry...
python
chosen
[ { "from": "human", "value": "Add match to wd script.\n" }, { "from": "gpt", "value": "import csv\nimport pickle\nimport sys\n\n\ndef load_index():\n with open('data/wd_issn.pkl') as inf:\n data = pickle.load(inf)\n return data\n\nwd_idx = load_index()\n\ndef match(issn, eissn):\n ...
python
chosen
[ { "from": "human", "value": "Remove the lms_comerce_api_url field from partners object\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-04-12 17:31\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(mig...
python
chosen
[ { "from": "human", "value": "Add integration test for minerva-dump script\n" }, { "from": "gpt", "value": "from contextlib import closing\nimport subprocess\nimport unittest\n\nfrom nose.tools import eq_\n\nfrom minerva.test import connect\n\n\nclass MinervaDump(unittest.TestCase):\n \"\"\"\n...
python
chosen
[ { "from": "human", "value": "Add PyQtGraph random walk without datetime\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nThis example demonstrates a random walk with pyqtgraph.\n\"\"\"\n\nimport sys\nimport numpy as np\nimport pyqtgraph as pg\nfrom pyqtgra...
python
chosen
[ { "from": "human", "value": "Add a snomask for OPER attempts\n" }, { "from": "gpt", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass SnoOper(ModuleData):\n implements(IPlugin, IModuleData)...
python
chosen
[ { "from": "human", "value": "Add a management command to rename a stream.\n\n(imported from commit b3acadc09b289b48e2ac298e50a5427545b6a473)\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfrom django.core.management.base import BaseCommand\n\nfrom zerver.lib.actions i...
python
chosen
[ { "from": "human", "value": "Add script to check if modules up\n" }, { "from": "gpt", "value": "from subprocess import call\nimport os\n\nmodules = [\n 'backend.unichat.eu',\n 'realtime.unichat.eu',\n 'presence.unichat.eu',\n 'matchmaker.unichat.eu',\n]\n\nfor m in modules:\n with...
python
chosen
[ { "from": "human", "value": "Add a migration to allow Auditor role to see mappings defined in the\nAudit context.\n" }, { "from": "gpt", "value": "\n\"\"\"Add mappings to Auditor role\n\nRevision ID: 54b6efd65a93\nRevises: 13b49798db19\nCreate Date: 2013-12-04 01:44:46.023974\n\n\"\"\"\n\n# revi...
python
chosen
[ { "from": "human", "value": "Add base model obect to project.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nBase model of project.\nContains to basic methods:\n dumps(object_data) - writes object into json.\n loads(json_data) - converts json into model object.\n\n\"\"...
python
chosen
[ { "from": "human", "value": "tests: Add test case for interval_sum\n\nSigned-off-by: Kapileshwar Singh <d373e2b6407ea84be359ce4a11e8631121819e79@arm.com>\n" }, { "from": "gpt", "value": "from bart.common import Utils\nimport unittest\nimport pandas as pd\n\n\nclass TestCommonUtils(unittest.TestC...
python
chosen
[ { "from": "human", "value": "Create a tool-info module for AVR\n" }, { "from": "gpt", "value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>\n#\n# SP...
python
chosen
[ { "from": "human", "value": "Add script to generate partition ids.\n\n\n" }, { "from": "gpt", "value": "import sys\nimport random\n\nif len(sys.argv) != 3:\n print >> sys.stderr, \"USAGE: python generate_partitions.py nodes partitions_per_node\"\n sys.exit()\n\nFORMAT_WIDTH = 10\n\nnodes =...
python
chosen
[ { "from": "human", "value": "Implement a framework for data retention policies\n\nAnd add customer1.invalid to it.\n\n(imported from commit 32b0293bc48abf5d9a3bd36f14f6b16d48ea6ff2)\n" }, { "from": "gpt", "value": "\"\"\"\nImplements the per-domain data retention policy.\n\nThe goal is to have a...
python
chosen