conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to generate CZ bank bic codes registry\n"
},
{
"from": "gpt",
"value": "import json\nimport csv\nimport requests\n\nURL = \"https://www.cnb.cz/cs/platebni-styk/.galleries/ucty_kody_bank/download/kody_bank_CR.csv\"\n\n\nregistry = []\n\n\ndef process():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for minister_questions_combined api endpoint\n"
},
{
"from": "gpt",
"value": "import os\nfrom tests import PMGTestCase\nfrom tests.fixtures import (\n dbfixture, CommitteeQuestionData\n)\n\n\nclass TestQuestionAnswer(PMGTestCase):\n def setUp(self... | python | chosen |
[
{
"from": "human",
"value": "Add script for Taking out of strings.xml files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=utf-8\n'''\nThis script will help you take out all strings.xml(Placed in a language-region folder) from an Android projectDir\nWe now use it to provide the... | python | chosen |
[
{
"from": "human",
"value": "Add random number generation utility module.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, division\nimport numpy as np\n\n\ndef randbool(n, rng=None):\n if rng is None:\n rng = np.random\n return rng.randint(2, size=n) * 2 - 1\... | python | chosen |
[
{
"from": "human",
"value": "Move exception into common module and add unicode support\n"
},
{
"from": "gpt",
"value": "class SymbolicationError(Exception):\n message = None\n\n def __init__(self, message):\n if isinstance(message, bytes):\n message = message.decode('utf-... | python | chosen |
[
{
"from": "human",
"value": "Add example of how to use autopep8 in Vim\n\nThis example supports selecting a specific line range to format.\n"
},
{
"from": "gpt",
"value": "\"\"\"Run autopep8 on the selected buffer in Vim.\n\nmap <C-I> :pyf <path_to>/autopep8_vim.py<CR>\n\n\"\"\"\n\nimport autope... | python | chosen |
[
{
"from": "human",
"value": "Test disabling inclusion of jQuery\n"
},
{
"from": "gpt",
"value": "from django_webtest import WebTest\nfrom django.core.urlresolvers import reverse\nfrom django.test.utils import override_settings\nfrom . import factory\n\n\nclass AdminTestCase(WebTest):\n\n def ... | python | chosen |
[
{
"from": "human",
"value": "Implement Paladin cards for The Grand Tournament\n"
},
{
"from": "gpt",
"value": "from ..utils import *\n\n\n##\n# Minions\n\n# Murloc Knight\nclass AT_076:\n inspire = Summon(CONTROLLER, RandomMurloc())\n\n\n# Eadric the Pure\nclass AT_081:\n play = Buff(ALL_M... | python | chosen |
[
{
"from": "human",
"value": "Add rotate_image() that rotates image a given amount of degrees\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom wand.image import Image\n\ndef rotate_image(filename, degrees):\n \"\"\"Rotates filename degrees degrees.\"\"\"\n w... | python | chosen |
[
{
"from": "human",
"value": "Add an example test that has switching to a new tab/window\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\nSometimes tests open new tabs/windows, and you'll need\r\nto switch to them first in order to interact with them.\r\nThe starting window is window(0). Then increment... | python | chosen |
[
{
"from": "human",
"value": "Add conversion function between cuarray and np.ndarray.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport copperhead.compiler.backendtypes as ET\nimport copperhead.compiler.coretypes as T\nfrom copperhead.compiler.conversions import back_to_front_type\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test to verify that all GameTags are known\n"
},
{
"from": "gpt",
"value": "from hearthstone.enums import GameTag, Rarity\n\nimport utils\n\n\ndef test_all_tags_known():\n\t\"\"\"\n\tIterate through the card database and check that all specified GameTags\n\tare... | python | chosen |
[
{
"from": "human",
"value": "Add example for zmq streams\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport aiozmq\nimport zmq\n\n\n@asyncio.coroutine\ndef go():\n router = yield from aiozmq.create_zmq_stream(\n zmq.ROUTER,\n bind='tcp://127.0.0.1:*')\n\n addr = list(rou... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for BCEDate.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom calexicon.dates import BCEDate\n\nclass TestBCEDate(unittest.TestCase):\n\n def test_make_bce_date(self):\n bd = BCEDate(-4713, 1, 1)\n self.assertEqual(bd.julian_re... | python | chosen |
[
{
"from": "human",
"value": "Add tests for adding interval setting automatically\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom i3pystatus.core.modules import IntervalModule\n\n\nclass IntervalModuleMetaTest(unittest.TestCase):\n\n d... | python | chosen |
[
{
"from": "human",
"value": "Define UservedLoad variable and penalty factor to relax infeasibility when needed.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add an UnservedLoad component, which ensures the model is always feasible.\nThis is often useful when the model is constrained to the edge of inf... | python | chosen |
[
{
"from": "system",
"value": "Add Python 2.6 to the classifiers list\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nimport base32_crockford\n\n\npackage_data = {\n '': ['LICENSE',... | python | chosen |
[
{
"from": "human",
"value": "Add sql user creation script\n"
},
{
"from": "gpt",
"value": "import sys\nfrom brain.models.sqlobjects import User\nfrom brain.helpers.sql import session_transaction\n\n\nif len(sys.argv) not in (4, 5):\n print(\"usage: {0} <username> <rmqvhost> <ftpuser> [quota]\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for hmac utility\n\n* wqflask/tests/utility/test_hmac.py: New tests.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Test hmac utility functions\"\"\"\n\nimport unittest\nimport mock\n\nfrom utility.hmac import data_hmac\nfrom utility.hmac i... | python | chosen |
[
{
"from": "human",
"value": "[wpr-go] Add a presubmit script to run tests\n\nEventually, we would like to run webpagereplay tests on catapult continuous\nbuild bots. For the time being, we run them as a presubmit step.\n\nThis is patched from nednguyen@'s CL at http://crrev.com/2989573002#ps1.\n\nBUG=catapu... | python | chosen |
[
{
"from": "human",
"value": "Add some glue code to hash salted passwords wit PBKDF2.\n"
},
{
"from": "gpt",
"value": "# coding: utf8\n\"\"\"\n\n Securely hash and check passwords using PBKDF2.\n\n Use random salts to protect againt rainbow tables, many iterations against\n brute-force, ... | python | chosen |
[
{
"from": "human",
"value": "Revert \"haven't found a sensible way to test things\"\n\nThis reverts commit 80821d7f46e0072f9df586a14b3d69fc85c216e1.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom hbase.compat import PY26\nfrom hbase.compat import comp_bytes\n\nimport mock\n\nif... | python | chosen |
[
{
"from": "system",
"value": "Use float in session fields\n"
},
{
"from": "human",
"value": "from tyk.decorators import *\nfrom gateway import TykGateway as tyk\n\n@CustomKeyCheck\ndef MyKeyCheck(request, session, metadata, spec):\n print(\"Running MyKeyCheck?\")\n\n print(\"request:\", re... | python | chosen |
[
{
"from": "human",
"value": "[SCHEMA] Fix nullable constraints on EASUid and EASFoldersync state enum.\n\nSummary:\nThe former we tightened on Gmail at one point and didn't trickle it back\nto EAS. The latter is a bug from way back.\n\nWe really need to figure out a better deal for what to do with EAS-only\... | python | chosen |
[
{
"from": "human",
"value": "Add test of Folder instances\n"
},
{
"from": "gpt",
"value": "from unittest.mock import patch\n\nfrom osfclient.models import OSFCore\nfrom osfclient.models import File\nfrom osfclient.models import Folder\n\nfrom osfclient.tests import fake_responses\nfrom osfclient... | python | chosen |
[
{
"from": "human",
"value": "NF: Add total variation function need to access sub-voxel shifts\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef image_tv(x, fn=0, nn=3, a=0):\n \"\"\" Computes total variation (TV) of matrix x along axis a in two\n directions.\n\n Parameters\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the `no_such_file` rule\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom thefuck.rules.no_such_file import match, get_new_command\nfrom tests.utils import Command\n\n\n@pytest.mark.parametrize('command', [\n Command(script='mv foo bar/foo', stder... | python | chosen |
[
{
"from": "human",
"value": "Add analyzer for which pids are open during which tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can... | python | chosen |
[
{
"from": "human",
"value": "Add example for CSQ XML\n"
},
{
"from": "gpt",
"value": "__author__ = 'Dimitry Lvovsky'\n# Copyright 2014 ReviewRank S.A ( ReviewPro )\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with... | python | chosen |
[
{
"from": "human",
"value": "Add tests for lesson 1: greetings\n"
},
{
"from": "gpt",
"value": "# This lesson teaches you how to define a function that takes an input, and then uses\n# it to alter the output of that function.\n\n# Much like last time, run your python command in your terminal to ... | python | chosen |
[
{
"from": "human",
"value": "Add a few tests for the analytics code\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8\n\nimport pytest\n\nfrom reports import NGINX_LOG_REGEX\n\n\n@pytest.mark.parametrize('log_line', [\n # Unusual methods\n '0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] \"H... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to ease 3.7 migration\n\nChange-Id: I0fcb3a1dd3bffe719f1abfa45a328640002affa0\nReviewed-on: http://gerrit.aldebaran.lan/49630\nReviewed-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>\nTested-by: dmerejkowsky <1e4b13000fa8777df4cefd2... | python | chosen |
[
{
"from": "human",
"value": "Add benchmark script for elasticsearch\n"
},
{
"from": "gpt",
"value": "# Simple benchmark script when searching similar strings by using elasticsearch instead of SimString.\n# Since Elasticsearch uses Apache Lucene, TF/IDF based searching algorithm, the purpose for ... | python | chosen |
[
{
"from": "human",
"value": "Create setup source model test use testcase\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom django.db import IntegrityError\nfrom django.test import TestCase\n\nfrom opps.core.models.source import Source\n\n\nclass SourceModelT... | python | chosen |
[
{
"from": "human",
"value": "Add util directory and a code\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nimport os\nimport shutil\nimport cv2\n\n\ndef delete_and_make_directory(dir_path='./image_dir/'):\n\t# Delete the entire directory tree if it exists.\n\tif os.path.exists(dir_path):\n\t... | python | chosen |
[
{
"from": "human",
"value": "Add example that removes bold text\n"
},
{
"from": "gpt",
"value": "\"\"\"\nConvert strong text to normal text\n\nEXAMPLE:\n >>>> echo Lorem **ip sum** example | pandoc -F remove-strong.py\n <p>Lorem ip sum example</p>\n\"\"\"\n\nimport panflute as pf\n\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add test for address translation middleware.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests from vumi.middleware.address_translator.\"\"\"\n\nfrom twisted.trial.unittest import TestCase\n\nfrom vumi.middleware.address_translator import AddressTranslationMiddleware\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add conservative rename Python script\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nimport argparse\nimport os\nimport re\nimport shutil\n\n\ndef rename_files_in_dir(directory, live_run=False):\n if not live_run:\n print(\"Performing dry run...\")\n ... | python | chosen |
[
{
"from": "human",
"value": "Add initial implementation of ontology graph\n"
},
{
"from": "gpt",
"value": "import networkx\nfrom indra.databases import hgnc_client\nfrom indra.databases import uniprot_client\nfrom indra.databases import chebi_client\nfrom indra.databases import mesh_client\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate BBN TSV\n"
},
{
"from": "gpt",
"value": "\"\"\"This script produces a TSV that help map the BBN ontology\nto the Eidos UN ontology based on entries and examples.\"\"\"\n\nimport yaml\nimport requests\nfrom indra.sources import bbn\n\n\n\ndef bu... | python | chosen |
[
{
"from": "human",
"value": "Add a basic module and command-line tool for generating tokens\n\nSigned-off-by: R. Tyler Ballance <ae42760ef71e07cdc78c21849b44551816bda917@slide.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport getpass\nimport sys\n\nfrom optparse import Option... | python | chosen |
[
{
"from": "human",
"value": "Add is_* methods from old commit\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom .Rule import Rule\n\nclass IsMethodsRuleExtension(Rule):\n\n @cla... | python | chosen |
[
{
"from": "human",
"value": "Add URL routing to first view\n"
},
{
"from": "gpt",
"value": "from django.conf.urls import patterns, url\n\nfrom presentationsapp import views\n\nurlpatterns = patterns('',\n\t#url(r'^(?P<course_id>[0-9]+)/$', views.courseDetails),\n\turl(r'^$', views.index),\n)\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for the submit_comment task\n"
},
{
"from": "gpt",
"value": "import json\nimport mock\nimport six\n\nfrom celery.exceptions import Retry, MaxRetriesExceededError\nfrom requests.exceptions import RequestException\nfrom django.test import SimpleTestCase,... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for McCabe checker\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sys\ntry:\n from StringIO import StringIO\nexcept ImportError:\n from io import StringIO\n\nfrom mccabe import get_code_complexity\n\n\n_GLOBAL = \"\"\"\\\n\nfor i in ra... | python | chosen |
[
{
"from": "human",
"value": "Add a script to make it easier to switch between elections\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=UTF-8\n\nimport os\nfrom os.path import dirname, join, normpath, realpath\nimport sys\n\nscript_directory = dirname(realpath(sys.argv[0]))\nroo... | python | chosen |
[
{
"from": "human",
"value": "Add script to prune parameter sample files\n\nThe parameter sample files for a decent experiment take up a lot of\nspace. Because don't need all of them, we remove 90%.\n"
},
{
"from": "gpt",
"value": "import logging\nimport argparse\nfrom os import remove\n\nfrom cp... | python | chosen |
[
{
"from": "human",
"value": "emoji: Switch users with blob emoji to use Google style.\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\nfrom django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor\nfrom django.db.migrations.state import StateApps\n\n\ndef update_dep... | python | chosen |
[
{
"from": "human",
"value": "Add a script that downloads content hashes\n"
},
{
"from": "gpt",
"value": "import argparse\nimport csv\nimport hashlib\n\nimport elasticsearch\nfrom elasticsearch_dsl import Search\nimport tqdm\nfrom w3lib.url import canonicalize_url\n\n\ndef main():\n parser = a... | python | chosen |
[
{
"from": "human",
"value": "Add aura compile testing by default to likely areas (2).\n\nBUG=chromium:107599\nTEST=None\n\nReview URL: http://codereview.chromium.org/8907045\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@114850 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Add module to create initial tables\n"
},
{
"from": "gpt",
"value": "from tables import engine\n\ndef create_tables():\n \"\"\"\n Create tables the lazy way... with raw SQL.\n \"\"\"\n conn = engine.raw_connection()\n cur = conn.cursor()\n cur.execu... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate GN/MSVS projects.\n\nBUG=angleproject:1569\n\nChange-Id: I0e47720d17cd1a29603e471482cac31d4c281ee5\nReviewed-on: https://chromium-review.googlesource.com/735059\nReviewed-by: Geoff Lang <b6fc25fe0362055230985c05cbfa8adb741ccc0f@chromium.org>\nCommit-Queue:... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove all EXIF data from an image\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\n# sudo pip3 install piexif\nimport piexif\n\nif len(sys.argv) < 2:\n sys.stderr.write('ERROR: Must provide a file to remove EXIF tags from\\n')... | python | chosen |
[
{
"from": "human",
"value": "Add rule on sexist language\n\n#51\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"MAU103: Sexism.\n\n---\nlayout: post\nerror_code: MAU103\nsource: Garner's Modern American Usage\nsource_url: http://amzn.to/15wF76r\ntitle: sexism\ndate: ... | python | chosen |
[
{
"from": "human",
"value": "Add script that deletes previously installed kernels\n\nOnly the bootloader needs to be manually adjusted afterwards.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport logging\nimport re\nimport os\nimport shutil\n\nlogger = logging.getLogger(__name__)... | python | chosen |
[
{
"from": "human",
"value": "Add example for handling keyboard interrupt\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nexamples.kb_interrupt_handler\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nHandling keyboard interrupt (control+c) with\ntry-except block.\n\"\"\"\n\nimport random\ni... | python | chosen |
[
{
"from": "human",
"value": "Add tests for recently added features\n\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nfrom jsonrpcclient.http_client import HTTPClient\n\n\ndef test_call_with_named_args(live_server):\n\n c = HTTPClient(live_server.url + '/all-rpc/')\n\n result = c.divide... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating mod test cases\n\nThis commit only adds the boilerplate, no actual tests are added.\n\nSigned-off-by: Janos Follath <b175c17abe0474719672be1367bb75ee28bd5c71@arm.com>\n"
},
{
"from": "gpt",
"value": "\"\"\"Framework classes for generation of... | python | chosen |
[
{
"from": "system",
"value": "Use Popen which is available on RHEL6, but do check exit code\n"
},
{
"from": "human",
"value": "#\n# Usage: {{ foo | vault }}\n#\n\ndef vault(encrypted, env):\n method = \"\"\"\nfrom keyczar import keyczar\nimport os.path\nimport sys\nkeydir = '.vault'\nif not os.... | python | chosen |
[
{
"from": "human",
"value": "Add SQL migration for usercache\n\nWorking on #670\n"
},
{
"from": "gpt",
"value": "\"\"\"Add table usercache\n\nRevision ID: d6b40a745e5\nRevises: 1edda52b619f\nCreate Date: 2017-04-13 15:25:44.050719\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision =... | python | chosen |
[
{
"from": "human",
"value": "Read in RPPA medians and stds\n"
},
{
"from": "gpt",
"value": "import pandas\nfrom collections import defaultdict\n\nrppa_file = 'data/TableS1-Split.xlsx'\n\ncell_lines = ['C32', 'COLO858', 'K2', 'LOXIMVI', 'MMACSF', 'MZ7MEL',\n 'RVH421', 'SKMEL28', 'WM1... | python | chosen |
[
{
"from": "human",
"value": "Add placeholder for adding type hinting using the new syntax in Python.\n"
},
{
"from": "gpt",
"value": "# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE. For\n# more information on... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for rocket.chat notifications\n\nSigned-off-by: Jeandre Le Roux <5c0729d9afb0a0db4c3e6949c77c15e4446fbca3@theblazehen.com>\n"
},
{
"from": "gpt",
"value": "import mock\nimport pytest\nfrom django.core.mail.message import EmailMessage\n\nimport awx.main.... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for bridgedb.Storage\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Unittests for the :mod:`bridgedb.Storage` module.\"\"\"\n\nfrom twisted.python import log\nfrom twisted.trial import unittest\nimport bridgedb.Storage as Storage\nfrom t... | python | chosen |
[
{
"from": "human",
"value": "Remove unique requirement for study group applications\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 ... | python | chosen |
[
{
"from": "human",
"value": "tests: Add testcase for multiple inheritance.\n"
},
{
"from": "gpt",
"value": "class A:\n def __init__(self, x):\n print('A init', x)\n self.x = x\n\n def f(self):\n print(self.x)\n\n def f2(self):\n print(self.x)\n\nclass B:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example of using gradient.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015-2018 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"\nGradient\n========\n\nUse `metpy.calc.gradient`.\... | python | chosen |
[
{
"from": "human",
"value": "Add Slack notifier supporting buildset summaries\n"
},
{
"from": "gpt",
"value": "import json\nfrom twisted.internet import defer\nfrom twisted.python import log\n\nfrom buildbot.process.results import CANCELLED, EXCEPTION, FAILURE, SUCCESS, WARNINGS\nfrom buildbot.r... | python | chosen |
[
{
"from": "human",
"value": "Implement the connection limit module\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass ConnectionLimit(ModuleData):\n implements(IPlugin... | python | chosen |
[
{
"from": "human",
"value": "Add some python tests of the type pattern matching\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\nfrom dynd import nd, ndt\n\nclass TestTypePatternMatch(unittest.TestCase):\n def test_simple(self):\n self.assertTrue(ndt.int32.matches(ndt.int3... | python | chosen |
[
{
"from": "human",
"value": "Add matplotlib plot -> numpy image util\n"
},
{
"from": "gpt",
"value": "import io\nimport numpy as np\nfrom PIL import Image\n\ndef matplotlib_to_numpy(plt):\n \"\"\"Convert a matplotlib plot to a numpy array represent it as an image.\n\n Inputs:\n plot - matpl... | python | chosen |
[
{
"from": "human",
"value": "Add initial picoPulse to devices\n"
},
{
"from": "gpt",
"value": "##############################################################################\n#\n# For EFD PICO Touch/Pulse controller and jetter\n#\n#################################################################... | python | chosen |
[
{
"from": "human",
"value": "Add routine to make the parse tree ammenable\n"
},
{
"from": "gpt",
"value": "import parser\nimport token\nimport symbol\n\nimport sys\nfrom pprint import pprint\n\ntree = parser.st2tuple(parser.suite(sys.argv[1]))\n\ndef convert_readable(tree):\n return tuple(((t... | python | chosen |
[
{
"from": "human",
"value": "Add management command which unlocks all lockout commands\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\n\nfrom django_auth_policy.models import LoginAttempt\n\n\nclass Command(Bas... | python | chosen |
[
{
"from": "human",
"value": "Add tests for responsive context_processors\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.test import TestCase\nfrom django.test.client import RequestFactory\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add a mechanism for deprecating things\n"
},
{
"from": "gpt",
"value": "import warnings\n\n\nclass ARCUtilsDeprecationWarning(DeprecationWarning):\n\n @classmethod\n def warn(cls, message, stacklevel=2):\n warnings.warn(message, cls, stacklevel)\n\n\nwar... | python | chosen |
[
{
"from": "human",
"value": "Add Python code for making symlinks for PyQt4 and SIP into a virtualenv\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nfrom builtins import FileExistsError\n\ntry:\n venv = os.environ['VIRTUAL_ENV']\nexcept KeyError:\n print('V... | python | chosen |
[
{
"from": "human",
"value": "Add basic python packaing info.\n"
},
{
"from": "gpt",
"value": "from setuptools import setup, find_packages\n\n\nwith open('README.md', 'r') as f:\n README = f.read()\n\n\nsetup(name='apigpio',\n version='0.0.1',\n description='asyncio-based python clie... | python | chosen |
[
{
"from": "human",
"value": "Print total byte count from db\n"
},
{
"from": "gpt",
"value": "import re\nimport sqlite3\n\ndef open_cloudfront_log_db():\n db = sqlite3.connect('cf.db')\n return db\n\ndef format_size(sz):\n abbrevs = (\n (1<<50, 'PB'),\n (1<<40, 'TB'),\n ... | python | chosen |
[
{
"from": "human",
"value": "Include initial option parser framework"
},
{
"from": "gpt",
"value": "\"\"\"\r\nThe GLEAM REsidual Source IDentifier program\r\n\r\nCreated by:\r\nRobin Cook\r\nMarch 24 2016\r\n\r\nModifications by:\r\nRobin Cook\r\n\"\"\"\r\n\r\n# Imports\r\nimport sys\r\nimport o... | python | chosen |
[
{
"from": "human",
"value": "Add context processor for adding in data from the django settings file\n"
},
{
"from": "gpt",
"value": "from django.conf import settings as sett\n\ndef settings(request):\n\n my_dict = {\n 'SB_ROOT': sett.SB_ROOT,\n 'SITE_URL': sett.SITE_URL,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for prompt system.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for prompt generation.\"\"\"\n\nimport unittest\n\nimport nose.tools as nt\n\nfrom IPython.testing import tools as tt, decorators as dec\nfrom IPython.core.prompts import PromptManager\nfrom IP... | python | chosen |
[
{
"from": "human",
"value": "Add exercise 3 checking code\n"
},
{
"from": "gpt",
"value": "from learntools.core import *\nimport tensorflow as tf\n\nclass Q1(CodingProblem):\n _vars = ['image_condense', 'image_detect', 'image_filter', 'image']\n _hint = \"\"\n _solution = CS(\"\"\"\nima... | python | chosen |
[
{
"from": "human",
"value": "Add a basic rollback accumlator test.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Li... | python | chosen |
[
{
"from": "human",
"value": "Add migration for terms column\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import Boolean, Column, MetaData, Table\n\n\nmeta = MetaData()\n\n\ndef upgrade(migrate_engine):\n meta.bind = migrate_engine\n account = Table('account', meta, autoload=True)\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Test for series configure loading alternate name\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, division, absolute_import\nfrom tests import FlexGetBase\n\n#todo: merge into test_series\n\ndef age_series(**kwargs):\n from flexget.plugins... | python | chosen |
[
{
"from": "human",
"value": "Add requests test. But now skipping.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n Add comment here\n ~~~~~~~~~~~~~~~~\n\n Add descripton here\n\n\n :copyright: (c) 2014 Shinya Ohyanagi, All rights reserved.\n :license: BSD, see LI... | python | chosen |
[
{
"from": "system",
"value": "Correct category lookup on url kwarg to use case insensitive.\n"
},
{
"from": "human",
"value": "from django.views.generic import DetailView, ListView\nfrom django.shortcuts import get_object_or_404\nfrom cjdata.models import Dataset, Category\nfrom cjdata.search.qu... | python | chosen |
[
{
"from": "human",
"value": "Add job to display fortunes.\n"
},
{
"from": "gpt",
"value": "import subprocess\nfrom pijobs.scrolljob import SrollJob\n\nclass FortuneJob(ScrollJob):\n def message(self):\n return self.run_cmd('fortune')\n\n def run_cmd(cmd):\n p = subprocess.Pop... | python | chosen |
[
{
"from": "human",
"value": "Add migration for ordering update\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('builds', '0002_auto_... | python | chosen |
[
{
"from": "human",
"value": "Add a convenient function to plot filter\n"
},
{
"from": "gpt",
"value": "from pathlib import Path\n\nfrom keras.applications import VGG16\nfrom keras.models import Model\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.axes_grid1 import AxesGrid\n\nfrom tools.dat... | python | chosen |
[
{
"from": "system",
"value": "Update oracle module for UTF-8\n\n\ngit-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@99 dda364a1-ef19-0410-af65-756c83048fb2\n"
},
{
"from": "human",
"value": "\n\nimport urllib\n\ndef command_oraakkeli(bot, user, channel, args):\n \"\"\"Asks a question from ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 479. Largest Palindrome Product\n\n479. Largest Palindrome Product: https://leetcode.com/problems/largest-palindrome-product/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def largestPalindrome(self, n):\n \"\"\"\n :t... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 455. Assign Cookies\n\n455. Assign Cookies: https://leetcode.com/problems/assign-cookies/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def findContentChildren(self, children, s):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Check if data has nodata mask\n"
},
{
"from": "gpt",
"value": "\n\n\nclass Worker(object):\n\n def __init__(self):\n self.finished = False\n\n\nclass GridProcessor(Worker):\n\n def __init__(self):\n self.pid = os.getpid()\n self.age = None\... | python | chosen |
[
{
"from": "human",
"value": "Add test of smoothing module\n"
},
{
"from": "gpt",
"value": "# ######################################################################\n# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #\n# National Laboratory. All rights reserved. ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for heap sort implementation.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport unittest\n\nfrom helper.read_data_file import read_int_array\nfrom sorting.heap_sort import sort\n\n\nBASE_DIR = os.path.d... | python | chosen |
[
{
"from": "human",
"value": "Implement test class for Array and GroupedArrays\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom typhon.spareice import Array, GroupedArrays\nimport xarray as xr\n\n\nclass TestArray:\n \"\"\"Testing the array methods.\"\"\"\n pass\n\n\nclass TestGrou... | python | chosen |
[
{
"from": "human",
"value": "Add test for morph analysis\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport pytest\nimport numpy\nfrom spacy.attrs import IS_ALPHA, IS_DIGIT, IS_LOWER, IS_PUNCT, IS_TITLE, IS_STOP\nfrom spacy.symbols import VERB\nfr... | python | chosen |
[
{
"from": "human",
"value": "tests: Create clientagent unittest file, with test for CLIENT_HELLO behavior.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\nimport unittest\nfrom socket import *\n\nfrom common import *\nfrom testdc import *\n\nCONFIG = \"\"\"\\\nmessagedirector:\n bind... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.