conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test of config module\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\n\nimport tensorflow as tf\n\nfrom .config import *\n\n\n\nclass TestConfig(unittest.TestCase):\n def test_def_config(self):\n config = def_config()\n self.assertTrue(isinst... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for action_context params rendering in chain\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 informa... | python | chosen |
[
{
"from": "human",
"value": "[python-sdk] Add support for account address\n\nWhile there's not much to account addresses, having convenience to move\nfrom hex, bytes, and public keys is useful. Much of this will need to be\nmoved to the authenticator library as it is built out.\n"
},
{
"from": "gpt"... | python | chosen |
[
{
"from": "human",
"value": "Add a script for deleting ECR images older than N days\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\nimport datetime as dt\nimport getpass\n\nimport boto3\nimport click\n\n\ndef role_arn_to_session(**kwargs):\n client = boto3.cli... | python | chosen |
[
{
"from": "human",
"value": "Add example for coverage upload\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport glob\nimport datetime\n\nfrom teamscale_... | python | chosen |
[
{
"from": "human",
"value": "Add dummy temperature script (for testing).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom dbus.mainloop.glib import DBusGMainLoop\nimport gobject\nimport argparse\nimport logging\nimport sys\nimport os\n\n# our own packages\nsys.path.insert(1, os.pat... | python | chosen |
[
{
"from": "human",
"value": "Add function to request station ids\n"
},
{
"from": "gpt",
"value": "import requests\nfrom lxml import html\n\n\nBVG_URL = 'http://mobil.bvg.de/Fahrinfo/bin/stboard.bin/dox?'\n\n\ndef request_station_ids(station_name):\n ''' Requests the station ids for the provid... | python | chosen |
[
{
"from": "human",
"value": "Add stub for output bot misp api\n"
},
{
"from": "gpt",
"value": "\"\"\"Connect to MISP instance and add event as MISPObject if not reported already.\n\nSPDX-FileCopyrightText: 2020 Intevation GmbH <https://intevation.de>\nSPDX-License-Identifier: AGPL-3.0-or-later\n... | python | chosen |
[
{
"from": "human",
"value": "Add a new method, edit operations.\n\n * Still need to think more, but for now we have four operations:\n replace, equal, delete, insert. These operation are mapped to\n rest note, repeat or stretch note, go down one tone, go up one tone.\n * Use sebastian for tone up/to... | python | chosen |
[
{
"from": "system",
"value": "Support client after the 9th :dancer:\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom . import views\n\n\nurlpatterns = patterns('',\n\n # Clients\n url(r'^client/$',\n views.ClientListView.as_view(),\n name=... | python | chosen |
[
{
"from": "human",
"value": "Add script to play random system sound\n"
},
{
"from": "gpt",
"value": "import os\nimport random\nimport subprocess\n\nSOUNDS_DIR = '/System/Library/Sounds'\nSOUNDS = os.listdir(SOUNDS_DIR)\n\nif random.randrange(0, 100) < 4:\n to_play = os.path.join(SOUNDS_DIR, r... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add tests for maxwell filtering\n"
},
{
"from": "gpt",
"value": "# Author: Mark Wronkiewicz <wronk@uw.edu>\n#\n# License: BSD (3-clause)\n\nimport os.path as op\nimport warnings\n\nfrom nose.tools import assert_true, assert_equal\nfrom numpy.testing import asser... | python | chosen |
[
{
"from": "human",
"value": "Add initial interface for Collection class with stubs for methods.\n\nA Collection will represent a group of items with a common numerical\ncomponent.\n"
},
{
"from": "gpt",
"value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :lic... | python | chosen |
[
{
"from": "human",
"value": "Add script for converting kanjidic2\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport json\n\nwith open(\"kanjidic2.json\", \"rb\") as f:\n raw = f.read()\n kanjidic2 = json.loads(raw)\n\n# Makes a dictionary where each key is a kanji, instead o... | python | chosen |
[
{
"from": "human",
"value": "Add tests for is_hex_byte and is_hex_byte_sequence\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\nfrom django.test import TestCase\n\nfrom cyder.base.eav import utils as u\n\n\nclass TestUtils(TestCase):\n def _valid(self, fun... | python | chosen |
[
{
"from": "human",
"value": "Add stub of script to generate a skeleton build directory\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, division, absolute_import\n\nfrom argparse import ArgumentParser\n\n\ndef main(args=None):\n if args is None:\n parser = Argume... | python | chosen |
[
{
"from": "human",
"value": "Fix audit context for object_folders\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"\nFix audit context on folders\n\nCreate Date: 2017-03-11 20:11:02.652252\n... | python | chosen |
[
{
"from": "human",
"value": "Add keystone v3 user negative cases\n\nImplement the keystone v3 user negative case:\ntest_create_user_for_non_existent_domain\n\nChange-Id: I644cfb0bea4abe2932a759ff86f446043170488d\nPartial-Bug: 1513748\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 OpenStack Fo... | python | chosen |
[
{
"from": "system",
"value": "Change to using threading.Lock instead of threading.Condition, and check lock state before trying to release it during the finally block\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nimport logging\nimport threading\nimport traceback\n\n\nclass Handler(object... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Meta changes on Branch and Repository\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-10-28 15:09\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrat... | python | chosen |
[
{
"from": "human",
"value": "Test driver for Voronoi stream power\n\nWhat it says on the tin. Very simple.\n"
},
{
"from": "gpt",
"value": "from landlab import VoronoiDelaunayGrid # , RasterModelGrid\nfrom landlab.components.flow_routing.route_flow_dn import FlowRouter\nfrom landlab.components.... | python | chosen |
[
{
"from": "human",
"value": "Add function to solve inverse kinematics task\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport math\n\ndef get_angles(x, y, z):\n \"\"\"Return joint angles based on passed position.\"\"\"\n\n # Values below are given in milimeters\n b = 35 # S... | python | chosen |
[
{
"from": "human",
"value": "Add test for barbican client\n\nChange-Id: I9236e62f3259cfd560e3837830191012d107e853\nPartial-Bug: #1461967\n"
},
{
"from": "gpt",
"value": "#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance... | python | chosen |
[
{
"from": "human",
"value": "DOC: Add example on how to use WaveletTransform\n"
},
{
"from": "gpt",
"value": "# Copyright 2014-2016 The ODL development group\n#\n# This file is part of ODL.\n#\n# ODL is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General... | python | chosen |
[
{
"from": "human",
"value": "Add network quota exceeding negative test\n\nA quota on the network resource is set. More network resources than\nallowed are created. The quota exceeding exception is then catched.\n\nChange-Id: Ic6b846a42276a4cccc0b95fc8654f8c2c16d75c5\nImplements: blueprint add-test-for-quota... | python | chosen |
[
{
"from": "system",
"value": "Add currency property to pricing policies\n"
},
{
"from": "human",
"value": "class TaxNotKnown(Exception):\n \"\"\"\n Exception for when a tax-inclusive price is requested but we don't know\n what the tax applicable is (yet).\n \"\"\"\n\n\nclass Base(obj... | python | chosen |
[
{
"from": "human",
"value": "Test that shapes of input and output match up\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\nimport unittest\nimport numpy as np\nimport numpy.testing as npt\nfrom dipy.core.gradients import gradient_table\nfrom generateSyntheticData import (generateSy... | python | chosen |
[
{
"from": "human",
"value": "[Backport] Create missing migration in taiga.projects.notifications\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n depend... | python | chosen |
[
{
"from": "human",
"value": "Add a script to get failures for hydra eval /cc @globin\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env nix-shell\n#!nix-shell -i python -p pythonFull pythonPackages.requests pythonPackages.pyquery pythonPackages.click\n\n# To use, just execute this script with --hel... | python | chosen |
[
{
"from": "human",
"value": "Add tests for writer file\n"
},
{
"from": "gpt",
"value": "import unittest, argparse, os, tempfile\nfrom echolalia.writer.file import Writer\n\nclass FileTestCase(unittest.TestCase):\n\n def setUp(self):\n self.parser = argparse.ArgumentParser()\n self.data = ... | python | chosen |
[
{
"from": "human",
"value": "TST: Add integration tests for eqplot\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThe plot test module verifies that the eqplot produces plots without error.\n\"\"\"\n\nfrom pycalphad import Database, eqplot, equilibrium\nimport pycalphad.variables as v\nfrom pycalphad.... | python | chosen |
[
{
"from": "human",
"value": "Add migration for junit_path field\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.3 on 2017-05-30 22:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio... | python | chosen |
[
{
"from": "human",
"value": "TST: Add tests to check the actual output on the console.\n"
},
{
"from": "gpt",
"value": "# Standard library imports\nimport unittest\n\n# System library imports\nfrom IPython.external.qt import QtGui\n\n# Local imports\nfrom IPython.frontend.qt.console.console_widg... | python | chosen |
[
{
"from": "human",
"value": "Add a temporary semi-interactive way to add artists.\n"
},
{
"from": "gpt",
"value": "#!/Users/julian/.local/share/virtualenvs/great/bin/pypy\n\"\"\"\n* group by artist\n* canonical case\n* find existing artist\n\"\"\"\nimport csv\nimport subprocess\nimport sys\n\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add script to count label set statistics\n\nAdded a script that outputs statistics about label sets in the data.\n"
},
{
"from": "gpt",
"value": "\"\"\"Create multilabel data set with normalized spelling.\nThe input consists of a directory of text files containing th... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for tag replacement finder\n"
},
{
"from": "gpt",
"value": "#\n\nimport pytest\nimport sdsc\n\n#True\n# tagtype = str(tagsreplaced.group(1))\n# tokens = int(tagsreplaced.group(2))\n\n@pytest.mark.parametrize(\"text,result\",\n (\n # 0... | python | chosen |
[
{
"from": "human",
"value": "Add a test class for Schema.\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\nfrom rapt.treebrd.errors import RelationReferenceError\nfrom rapt.treebrd.schema import Schema\n\n\nclass TestSchema(TestCase):\n def test_contains_when_empty(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "chore(text-fields): Create full text indexes on 'text' and 'simple_text'\n\n#228\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\nfrom django.db.transaction import atomic\n\nfrom hadiths.initial_data import *\nfrom hadiths.models import Person, Hadi... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert .mat files to JSON\n\n* This allows us to avoid having proprietary .mat files in our test data\n"
},
{
"from": "gpt",
"value": "# Script to convert proprietary .mat files into json\n\nimport sys\nimport os\nimport glob\nimport json\nimport numpy... | python | chosen |
[
{
"from": "human",
"value": "Add model visualizer for CIFAR conditional\n"
},
{
"from": "gpt",
"value": "from pylearn2.utils import serial\nimport sys\n_, model_path = sys.argv\nmodel = serial.load(model_path)\nspace = model.generator.get_output_space()\nfrom pylearn2.config import yaml_parse\nf... | python | chosen |
[
{
"from": "human",
"value": "[WIP] Add python file that is triggered when saving a file\n"
},
{
"from": "gpt",
"value": "import sublime\nimport sublime_plugin\nimport re\n\nclass LevureAppNotify(sublime_plugin.EventListener):\n def on_post_save(self, view):\n # 1. Get script only stack... | python | chosen |
[
{
"from": "human",
"value": "Add a script to test mavlink connection (read heartbeat)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\ntest mavlink messages\nDo not forget to precise the baudrate (default 115200)\n'''\n\nimport sys, struct, time, os\nfrom curses import ascii\n\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add my script for handling transformer failures\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8\n\"\"\"\nSnippet.\n\nAWLC: When I'm trying to diagnose failures on the transformer queue,\nI save the queue contents with sqs_freezeray [1], and then I want to\ngo ... | python | chosen |
[
{
"from": "human",
"value": "Add test to ensure private projects are not shown in the project list\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom django.core.urlresolvers import reverse\n\n\n@pytest.mark.django_db\ndef test_hide_private_projects(client, user, project_factory):\n public ... | python | chosen |
[
{
"from": "human",
"value": "Allow stack.owner_id to store a uuid.\n\nFixes bug 1078854\n\nChange-Id: I3dae1502968853d563ba52bc1d6656c48d5d18ba\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import *\nfrom migrate import *\nfrom heat.common import utils\n\n\ndef upgrade(migrate_engine):\n m... | python | chosen |
[
{
"from": "human",
"value": "Add functional test for resource exposure\n\nThese simple tests check that Sahara resources can not be created\nand are not listed in the resource-type-list.\n\nIf we ever decide to install Sahara on the Heat functional tests gate,\ntests should be changed to use other not insta... | python | chosen |
[
{
"from": "human",
"value": "Add tests for high level blake hash class\n"
},
{
"from": "gpt",
"value": "# Import nacl libs\nimport libnacl.blake\n\n# Import python libs\nimport unittest\n\n\nclass TestBlake(unittest.TestCase):\n '''\n Test sign functions\n '''\n def test_keyless_blak... | python | chosen |
[
{
"from": "system",
"value": "Create the Contacts App - Part II > New Contact - Create URL\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nadmin.autodiscover()\n\nfrom marketing.views import HomePage\nfrom accounts.views... | python | chosen |
[
{
"from": "human",
"value": "Add component to generate random lng/lat points.\n"
},
{
"from": "gpt",
"value": "from __future__ import division\nimport math\nimport random\n\n# Geographic centre of the USA:\nlongitude = float(39.8281418)\nlatitude = float(-98.6419404)\n\n\ndef get_location(radius... | python | chosen |
[
{
"from": "human",
"value": "Add a trivial empty-search test\n"
},
{
"from": "gpt",
"value": "import django.test\nfrom search.models import Project\n\nclass NonJavascriptSearch(django.test.TestCase):\n fixtures = ['bugs-for-two-projects.json']\n\n def testSearch(self):\n response = ... | python | chosen |
[
{
"from": "human",
"value": "Add test for audit log\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom django.core.urlresolvers import reverse\n\nfrom sentry.models import AuditLogEntry, AuditLogEntryEvent\nfrom sentry.testutils import TestCase\n\n\nclass Organizatio... | python | chosen |
[
{
"from": "human",
"value": "Test S3 parsing and validation\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom ...decorators import InvalidScheme\nfrom ..s3 import S3, S3Jar, S3Tar, Invalid\n\n\ndef test_http():\n src = S3('s3://bucket/key')\n assert src.authority == 'bucket'\n asse... | python | chosen |
[
{
"from": "human",
"value": "Add 'Three Panel Soul' crawler\n"
},
{
"from": "gpt",
"value": "from comics.crawler.crawlers import BaseComicCrawler\n\nclass ComicCrawler(BaseComicCrawler):\n def _get_url(self):\n self.parse_feed('http://www.rsspect.com/rss/threeps.xml')\n\n for en... | python | chosen |
[
{
"from": "human",
"value": "Add some parsing util funcs\n"
},
{
"from": "gpt",
"value": "\"\"\"Utilities for parsing pages\"\"\"\n\nfrom collections import namedtuple\n\nHome = namedtuple('Home', ['town', 'school'])\n\n\ndef ht_feet_to_inches(ht_str):\n \"\"\"Take in height in ft-in format, ... | python | chosen |
[
{
"from": "human",
"value": "Add a test that verifies you can observe two built in bots playing against each other.\n\nPiperOrigin-RevId: 183666331\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Versi... | python | chosen |
[
{
"from": "system",
"value": "Remove namespace from network ext test\n\nChange-Id: Id9b97d67ac6745fe962a76ccd9c0e4f7cbed4a89\n"
},
{
"from": "human",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. ... | python | chosen |
[
{
"from": "human",
"value": "Write a PRNG datapoint every second\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom time import sleep\nimport random\nfrom tempodb import Client, DataPoint\nimport tempodb\nfrom os import getenv\n\nAPI_KEY = getenv('API_KEY')\nassert API_KEY, \"A... | python | chosen |
[
{
"from": "human",
"value": "Include a basic Monte Carlo integrator of 1 - x^2.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Usage: mc-integration.py N seed\n# N is the number of random points to draw\n# Seed is used in the Python RNG to ensure repeatability of results\n\nimport ra... | python | chosen |
[
{
"from": "human",
"value": "Add test for Adyen API version\n"
},
{
"from": "gpt",
"value": "from Adyen.settings import API_CHECKOUT_VERSION, API_PAYMENT_VERSION\n\n\ndef test_adyen_api_version_not_changed():\n # We shouldn't bump the Adyen API version when we make a path release.\n # We c... | python | chosen |
[
{
"from": "human",
"value": "ui/app_list: Add git cl format presubmit warning.\n\nUpon patch upload 'git cl format' is run on the diff and outputs a\nwarning if the diff has style violations, saving manual review\ntime for coding style.\n\nBUG=None\nTEST=None\nR=xiyuan@chromium.org\n\nReview URL: https://co... | python | chosen |
[
{
"from": "human",
"value": "TST: Add a revert function test\n"
},
{
"from": "gpt",
"value": "from hypothesis import given, strategies as st\nfrom hypothesis.strategies import text\nfrom hypothesis import settings\nimport random\n\n\nalphabet_list = ''\nfor i in range(26):\n alphabet_list = a... | python | chosen |
[
{
"from": "human",
"value": "Add Column to get notifications.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add unsubscribe column to user table\n\nRevision ID: 4e435ff8ba74\nRevises: bbba2255e00\nCreate Date: 2015-02-09 10:36:45.935116\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = ... | python | chosen |
[
{
"from": "human",
"value": "Add site_settings example for new installations.\n"
},
{
"from": "gpt",
"value": "# Site-specifig django settings.\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n ('Your name', 'your-email@example.org'),\n)\n\nSERVER_EMAIL = 'root'\n\nMANAGERS = ADMINS\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a clear test of rotation angle\n\nWith an illustration, as a guard against regressions.\n"
},
{
"from": "gpt",
"value": "from math import sqrt\n\nfrom affine import Affine\n\n\ndef test_rotation_angle():\n \"\"\"A positive angle rotates a vector counter clockw... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for AtomicValue methods.\n"
},
{
"from": "gpt",
"value": "# Copyright 2012 The scales Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain... | python | chosen |
[
{
"from": "human",
"value": "Add conduit compound test. (join test)\n"
},
{
"from": "gpt",
"value": "import unittest\nutils = __import__('utils') # Suppress PyCharm warning\n\nfrom picdump import conduit\n\n\nclass DummySource:\n def __init__(self, src):\n self.src = src\n self... | python | chosen |
[
{
"from": "human",
"value": "Add missing Morphing Schema File\n"
},
{
"from": "gpt",
"value": "class MorphingSchema():\n\n def dump(self, obj):\n return self._get_serializer(obj).dump(obj)\n\n def _obj_to_name(self, obj):\n return obj.__mapper__.polymorphic_identity\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add helpers for to do consistency tests on pandas DataFrame\n"
},
{
"from": "gpt",
"value": "\"\"\"\n@author: efourrier\n\nPurpose : This module is designed to provide custom test assertion return in True or\nFalse so you can quickly include them into tests against y... | python | chosen |
[
{
"from": "human",
"value": "Use inventory files from project (forgotten migration)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2017-11-24 06:25\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.mo... | python | chosen |
[
{
"from": "human",
"value": "Add ARRAY column to handle user favorites.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add favorites user_ids\n\nRevision ID: 9a83475c60c3\nRevises: 8ce9b3da799e\nCreate Date: 2017-03-28 11:37:03.861572\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '9a... | python | chosen |
[
{
"from": "human",
"value": "Make assessment titles not unique\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: ivan@reciprocitylabs.com\n... | python | chosen |
[
{
"from": "human",
"value": "Add dummy Dealer test module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport os\nimport sys\nsys.path.append(os.path.join(os.getcwd(), '../'))\n\nimport pytest\nimport blackjack.dealer as dealer\nimport blackjack.table as table\n\ndef test_dummy():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for filtering coverage content"
},
{
"from": "gpt",
"value": "import os\nimport xml.etree.ElementTree as ET\n\nfrom main.management.commands.merge_coverage_files import Command, PACKAGES_LIST\n\n\ndef test_filtering_xml_when_no_package_filters_includes_all_... | python | chosen |
[
{
"from": "human",
"value": "Add test case for email unique validate\n"
},
{
"from": "gpt",
"value": "from account.models import EmailAddress\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth.models import User\nfrom django.forms import ValidationError\nfrom django.test imp... | python | chosen |
[
{
"from": "human",
"value": "Add example for SGraph.show with NetworkX layout."
},
{
"from": "gpt",
"value": "import networkx as nx\ng = nx.Graph()\n\n# put the nodes and edges from the SGraph into a NetworkX graph\ng.add_nodes_from(list(sg.vertices['__id']))\ng.add_edges_from([(e['__src_id'], e... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add a benchmark for ward\n\nComparing the scikits and scipy\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBench the scikit's ward implement compared to scipy's\n\"\"\"\n\nimport time\n\nimport numpy as np\nfrom scipy.cluster import hierarchy\nimport pylab as pl\n\nfr... | python | chosen |
[
{
"from": "system",
"value": "Fix implicit imports for tournament repo\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\n# The order of imports matters!\nfrom .random_ import random_choice\nfrom .plot import Plot\nfrom .game import DefaultGame, Game\nfrom .player impor... | python | chosen |
[
{
"from": "human",
"value": "Add raw mode hooker that reduces redundant stuff\n"
},
{
"from": "gpt",
"value": "import hexchat\n\ntry:\n from .util import no_recursion\nexcept SystemError:\n # Add addons path to sys.path for win32\n # See https://github.com/hexchat/hexchat/issues/1396\n ... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of parsing application\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\nfrom parsers.main_parser import MainParser\n\n\nif __name__ == '__main__':\n\n src = r\"D:\\nhl\\official_and_json\\2016-17\\... | python | chosen |
[
{
"from": "human",
"value": "Add Kalman filter for heading\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests the heading Kalman Filter.\"\"\"\n\nimport math\nimport numpy\nimport operator\nimport random\nimport unittest\n\nfrom heading_filter import HeadingFilter\n\n#pylint: disable=protected-access\... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for training module prep"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport jsonfield.fields\nimport dashboard.models\n\n\nclass Migration(migrations.Migra... | python | chosen |
[
{
"from": "human",
"value": "Add Binary Search source code\n"
},
{
"from": "gpt",
"value": "\"\"\"You're going to write a binary search function.\nYou should use an iterative approach - meaning\nusing loops.\nYour function should take two inputs:\na Python list to search through, and the value\n... | python | chosen |
[
{
"from": "human",
"value": "Add a function for getting plugin entry points\n\nThis will be how we pull up plugins that have been installed in the\nenvironment and execute them\n"
},
{
"from": "gpt",
"value": "import pkg_resources\n\ndef get_entries(name):\n entries = []\n for entry in pkg... | python | chosen |
[
{
"from": "system",
"value": "Fix style issues in python test plugin\n\nhttps://bugzilla.gnome.org/show_bug.cgi?id=678339"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# ex:set ts=4 et sw=4 ai:\n\nfrom gi.repository import GObject, Introspection, Peas\n\nclass ExtensionPythonPlugin(G... | python | chosen |
[
{
"from": "human",
"value": "Add python examples for BpmHistogramDescriptors\n"
},
{
"from": "gpt",
"value": "import sys\nfrom essentia.standard import *\nfrom essentia import Pool\nimport pylab as plt\n\ntry:\n input_file = sys.argv[1]\nexcept:\n print \"usage:\", sys.argv[0], \"<input_fi... | python | chosen |
[
{
"from": "human",
"value": "Add script to time serialization functions\n"
},
{
"from": "gpt",
"value": "\"\"\"\n:author: samu\n:created: 4/17/13 10:37 PM\n\"\"\"\n\nimport timeit\n\nfrom smartrpyc.utils import serialization\nimport msgpack\n\n\ndef run_test(module):\n module.unpackb(module.p... | python | chosen |
[
{
"from": "human",
"value": "Add script to reformat json files for humans\n\nI'm often working with json data that is omits newlines and indentation\nfor consumption by a machine, but I often need to make sense of it\nmyself as well. This script is a small wrapper around the Python parser\nto reformat the j... | python | chosen |
[
{
"from": "human",
"value": "Add tag popularity to alembic\n"
},
{
"from": "gpt",
"value": "\"\"\"Add columns to track popularity of tags\n\nRevision ID: 1c6e2fb3d3b6\nRevises: 6887c442bbee\nCreate Date: 2019-04-29 11:30:45.528110\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n#... | python | chosen |
[
{
"from": "human",
"value": "Add ipython pandas startup script.\n"
},
{
"from": "gpt",
"value": "import sys\n\nimport pandas as pd\n\n\npd.options.display.max_columns = 100\npd.options.display.min_rows = 20\npd.options.display.width = None if sys.stdout.isatty() else sys.maxsize\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add some strings for translation to be picked up by makemessages\n"
},
{
"from": "gpt",
"value": "# This module exists just to list strings for translation to be picked\n# up by makemessages.\n\nfrom django.utils.translation import ugettext as _\n\n# Labels for the e... | python | chosen |
[
{
"from": "human",
"value": "Add script to find old reminder framework usage\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\nfrom collections import defaultdict\nfrom corehq.apps.reminders.models import CaseReminderHandler, REMIND... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Build() API\n"
},
{
"from": "gpt",
"value": "import mock\n\nfrom piper.api.build import Build\n\n\nclass TestBuildGet(object):\n def setup_method(self, method):\n self.build = Build()\n self.build.db = mock.Mock()\n self.build_id... | python | chosen |
[
{
"from": "human",
"value": "Add snippet - chart total area at each time step"
},
{
"from": "gpt",
"value": "# Unneeded charting code that was removed from a jupyter notebook. Stored here as an example for later\n# Draws a chart with the total area of multiple protin receptors at each time step\... | python | chosen |
[
{
"from": "human",
"value": "feat: Add script to modify the values of the variables\nred_threshold, green_threshold, and blue_threshold until you are able\nto retain as much of the lane lines as possible, while getting rid\nof most of the other stuff\n"
},
{
"from": "gpt",
"value": "# Modify the... | python | chosen |
[
{
"from": "system",
"value": "Add example argument, for direct url\n"
},
{
"from": "human",
"value": "\"\"\"A basic (single function) API written using Hug\"\"\"\nimport hug\n\n\n@hug.get('/happy_birthday')\ndef happy_birthday(name, age:hug.types.number, **kwargs):\n \"\"\"Says happy birthday... | python | chosen |
[
{
"from": "human",
"value": "Add management command to sync EveryPolitician UUID\n"
},
{
"from": "gpt",
"value": "from everypolitician import EveryPolitician\n\nfrom django.core.management.base import BaseCommand\n\nfrom pombola.core.models import Person\n\n\nclass Command(BaseCommand):\n hel... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for Copy function\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport numpy\n\nimport chainer\nfrom chainer import functions\nfrom chainer import gradient_check\n\n\nclass Copy(unittest.TestCase):\n\n def setUp(self):\n self.x_data = num... | python | chosen |
[
{
"from": "human",
"value": "Add basic xml parser for laws\n"
},
{
"from": "gpt",
"value": "# encoding=utf8 \nimport sys \nfrom lxml import etree\n\nreload(sys) \nsys.setdefaultencoding('utf8')\n\ntree = etree.parse(\"BJNR002190897.xml\")\nroot = tree.getroot()\n\nfor child in root:\n meta... | python | chosen |
[
{
"from": "human",
"value": "tests/basics: Add tests for arithmetic operators precedence.\n"
},
{
"from": "gpt",
"value": "# see https://docs.python.org/3/reference/expressions.html#operator-precedence\n\n# '|' is the least binding numeric operator\n\n# '^'\n# OK: 1 | (2 ^ 3) = 1 | 1 = 1\n# BAD... | python | chosen |
[
{
"from": "human",
"value": "Add a module for loading Google Sheets\n"
},
{
"from": "gpt",
"value": "from database import DeveloperInfo\n\nimport csv\nimport re\n\n\ndef get_names(full_name):\n match = re.match(r'(\\w+) ([\\w ]+)', full_name)\n if match is None:\n return None\n r... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.