conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add unit test for MusicExtractor\n\nSimilar to the test for FreesoundExtractor\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra\n#\n# This file is part of Essentia\n#\n# Essentia is... | python | chosen |
[
{
"from": "human",
"value": "Add migration to pick up missing enumeration value for encounter.auth_method\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0fa4a0bd6595\nRevises: b68a125b8470\nCreate Date: 2017-03-07 19:12:13.758000\n\n\"\"\"\n\n# revision identifiers, used by... | python | chosen |
[
{
"from": "human",
"value": "BUG: Add the topological_sort function back to traits.util.\n"
},
{
"from": "gpt",
"value": "#-----------------------------------------------------------------------------\n#\n# Copyright (c) 2011, Enthought, Inc.\n# All rights reserved.\n#\n# This software is prov... | python | chosen |
[
{
"from": "human",
"value": "Remove topics from models migration\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 ('cfp', '004... | python | chosen |
[
{
"from": "human",
"value": "Create new Conversations, answer to old ones or delete them\n"
},
{
"from": "gpt",
"value": "import requests\n\nclass Conversation:\n \"\"\"This class represents a conversation.\n\n .. note::\n Remember that you need to have access to the conversation.\n... | python | chosen |
[
{
"from": "human",
"value": "Add test for email account export\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom billjobs.admin import UserAdmin\n\nclass EmailExportTestCase(TestCase):\n \"\"\" Tests for email account export \"\"\"\n\n def test_action_is_avaible(self)... | python | chosen |
[
{
"from": "human",
"value": "Complete day 3 part 2\n"
},
{
"from": "gpt",
"value": "with open('day-03-input.txt', 'r') as f:\n puzzle_input = f.read().replace('\\n', '')\n\n# Coordinates: (x, y)\nclass Santa:\n def __init__(self):\n self.x = 0\n self.y = 0\n\n def move(sel... | python | chosen |
[
{
"from": "human",
"value": "Add Game of Thrones 1\n"
},
{
"from": "gpt",
"value": "'''\nDothraki are planning an attack to usurp King Robert's throne. King Robert \nlearns of this conspiracy from Raven and plans to lock the single door \nthrough which the enemy can enter his kingdom.\n\nBut, to... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for installer reason\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2017-11-04 21:38\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migrati... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for allow timelog flag\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 443d1e78a932\nRevises: 59e149a772cf\nCreate Date: 2018-08-07 21:36:03.384838\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision iden... | python | chosen |
[
{
"from": "human",
"value": "Add stub for Subscriptions API testing"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for the Subscriptions API class.\n\"\"\"\nimport unittest\nimport mws\nfrom .utils import CommonRequestTestTools\n\n\nclass SubscriptionsTestCase(unittest.TestCase, CommonRequestTestT... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for on_delete=SET_NULL change\n\nAdded in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-01-30 19:25\nfrom __future__ import unicod... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the JWTAuthVerifier.\n\nSigned-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com>\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport mock\n\nfrom ..signer import JWTAuthSigner\nfrom ..verifier import JWTAuthVerifier\nf... | python | chosen |
[
{
"from": "human",
"value": "Use script to generate sine table for interpolation\n"
},
{
"from": "gpt",
"value": "import math\n\nwith open(\"sine_table.h\", \"w\") as f:\n sines = []\n for i in range(-1, 362):\n sines.append(str(\"%.15f\" % math.sin(math.radians(i))))\n\n f.write... | python | chosen |
[
{
"from": "human",
"value": "Initialize alov parsing code with main block\n"
},
{
"from": "gpt",
"value": "\"\"\"A script for parsing the Alov bounding box `.ann` files.\"\"\"\n\nimport sys\nimport os\nimport itertools\nimport pandas as pd\nimport xml.etree.ElementTree as ET \n\n\nif __name__ ==... | python | chosen |
[
{
"from": "system",
"value": "Hide DataLossWarnings that appeared with html5lib 0.90 or so.\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1124 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n"
},
{
"from": "human",
"value": "import html5lib\nfrom html5lib import treebuilders\nfrom cStringIO impo... | python | chosen |
[
{
"from": "human",
"value": "Handle import of unittest2 in python 2.6\n"
},
{
"from": "gpt",
"value": "import sys\n\n# Enables unit tests to be work under Python 2.6\n# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py \nif sys.version_info >= (2, 7):\n imp... | python | chosen |
[
{
"from": "human",
"value": "Add an helper to create the metadata for a dir\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# vim: set ts=\n\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\n\nfrom optpars... | python | chosen |
[
{
"from": "human",
"value": "Add a script to show how to use decorator\n"
},
{
"from": "gpt",
"value": "#class to print out the x, y coordinate\nclass Coordinate(object):\n def __init__(self, x, y):\n self.x = x\n self.y = y\n def __repr__(self):\n return \"Coord: \" +... | python | chosen |
[
{
"from": "human",
"value": "Test some expected output of see() for int & float\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nUnit tests for the output of see for various types of object.\n\n\"\"\"\nimport itertools\n\ntry:\n import unittest2 as unittest\nexcept ImportError:... | python | chosen |
[
{
"from": "human",
"value": "Move towards using the weighted average strategy of pt-online-schema-change\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\nfrom __future__ import division\n\n\nclass WeightedAverageRate(object):\n # Sub: new\n #\n # Required Arguments:\n # tar... | python | chosen |
[
{
"from": "human",
"value": "Create add command to add new sync.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAdd a new sync object to sync between a git repo and Dropbox Paper.\n\"\"\"\nimport os\n\nfrom paper_to_git.commands.base import BaseCommand\nfrom paper_to_git.models import Sync, PaperFolde... | python | chosen |
[
{
"from": "human",
"value": "Add script to restore deleted files\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Restore a deleted StoredFileNode. If the file was reuploaded, renames the file\nto <filename> (restored).<ext>. For example, README.rst would be renamed to README (res... | python | chosen |
[
{
"from": "human",
"value": "Add a script to retrieve NED elevation map files.\n\nRetrieves base tileset zip files and updates. According to the USGS\nNED website, the longer filenames are updates to the base tileset.\nThese are frequently replacing existing tiles, but may also augment\nthe dataset by filli... | python | chosen |
[
{
"from": "human",
"value": "Add decorator to test url against checkamte\n"
},
{
"from": "gpt",
"value": "\"\"\"View decorators to integrate with checkmate's API.\"\"\"\nimport logging\n\nfrom checkmatelib import CheckmateClient, CheckmateException\nfrom pyramid.httpexceptions import HTTPTempora... | python | chosen |
[
{
"from": "human",
"value": "[data_analysis] Add simple script to print some metrics.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nUsage: analyze_results.py <result_data>\n\"\"\"\n\nfrom docopt import docopt\nimport pandas as pd\nimport numpy as np\nf... | python | chosen |
[
{
"from": "human",
"value": "Add tests for query objects.\n"
},
{
"from": "gpt",
"value": "import pickle\n\nimport pytest\n\nfrom ..queries import TimeRange\n\n\ndef test_time_range():\n empty = TimeRange()\n assert empty == dict(empty) == empty.query == {}\n assert TimeRange(**empty.kw... | python | chosen |
[
{
"from": "human",
"value": "Enh: Test - Add test for fix\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Copyright (C) 2009-2014:\n# Sebastien Coavoux, s.coavoux@free.frc\n#\n# This file is part of Shinken.\n#\n# Shinken is free software: you can redistribute it and/or modify\n# it... | python | chosen |
[
{
"from": "human",
"value": "Write a top-level file to wrap the bug-finding process\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport argparse, tempfile, sys\nfrom replace_imports import include_imports\n\nparser = argparse.ArgumentParser(description='Attempt to create a small file ... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add examples for using dates with TSA models\n"
},
{
"from": "gpt",
"value": "import scikits.statsmodels.api as sm\nimport numpy as np\nimport pandas\n\n# Getting started\n# ---------------\n\ndata = sm.datasets.sunspots.load()\n\n# Right now an annual date seri... | python | chosen |
[
{
"from": "human",
"value": "Add implementation pollardrho in python.\n"
},
{
"from": "gpt",
"value": "import random \n\ndef gcd( a, b):\n if(b == 0): return a;\n return gcd(b, a % b);\n\ndef pollardRho(N):\n if N%2==0:\n return 2\n x = random.randint(1, N-1)\n... | python | chosen |
[
{
"from": "human",
"value": "Test coverage for relative urls in curl module\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n\n# uses the high level interface\nimport curl\nimport unittest\n\nfrom . import app\nfrom . import runwsgi\nfrom . imp... | python | chosen |
[
{
"from": "human",
"value": "Add script to download single file from file_id.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nDownload file from Thingiverse.com\n\"\"\"\n\nimport argparse\nimport os.path\nimport requests\n\nfrom thingiverse_crawler import get_download_link\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add script for merging KML files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\nimport lxml.etree\n\ndef main():\n if len(sys.argv) < 3:\n sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\\n')\n sys.exit('U... | python | chosen |
[
{
"from": "human",
"value": "Add Profile model and post-save hook\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.models import User\nfrom django.db import models\nfrom django.db.models.signals import post_save\nfrom django.dispatch import receiver\n\n\nclass Profile(models.Model):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some examples from tense present\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"DFW201: Tense present.\n\n---\nlayout: post\nerror_code: MAU103\nsource: DFW's Tense Present\nsource_url: http://bit.ly/1c85lgR\ntitle: Tense present\nda... | python | chosen |
[
{
"from": "human",
"value": "Add tests for errors in borg.py\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom borg_summon import borg\n\ndef test_hook_no_command():\n with pytest.raises(borg.InvalidConfigError) as excinfo:\n borg.hook({})\n assert str(excinfo.value) == 'The \"co... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for `TsTzRange` (de-)serialization of `Interval`s\n\nRefs #160\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for dependency sorting module.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# test_component_dependencies.py:\n# unit tests for vyconf.components.dependencies\n#\n# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>\n#\n#... | python | chosen |
[
{
"from": "human",
"value": "Create a decorator `login_required` for access control on pages for logged in users.\n"
},
{
"from": "gpt",
"value": "from functools import wraps\nfrom flask import flash, redirect, url_for, session\nfrom app import views\n\ndef login_required(f):\n @wraps(f)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add demo of origin and orientation values\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDemonstration of altering a plot's origin and orientation.\n\nThe origin parameter sets a plot's default origin to the specified corner\nof the plot window. These positions has the fol... | python | chosen |
[
{
"from": "human",
"value": "Add a performance test for concrete execution.\n"
},
{
"from": "gpt",
"value": "\n# Performance tests on concrete code execution without invoking Unicorn engine\n\nimport os\nimport time\nimport logging\n\nimport angr\n\n\ntest_location = str(os.path.join(os.path.dir... | python | chosen |
[
{
"from": "human",
"value": "Add initial code for pulse counting\n\nBrief intro: my stationary bicycle *had* a measurement monitor with\nspeed, traveled kms, etc. However, it broke down. As my stationary bike\nis quite old, I was not able to find a replacement (a good thing). I\nnoticed that the cable going... | python | chosen |
[
{
"from": "human",
"value": "Add first round of tests\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nfrom indra.statements import *\nfrom indra.belief import BeliefEngine\n\nev1 = Evidence(source_api='rea... | python | chosen |
[
{
"from": "human",
"value": "Add a direct st2 CLI test case for st2 alias-execution execute command.\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 The StackStorm Authors.\n# Copyright 2019 Extreme Networks, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you m... | python | chosen |
[
{
"from": "human",
"value": "Add plugin for PHP5 FPM\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# igcollect - PHP5 FPM\n#\n# This is the data collector for the PHP5 FPM status page. It makes a\n# HTTP request to get the page, and formats the output. All the numeric\n# values of... | python | chosen |
[
{
"from": "human",
"value": "Fix failing test in Codeship\n"
},
{
"from": "gpt",
"value": "from xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase\nimport unittest\n\n\nclass TestXpathBrowserWipeAlerts(WebUnitTestBase):\n def test_wipe_alerts(self):\n from selenium.common.ex... | python | chosen |
[
{
"from": "human",
"value": "Copy Thomas Kluyver's Py3 compat from rdflib\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUtility functions and objects to ease Python 3 compatibility.\nContributed to rdflib 3 by Thomas Kluyver, re-used here.\n\"\"\"\nimport sys\n\ntry:\n from functools import wraps\... | python | chosen |
[
{
"from": "human",
"value": "Add test of zmq-based control mechanism for ControlledProcess class.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport time\nfrom unittest import main, TestCase\n\nimport zmq\n\nfrom neurokernel.tools.comm import get_random_port\nfrom neurokernel.ctrl_... | python | chosen |
[
{
"from": "human",
"value": "Add script to update hostname\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\nimport subprocess\nfrom utils import file_templates\nfrom utils.validation import is_valid_hostname\n\n\ndef main():\n\tuser_input = raw_input(\"Want to change the hostname?: Y/... | python | chosen |
[
{
"from": "human",
"value": "Add a test for iter_pairs\n"
},
{
"from": "gpt",
"value": "\nimport unittest\nimport numpy as np\nimport numpy.testing as test\nfrom word2gauss.words import Vocabulary, iter_pairs\n\nDTYPE = np.float32\n\nclass TestIterPairs(unittest.TestCase):\n def test_iter_pai... | python | chosen |
[
{
"from": "human",
"value": "Add script tu run the tests.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport sys\nimport os\n\nfrom openslides.__main__ import main as openslides_main\nfrom openslides.utils.main import setup_django_settings_module\n\n\ndef main():\n sys.path.in... | python | chosen |
[
{
"from": "human",
"value": "Add pre_op and post_op methods to PolicyBase\n\nFor all policies to be enforced, they may need a hooks that perform some\noperations on the targeted clusters.\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may... | python | chosen |
[
{
"from": "human",
"value": "Write a generic script signing utility\n\nSigned-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com>\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\n\"\"\"\nA script that creates signed Python files.\n\nDistributing detached signatures... | python | chosen |
[
{
"from": "human",
"value": "Add script to verify locking behavior\n\nBasically, start up a multithreaded flask server and throw\na bunch of multithreaded clients at it. Make sure the\nnumbers at the end make sense.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# This is a basic scr... | python | chosen |
[
{
"from": "human",
"value": "Add test for config file\n"
},
{
"from": "gpt",
"value": "# Test when we don't have a config file\n# Since we don't know if the user will have a config file or not when\n# running this test, we will move it out of the way and then move it back\n# when we're done\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Create the school song program"
},
{
"from": "gpt",
"value": "#David Hickox\n# Jan 12 17\n# School Song Program\n# Displays school song \n\n#actualy prints the song\nprint(\"All hail our school NCHS\\nWe'll sing your praises NCHS\\n\\nWith all our might\\nWe will alw... | python | chosen |
[
{
"from": "human",
"value": "Add simple unit test for compute engine.\n"
},
{
"from": "gpt",
"value": "from computeengine import Computation, States\n\n\ndef test_basic():\n def b(a):\n return a + 1\n\n def c(a):\n return 2 * a\n\n def d(b, c):\n return b + c\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for Activity model deletions\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom iati.models import Activity\nfrom iati.factory.utils import _create_test_activity\n\n\nclass ActivityModelTestCase(TestCase):\n\n def test_create_ac... | python | chosen |
[
{
"from": "system",
"value": "Fix calculation of current steps when starting with epoch != 0\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom keras.callbacks import Callback\nimport keras.backend as K\n\n\nclass LearningRateScheduler(Callback):\n \"\"\"Learning rate scheduler.... | python | chosen |
[
{
"from": "human",
"value": "Add command for bulk adding talks\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom events.models import Event\nfrom cfp.models import PaperApplication\nfrom talks.models import Talk\n\n\nclass Command(BaseCommand):\n hel... | python | chosen |
[
{
"from": "human",
"value": "Add GUI for 3D Rotation script\n"
},
{
"from": "gpt",
"value": "from Autodesk.Revit.UI import IExternalEventHandler, IExternalApplication, Result, ExternalEvent, IExternalCommand\nfrom Autodesk.Revit.DB import Form\n\nclass ExternalEventExample(IExternalEventHandler)... | python | chosen |
[
{
"from": "human",
"value": "Add test to excercise unclosed file warnings\n"
},
{
"from": "gpt",
"value": "from lektor.publisher import Command\n\n\ndef test_Command_triggers_no_warnings(recwarn):\n # This excercises the issue where publishing via rsync resulted\n # in ResourceWarnings abo... | python | chosen |
[
{
"from": "human",
"value": "Add general framework for coding\n\nusing documentation\n"
},
{
"from": "gpt",
"value": "class Docstring:\n \"\"\"Class for storing docstring information.\n\n Following headers are used by this class:\n\n * 'summary' - first line of the docstring\n * 'ext... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the high-level interface\n"
},
{
"from": "gpt",
"value": "import collections\nimport pathlib\n\nimport numpy as np\nimport pytest\n\nimport eccodes\n\nSAMPLE_DATA_FOLDER = pathlib.Path(__file__).parent / \"sample-data\"\nTEST_GRIB_DATA = SAMPLE_DATA_FOL... | python | chosen |
[
{
"from": "human",
"value": "Add python script to resize regions\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# resize_ranges\n# Resizes ranges in a BED file around a center point\n#\n\nimport sys\nimport argparse\nimport csv\n\ndef resize_row(row, width):\n start, end = int(ro... | python | chosen |
[
{
"from": "human",
"value": "Add test case for model class inheritance\n"
},
{
"from": "gpt",
"value": "'''Test case for MongoDB database backend\n'''\nimport unittest\n\nfrom lighty.db import fields, models\n\n\nclass ModelTestCase(unittest.TestCase):\n '''Test case\n '''\n\n def testC... | python | chosen |
[
{
"from": "human",
"value": "Add a test file (which isn't run by regrtest) for bugs which\naren't fixed yet.\n\nIncludes a first test (for compiler).\n"
},
{
"from": "gpt",
"value": "#\n# This file is for everybody to add tests for bugs that aren't\n# fixed yet. Please add a test case and approp... | python | chosen |
[
{
"from": "system",
"value": "Add a package-level DistArray docstring."
},
{
"from": "human",
"value": "# encoding: utf-8\n# ---------------------------------------------------------------------------\n# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.\n# Distributed under... | python | chosen |
[
{
"from": "human",
"value": "Add rudimentary code for dropout RNN\n\nNon functioning code for illustration\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nimport numpy as np\n\n#First Option\n\nkeep_prob = 0.5\n\ncell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons)\ncell_drop = tf.c... | python | chosen |
[
{
"from": "system",
"value": "Add custom ModelAdmin for easier editing from list view"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom .models import Webhook\n\nadmin.site.register(Webhook)\n"
},
{
"from": "gpt",
"value": "from django.contrib import admin\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add script to fetch the binary pieces from Apple.\n"
},
{
"from": "gpt",
"value": "import urllib2\nimport os\n\n\npieces = \"\"\"\nSecurity.hdrs.tar.gz\nSecurity.root.tar.gz\nSecurityTokend.hdrs.tar.gz\nSecurityTokend.root.tar.gz\nlibsecurity_cdsa_client.hdrs.tar.gz\... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the read_setting_from_env function\n"
},
{
"from": "gpt",
"value": "import os\nimport unittest\n\nfrom yithlibraryserver.config import read_setting_from_env\n\n\nclass ConfigTests(unittest.TestCase):\n\n def test_read_setting_from_env(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add http availability checker script\n"
},
{
"from": "gpt",
"value": "import sys, requests, argparse\nfrom retrying import retry\n\nargparser = argparse.ArgumentParser()\nargparser.add_argument('url')\nargparser.add_argument('-t', '--timeout', type=int, default=120)\... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for full pipeline to get sliding window dn/ds\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sliding_window_tree\n\n# For now, use a *.remap.sam file (paired end reads aligned to a consensus sequence with indels removed).\nSAM_FILENAME = \"./d... | python | chosen |
[
{
"from": "human",
"value": "Add IPython script to run benchmarks\n\nThe `itimer.py` script uses IPython magic so it must be run using\n`ipython -i`, *not* with the vanilla Python interpreter.\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nimport genfilt as c\nimport genfilt_py as p\ni... | python | chosen |
[
{
"from": "human",
"value": "Add gstc error handler class\n"
},
{
"from": "gpt",
"value": "# GStreamer Daemon - gst-launch on steroids\n# Python client library abstracting gstd interprocess communication\n\n# Copyright (c) 2015-2019 RidgeRun, LLC (http://www.ridgerun.com)\n\n# Redistribution and... | python | chosen |
[
{
"from": "human",
"value": "Add context manager for temporary directories from Python 3.2\n\nThis is very useful in tests, and after writing my own version I found\nout that python 3.2 has now a basically identical implementation to\nmine, so I copied that instead. We can remove our copy once we're not\ns... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for server CRUD\n\nChange-Id: I77f292d47a9bea6a5b486ce513c0c19ec8c845dd\n"
},
{
"from": "gpt",
"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": "Add tests for removing \"/\" from wiki titles\n"
},
{
"from": "gpt",
"value": "from nose.tools import *\n\nfrom framework.mongo import database as db\n\nfrom scripts.remove_wiki_title_forward_slashes import main\n\nfrom tests.base import OsfTestCase\nfrom tests.facto... | python | chosen |
[
{
"from": "human",
"value": "Add a unit test for the password change form\n\nChange-Id: I5eeacefc3a0bd7d7f958f00befeb18e949c789db\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the ... | python | chosen |
[
{
"from": "human",
"value": "Add missing S3 boto storage classes\n"
},
{
"from": "gpt",
"value": "from storages.backends.s3boto import S3BotoStorage\n\nStaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')\nMediaRootS3BotoStorage = lambda: S3BotoStorage(location='media')\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Create a script to profile code.\n"
},
{
"from": "gpt",
"value": "import time\nfrom dgim.utils import generate_random_stream\nfrom dgim.dgim import Dgim\n\ndef profile_dgim(dgim, stream):\n for elt in stream:\n dgim.update(elt)\n\ndef main():\n\n N = 100... | python | chosen |
[
{
"from": "human",
"value": "Add file to extract source name from LTA header\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nimport numpy as np\nimport operator,os\n\ndef extract( file_name ):\n with open(file_name) as f:\n for i,line in enumerate(f,1):\n if \"SCN\" in... | python | chosen |
[
{
"from": "human",
"value": "Add new test runner for selenium tests\n\nThis is an extra test runner that is meant only for inside docker\ncontainers. The original test runner will remain untill we handle the\nscreen capture of the test runs, so we can run the tests on our local\nmachine and view the browser... | python | chosen |
[
{
"from": "human",
"value": "Add autosolver for quiz in week 4.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\ndef arr_from_str(text):\n arr = list()\n for i in text:\n if ord('A') <= ord(i) <= ord('Z'):\n arr.append(ord(i) - ord('A'))\n return arr\n\n\nd... | python | chosen |
[
{
"from": "human",
"value": "[TESTS] Add tests for (not yet implemented) classifier\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport numpy as np\nfrom sklearn.utils.estimator_checks import check_estimator\nfrom sklearn.model_selection import train_test_split\n\nimport legendary_potato.cl... | python | chosen |
[
{
"from": "human",
"value": "Bring coverage for the converters module up to 100%.\n\n--HG--\nbranch : trunk\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom beaker.converters import asbool, aslist\n\n\nclass AsBool(unittest.TestCase):\n def test_truth_str(self):\n for v in ('tr... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the `getproject` subcommand\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the ``getproject`` subcommand.\"\"\"\n\nimport os\n\nfrom pew._utils import temp_environ, invoke_pew as invoke\nfrom utils import TemporaryDirectory\n\n\ndef test_getproject(en... | python | chosen |
[
{
"from": "human",
"value": "Fix bug in reduce and tap.\n"
},
{
"from": "gpt",
"value": "import mr_streams as ms\nimport unittest\n\n# :::: auxilary functions ::::\ndef add_one(x):\n return x + 1\n\ndef triplicate(x):\n return (x,x,x)\n\ndef no_op(*args, **kwargs):\n pass\n\nclass TestC... | python | chosen |
[
{
"from": "human",
"value": "Add test to fail if there are migrations missing.\n"
},
{
"from": "gpt",
"value": "from StringIO import StringIO\nfrom django.core.management import call_command\nimport pytest\n\n\ndef test_for_missing_migrations():\n output = StringIO()\n try:\n call_c... | python | chosen |
[
{
"from": "human",
"value": "Create new generic Calinski Harabasz index\n"
},
{
"from": "gpt",
"value": "from pygraphc.similarity.CosineSimilarity import CosineSimilarity\n\n\nclass CalinskiHarabaszIndex(object):\n def __init__(self, clusters, preprocessed_logs, log_length):\n self.clu... | python | chosen |
[
{
"from": "human",
"value": "Add a python test file\n"
},
{
"from": "gpt",
"value": "import imap_cli\nfrom imap_cli import config\nfrom imap_cli import search\n\n\nconnect_conf = config.new_context_from_file(section='imap')\ndisplay_conf = config.new_context_from_file(section='display')\nimap_ac... | python | chosen |
[
{
"from": "human",
"value": "Add a view that handles POST and GET requests for the useless log\n"
},
{
"from": "gpt",
"value": "from django.shortcuts import render_to_response\nfrom django.http import HttpResponse\n\nfrom app.models import Event\n\ndef home(request):\n if request.method == 'POS... | python | chosen |
[
{
"from": "human",
"value": "Add basic clang-format integration for sublime text.\n\ngit-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@182015 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "gpt",
"value": "# This file is a minimal clang-format sublime-integration. To install:\n# - Chang... | python | chosen |
[
{
"from": "human",
"value": "Change kamerstuk id from integer to string\n\nAnything can be the id. No documentation on standards.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-05-19 20:53\nfrom __future__ import unicode_literals\n\nfrom django.db i... | python | chosen |
[
{
"from": "human",
"value": "Add code that makes many images being clear memory.\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport os\nfrom tqdm import trange\n\nos.makedirs('./images/', exist_ok=True)\n\ni = 0\nfor i in trange(10000,... | python | chosen |
[
{
"from": "human",
"value": "Add feature extraction (transfer learning) for Inception 1k model for cat/dog/mouse dataset (no training).\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nimport h2o\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add snippet to retrieve call logs from Twilio account\n"
},
{
"from": "gpt",
"value": "from twilio.rest import TwilioRestClient\nimport config\n\n# To find these visit https://www.twilio.com/user/account\naccount_sid = config.account_sid\nauth_token = config.auth_tok... | python | chosen |
[
{
"from": "human",
"value": "examples/hwapi: Add config for Zephyr port of 96Boards Carbon.\n"
},
{
"from": "gpt",
"value": "from machine import Signal\n\n# 96Boards Carbon board\n# USR1 - User controlled led, connected to PD2\n# USR2 - User controlled led, connected to PA15\n# BT - Bluetooth in... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.