conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to call gene-ranks command after samples load\n\nThis will need to be added as a cron job like the recalculate_allele_frequencies script is used now.\n"
},
{
"from": "gpt",
"value": "import django_rq\nimport logging\nimport os\nimport time\n\nos.environ.se... | python | chosen |
[
{
"from": "human",
"value": "Add new settings support for apache\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis module graps a configured database from \n\"\"\"\n\nimport os\n\nfrom collections import defaultdict\n\nDB_ENGINES = {\n 'SQLITE': 'django.db.backends.sqlite3',\n 'MYSQL': 'django... | python | chosen |
[
{
"from": "human",
"value": "Add the Simple InveCalculator Alog for Earnning by days!\n"
},
{
"from": "gpt",
"value": "import datetime,time;\n\nyear=2015\nmonth=6\nday=22\ninvsDays=64\ninvsRatio=0.096\ninvsFund = 2000\n\narrInvsPayBack = []\n\n#array arrInvsPayPlan={}\n\ninvsDate = datetime.date... | python | chosen |
[
{
"from": "human",
"value": "Add tests for send_mail job\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf8 -*-\n# This file is part of PyBossa.\n#\n# Copyright (C) 2014 SF Isle of Man Limited\n#\n# PyBossa is free software: you can redistribute it and/or modify\n# it under the terms of the GNU... | python | chosen |
[
{
"from": "human",
"value": "Fix destination finder test to actually produce results\n"
},
{
"from": "gpt",
"value": "import unittest\nimport datetime\nimport json\nimport sys\n\nsys.path.append('..')\nimport sabre_dev_studio\nimport sabre_dev_studio.sabre_exceptions as sabre_exceptions\n\n'''\n... | python | chosen |
[
{
"from": "human",
"value": "Add a small kiwi list example\n"
},
{
"from": "gpt",
"value": "import gtk\n\nfrom kiwi.ui.widgets.list import Column, List, SequentialColumn\n\nclass Person:\n \"\"\"The parameters need to be of the same name of the column headers\"\"\"\n def __init__(self, nam... | python | chosen |
[
{
"from": "human",
"value": "Add example for listing directory\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport ampdclient\n\n\nMPD_HOST = '192.168.1.5'\nMPD_PORT = 6600\n\n\ndef onchange(message):\n print('Message received ' + str(message))\n\n\n@asyncio.coroutine\ndef start():\n m... | python | chosen |
[
{
"from": "human",
"value": "tests: Add tests for process/thread pool executors\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport concurrent.futures\n\nfrom uvloop import _testbase as tb\n\n\ndef fib(n):\n if n < 2:\n return 1\n return fib(n - 2) + fib(n - 1)\n\n\nclass _TestE... | python | chosen |
[
{
"from": "human",
"value": "Add a simple transform helper class.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDataTransformer\n\n:Authors:\n\tBerend Klein Haneveld\n\"\"\"\n\nfrom vtk import vtkImageReslice\n\n\nclass DataTransformer(object):\n\t\"\"\"DataTransformer is a class that can transform a... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot temperatures\n"
},
{
"from": "gpt",
"value": "import datetime\nimport matplotlib.pyplot as pyplot\nimport os\nimport re\nimport sys\n\n\ndef main():\n \"\"\"Main.\"\"\"\n if sys.version_info.major <= 2:\n print('Use Python 3')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests for common user operations\n"
},
{
"from": "gpt",
"value": "import unittest\nimport user\nfrom users import UserDatabase\n\nclass FakeDatabaseSession:\n def __init__(self):\n self.didCommit = False\n self.things = [ ]\n def com... | python | chosen |
[
{
"from": "human",
"value": "Add super simple test case\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ImproperlyConfigured\n\nfrom django_mailgun import MailgunBackend\nfrom pytest import raises\n\n\ndef test_configuration():\n with raises(ImproperlyConfigured):\n ... | python | chosen |
[
{
"from": "system",
"value": "Update the PyPI version to 0.2.5.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n retu... | python | chosen |
[
{
"from": "system",
"value": "Append HISTORY to long description on PyPI\n"
},
{
"from": "human",
"value": "from setuptools import setup\n\nsetup(\n name='tox-travis',\n description='Seamless integration of Tox into Travis CI',\n long_description=open('README.rst', 'rb').read().decode('... | python | chosen |
[
{
"from": "human",
"value": "Add tests for dataset class.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport theanets\n\n\nclass TestDataset:\n def setUp(self):\n self.dataset = theanets.dataset.Dataset(\n np.arange(101)[:, None],\n label='foo',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a helper script to deskew and unpaper scanned pages\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# This script walks through all files under the current directory,\n# looking for those called page-001.png, page-002.png, etc. (If a\n# version called ... | python | chosen |
[
{
"from": "human",
"value": "Add test of read-only mode for key-value DB storages.\n\nSigned-off-by: Sergey Shilov <064bbdfaeb89a0bebebfe7b388747a73c8941704@dsr-company.com>\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom storage.kv_store_leveldb import KeyValueStorageLeveldb\nfrom storage.... | python | chosen |
[
{
"from": "human",
"value": "Add example of connecting plugins to CollectionViewer\n"
},
{
"from": "gpt",
"value": "\"\"\"\n=================\nCollection plugin\n=================\n\nDemo of a CollectionViewer for viewing collections of images with the\n`autolevel` rank filter connected as a plu... | python | chosen |
[
{
"from": "human",
"value": "Add word2vec binary to txt format converter\n"
},
{
"from": "gpt",
"value": "import argparse\nimport logging\n\nfrom gensim.models import Word2Vec\n\nlogging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)\n\nif __name__ == \"__mai... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for GodScheduler\n"
},
{
"from": "gpt",
"value": "# Copyright 2011-2013 Colin Scott\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 a copy of... | python | chosen |
[
{
"from": "human",
"value": "Add an example script that turns all PNGs upside down.\n"
},
{
"from": "gpt",
"value": "import Image, cStringIO\ndef response(context, flow):\n if flow.response.headers[\"content-type\"] == [\"image/png\"]:\n s = cStringIO.StringIO(flow.response.content)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for core graph functions\n"
},
{
"from": "gpt",
"value": "from graffiti import core\nfrom graffiti import util\n\ndef test_schema():\n assert \"fn\" in core.schema(1)\n\n fn = lambda x: 1\n assert core.schema(fn) == util.fninfo(fn)\n\n def t():\... | python | chosen |
[
{
"from": "human",
"value": "Add test methods for api end point methods\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom flask import current_app, request, abort, jsonify, g, url_for\n\nfrom api.api import *\nfrom api.models import User\n\n\nclass TestApi(unittest.TestCase):\n\n def set... | python | chosen |
[
{
"from": "human",
"value": "Add basic low level HTTP get tests.\n"
},
{
"from": "gpt",
"value": "import mock\nimport unittest\nfrom testrail.api import API\nfrom testrail.helper import TestRailError\nimport copy\nimport ast\n\n\nclass TestHTTPMethod(unittest.TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add python script for testing with.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys, socket, time\n\ns = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n\nif len(sys.argv) > 1:\n interval = float(eval(sys.argv[1]))\nelse:\n interval = 1.0... | python | chosen |
[
{
"from": "human",
"value": "Add script to process log outputs and do Mean Value Analysis (MVA).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport sys\nimport collections\n\nsums = collections.defaultdict(lambda: 0)\nlens = collections.defaultdict(lambda: 0)\n\ndef mva(n_a, s_lb, s_a... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton of python script to process multiple images.\n"
},
{
"from": "gpt",
"value": "import os\nfrom subprocess import call\n\ninputpath = 'originals'\noutputpath = 'segmentations'\n\nfor filename in os.listdir(inputpath):\n current = os.path.join(inputpath,... | python | chosen |
[
{
"from": "human",
"value": "tests: Add testcase for open(..., \"a\").\n"
},
{
"from": "gpt",
"value": "import sys\ntry:\n import _os as os\nexcept ImportError:\n import os\n\nif not hasattr(os, \"unlink\"):\n print(\"SKIP\")\n sys.exit()\n\ntry:\n os.unlink(\"testfile\")\nexcept ... | python | chosen |
[
{
"from": "human",
"value": "Update Resource migrations to reflect model changes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.5 on 2017-11-21 23:04\nfrom __future__ import unicode_literals\n\nimport django.contrib.postgres.fields\nfrom django.db import mig... | python | chosen |
[
{
"from": "human",
"value": "Add test on extract urls method\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom .test_bot import TestBot\n\n\nclass TestBotSupport(TestBot):\n\n @pytest.mark.parametrize('url,result', [\n ('https://google.com', ['https://google.com']),\n ('goo... | python | chosen |
[
{
"from": "human",
"value": "Add tests to mako engine.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport unittest\n\n\nimport engines\n\n\nHANDLE = 'mako'\n\n\nclass TestStringTemplate(unittest.TestCase):\n\n def setUp(self):\n tr... | python | chosen |
[
{
"from": "human",
"value": "Add high level tests for public key encryption\n"
},
{
"from": "gpt",
"value": "# Import libnacl libs\nimport libnacl.public\n\n# Import python libs\nimport unittest\n\nclass TestPublic(unittest.TestCase):\n '''\n '''\n def test_secretkey(self):\n '''... | python | chosen |
[
{
"from": "human",
"value": "Add script to find none ASCII char in file.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\nimport string\nimport sys\nimport io\n\nasciichars = string.whitespace + string.ascii_letters + string.digits + string.punctuation\n\nreset = '\\x1b[0m'\ntxt_black_bold =... | python | chosen |
[
{
"from": "human",
"value": "Add helper script to create virtualizer diff\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Copyright 2017 Janos Czentye <czentye@tmit.bme.hu>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in co... | python | chosen |
[
{
"from": "human",
"value": "Add ini file parser and fill up backup commands\n"
},
{
"from": "gpt",
"value": "import ConfigParser\n\nfrom mikrotik_device import MtDevice\n\n\nclass Config(object):\n\n def __init__(self):\n self.config = ConfigParser.ConfigParser()\n self.config.... | python | chosen |
[
{
"from": "human",
"value": "Add initial unit test for inspectlib.collector.Inspector\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Bo Maryniuk <bo@suse.de>`\n'''\n# Import Python Libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing Libs... | python | chosen |
[
{
"from": "human",
"value": "Add equivalent put/get test in python.\n"
},
{
"from": "gpt",
"value": "from multiprocessing import Process, Queue\n\nq = Queue()\n\niterations = 10000000\n\ndef produce(q):\n for i in range(iterations):\n q.put(i)\n \nif __name__ == \"__main__\":\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test helpers! Yes, we've gotten this deep into it.\n"
},
{
"from": "gpt",
"value": "from django.contrib.sessions.middleware import SessionMiddleware\n\n\ndef add_session_to_request(request):\n # Annotate a request object with a session.\n middleware = Sessi... | python | chosen |
[
{
"from": "human",
"value": "Test for default semantic action\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#######################################################################\n# Name: test_default_semantic_action\n# Purpose: Default semantic action is applied during semantic ana... | python | chosen |
[
{
"from": "human",
"value": "Set default explore group configuration for a user\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Set the group configuration in explore.\n#\n\nimport os\nimport sys\nsys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))... | python | chosen |
[
{
"from": "human",
"value": "Add autoruns.list integration test for Windows\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Import Python libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing libs\nfrom tests.support.case import ModuleCase\nfrom tests.support.unit i... | python | chosen |
[
{
"from": "human",
"value": "Add our own check_output2 wrapper\n\nSigned-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport subprocess\n\ndef check_output2(args, stdin=None):\n p = subproce... | python | chosen |
[
{
"from": "human",
"value": "Add script for appending entries to .gitignore.\n\nTBR=kjellander\n\nReview URL: https://webrtc-codereview.appspot.com/1629004\n\nCr-Mirrored-From: https://chromium.googlesource.com/external/webrtc\nCr-Mirrored-Commit: b69cc15467456a070333ff00f886f27ca391b85b\n"
},
{
"fr... | python | chosen |
[
{
"from": "human",
"value": "Add script to sort out counties as constituency parent places.\n"
},
{
"from": "gpt",
"value": "# Takes Paul's Excel file of constituencies to counties and\n# imports this into the db.\n\nimport sys\nimport os\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'mzalendo.setti... | python | chosen |
[
{
"from": "human",
"value": "[Snippets] Add script for cmap subtable format conversion\n\nFixes https://github.com/behdad/fonttools/issues/340\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\n# Sample script to convert legacy cmap subtables to format-4\n# subtables. Note that this is ... | python | chosen |
[
{
"from": "human",
"value": "recipe-server: Add another signature reset migration.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nRemoves signatures, so they can be easily recreated during deployment.\n\nThis migration is intended to be used between \"eras\" of signatures. As\nthe serialization format... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests around InputObject\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom polygraph.exceptions import PolygraphSchemaError\nfrom polygraph.types.input_object import (\n InputObject,\n InputValue,\n validate_input_object_schema,... | python | chosen |
[
{
"from": "human",
"value": "Test case que pase por threading\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom pydatajson.threading_helper import apply_threading\n\n\nclass ThreadingTests(TestCase):\n\n def test_threading(self):\n elements = [1, 2, 3, 4]\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for mesos\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport requests\n\nimport utils\n\n\ndef setup_module(module):\n utils.invoke('install', 'mesos')\n\n\n@utils.vagranttest\ndef test_salt_formulas():\n project = utils.get_test_project()... | python | chosen |
[
{
"from": "human",
"value": "Add multivm archive download script for buildbot use.\n\nBUG=\nR=ricow@google.com\n\nReview URL: https://codereview.chromium.org//291153010\n\ngit-svn-id: c93d8a2297af3b929165606efe145742a534bc71@36513 260f80e4-7a28-3924-810f-c04153c831b5\n"
},
{
"from": "gpt",
"valu... | python | chosen |
[
{
"from": "human",
"value": "Add output folder creation script\n"
},
{
"from": "gpt",
"value": "import logging\nimport os\n\nfrom settings import CONVERSIONS, LOGGING_FORMAT, OUTPUT_PATH\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef main():\n\t\"\"\"\n\tCreate the output folder for each of ... | python | chosen |
[
{
"from": "human",
"value": "Debug: Add test to measure time taken for level.generateLights\n"
},
{
"from": "gpt",
"value": "import mclevel\nfrom timeit import timeit\n\n#import logging\n#logging.basicConfig(level=logging.INFO)\n\npath = \"testfiles\\\\AnvilWorld\"\nworld = mclevel.fromFile(path... | python | chosen |
[
{
"from": "human",
"value": "Add barebones visualization of loss\n"
},
{
"from": "gpt",
"value": "import seaborn as sns\nfrom .utils import get_path\n\n\nclass Visualizer(object):\n \"\"\"\n Visualize training and validation loss\n \"\"\"\n @classmethod\n def visualize_training(cl... | python | chosen |
[
{
"from": "human",
"value": "Use to make close loop test on single axis\n"
},
{
"from": "gpt",
"value": "from SimpleCV import *\nimport time\nimport serial\ncam = JpegStreamCamera('http://192.168.1.6:8080/videofeed')\ndisp=Display()\n\nser=serial.Serial('/dev/ttyACM2', 9600)\nalpha = 0.8\ntime.s... | python | chosen |
[
{
"from": "human",
"value": "Add tests for compat module\n"
},
{
"from": "gpt",
"value": "from auth_tkt import compat\nfrom unittest import TestCase\n\n\nclass Base64DecodeTestCase(TestCase):\n\n def test_returns_decoded_string(self):\n self.assertEqual(\n compat.base64decod... | python | chosen |
[
{
"from": "human",
"value": "Add a blank line stripping transform\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTornado Output Transforming Classes\n\n\"\"\"\nfrom tornado import web\n\n\nclass StripBlankLines(web.OutputTransform):\n\n def transform_first_chunk(self, status_code, headers, chunk, f... | python | chosen |
[
{
"from": "human",
"value": "Add class hierarchy w multiple inheritance\n"
},
{
"from": "gpt",
"value": "\n\nSIZES = {'small', 'medium', 'insanely massive'}\n\n\nclass PhysicalThing(object):\n \"\"\" Base class for physical object\n \"\"\"\n def __init__(self, *args, **kwargs):\n \"\"\" Va... | python | chosen |
[
{
"from": "human",
"value": "[RM-11742] Add argparse tests for ceph-deploy calamari\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom ceph_deploy.cli import get_parser\n\n\nclass TestParserCalamari(object)... | python | chosen |
[
{
"from": "system",
"value": "Add Apache 2.0 license to source file\n\nAs per OpenStack licensing guide lines [1]:\n[H102 H103] Newly contributed Source Code should be licensed under\nthe Apache 2.0 license.\n[H104] Files with no code shouldn't contain any license header nor\ncomments, and must be left comp... | python | chosen |
[
{
"from": "system",
"value": "Make sure .inv file gets installed"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\ndef get_package_data():\n # Install the theme files\n return {\n 'astropy_helpers.sphinx': [\n 'ext/templat... | python | chosen |
[
{
"from": "human",
"value": "Implement blueprints on stock indicators"
},
{
"from": "gpt",
"value": "#!flask/bin/python\nfrom flask import Blueprint, jsonify\n\napi_si = Blueprint('api_si', __name__)\n\n@api_si.route(\"/stock_indicators\")\ndef get_stock_indicators():\n return jsonify(stock_i... | python | chosen |
[
{
"from": "system",
"value": "Address review comment: More useful help output.\n"
},
{
"from": "human",
"value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"The command-line ``flocker-volume`` tool.\"\"\"\n\nimport sys\n\nfrom twisted.python.usage import Options\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add MongoObjectImageData shourt to handle specific cases when you need to download image and assign its local path to some field of object stored in the mongo database\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom .base import Data\nfrom grab.tools.files import ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for domino\n\nChange-Id: Ie6671080a3d38a17da0ee608a362605a6d9df9db\nSigned-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright (c) 2017 Orange and others.\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script that exports email sequences stats\n"
},
{
"from": "gpt",
"value": "import argparse\nimport csv\n\nimport gevent.monkey\n\ngevent.monkey.patch_all()\nfrom closeio_api import Client as CloseIO_API\nfrom gevent.pool import Pool\n\nparser = argparse.Argumen... | python | chosen |
[
{
"from": "human",
"value": "Add a linear sample for mnist in python.\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nfrom tensorflow.examples.tutorials.mnist import input_data\n\nmnist = input_data.read_data_sets(\"data/\", one_hot=True)\n\nimage_dim = 28 * 28\nlabel_count = 10\ngraph... | python | chosen |
[
{
"from": "human",
"value": "[nototools] Add script to drop hints.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# Copyright 2014 Google Inc. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance wi... | python | chosen |
[
{
"from": "human",
"value": "Add the abstract class _Hook\n\nRelated to #2\nShould be used by the panel to handle events and spread it through the\nwidgets.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\nimport logging\nimport threading\n\n\nlogger = logging.getLogger(\"barython\")... | python | chosen |
[
{
"from": "human",
"value": "Print more stock stuff in small space.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport ystockquote as y\n\nx = 'SYK'\na = y.get_all(x)\n\n# 'fifty_two_week_low', 'fifty_day_moving_avg', 'price', 'price_book_ratio', 'volume', 'market_cap', 'dividend_yie... | python | chosen |
[
{
"from": "human",
"value": "Test typechecking for an output stream\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\n\nfrom chainer import testing\nfrom chainer.training import extensions\n\n\nclass TestPrintReport(unittest.TestCase):\n\n def test_stream_typecheck(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for rating choices modification\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-06-15 02:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migration... | python | chosen |
[
{
"from": "human",
"value": "Add script for turning lines of JSON-LD records into chunked datasets\n\nThis creates a bunch of \"reasonably sized\" JSON-LD dataset files with a\ngiven count of named graphs.\n\nIt also fixes some things for BlazeGraph to be able to parse the data.\n"
},
{
"from": "gpt... | python | chosen |
[
{
"from": "human",
"value": "Split CACD2000 dataset into one directory per identity"
},
{
"from": "gpt",
"value": "import shutil\nimport argparse\nimport os\nimport sys\n\ndef main(args):\n src_path_exp = os.path.expanduser(args.src_path)\n dst_path_exp = os.path.expanduser(args.dst_path)\... | python | chosen |
[
{
"from": "human",
"value": "Drop api_key_id column from broadcast_message table\n\nThis column has been superseded by a new column named\ncreated_by_api_key_id.\n\nAlso create constraint checking that we know who created broadcast\n\nAlso move data so that constraint is met before instatiating it.\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate test mongo data\n"
},
{
"from": "gpt",
"value": "import bson.json_util\nfrom bson.objectid import ObjectId\nimport itertools\nimport random\nimport string\nimport sys\n\n\ndef emit_node(name):\n oid = ObjectId()\n\n print bson.json_util.d... | python | chosen |
[
{
"from": "human",
"value": "Add script to create overlay on individual plots for senescence\n"
},
{
"from": "gpt",
"value": "# Generate overlay corresponding to 2nd PCA component\n# which serves as a proxy for senescence\n\nimport csv\n\nfrom collections import defaultdict\n\nimport dtoolcore\n... | python | chosen |
[
{
"from": "human",
"value": "Test equality and hashing of neutral elements\n\nWith the implementation of the scalar algebra it turns out that the way\nto go is to have only the scalar Zero and One equal to 0 and 1. In every\nother algebra, the neutral elements have no relation to the scalar 0 and\n1, or to ... | python | chosen |
[
{
"from": "human",
"value": "Test for audit txn sending\n\nSigned-off-by: ArtObr <24870ba6726087be7be3af8a7040487294fd73a9@gmail.com>\n"
},
{
"from": "gpt",
"value": "import json\nimport time\nimport pytest\n\nfrom plenum.test.helper import sdk_get_and_check_replies\nfrom plenum.test.pool_transa... | python | chosen |
[
{
"from": "human",
"value": "Add brian's sms import scripts + test data\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\nsms-recovery.py\n\nCreated by Brian DeRenzi on 2010-04-27.\nCopyright (c) 2010 __MyCompanyName__. All rights reserved.\n\"\"\"\n\nimport sys\... | python | chosen |
[
{
"from": "system",
"value": "Use empty message instead None.\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom django.core import mail\n\nfrom oscar.core.compat import get_user_model\nfrom oscar.apps.customer.utils import Dispatcher\nfrom oscar.apps.customer.models impor... | python | chosen |
[
{
"from": "human",
"value": "Work around site_persistence fragility. Replace a couple names\nas delete and recreate on these fails due to FK constraints\n"
},
{
"from": "gpt",
"value": "from alembic import op\nimport sqlalchemy as sa\n\n\n\"\"\"empty message\n\nRevision ID: d0b40bc8d7e6\nRevise... | python | chosen |
[
{
"from": "human",
"value": "Write migration for API keys\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef migrate_keys(apps, schema_editor):\n Token = apps.get_model(\"authtoken\", \"Token\")\n A... | python | chosen |
[
{
"from": "human",
"value": "Add tests to magicbot example\n"
},
{
"from": "gpt",
"value": "'''\n This test module imports tests that come with pyfrc, and can be used\n to test basic functionality of just about any robot.\n'''\n\nfrom pyfrc.tests import *\nfrom magicbot.magicbot_tests impo... | python | chosen |
[
{
"from": "human",
"value": "Add Django testcase to load QUnit test suite and assert there are no failures.\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom django.conf import settings\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\nfrom django.test.utils import overr... | python | chosen |
[
{
"from": "human",
"value": "Add script to check finished jobs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport os\n\ndef find_rms_dirs(dirpath):\n dirs = [x for x in os.walk(dirpath)];\n for i in range(len(dirs)):\n if any('rms' in x for x in dirs[i][1]):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add main module for solving CIFAR-10 classification problem\n"
},
{
"from": "gpt",
"value": "import cProfile\nimport data_loader\nimport data_manipulator\nimport data_saver\nimport neural_net\n\n\ndef main():\n test_batch, train_batch = data_loader.load_data()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Multi-Dimension KMeans data generator\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport sys\nimport random\n\ndef get_next(x):\n\ti = 0\n\tnew_x = np.copy(x)\n\twhile new_x[i] == 1:\n\t\ti = i + 1\n\tnew_x[i] = 1\n\tfor j in range(i):\n\t\tnew_x[j] = 0\... | python | chosen |
[
{
"from": "human",
"value": "Add test for `GET /v3/system/server_status`\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import with_statement\n\nimport functools\nimport os\n\nfrom tdclient... | python | chosen |
[
{
"from": "human",
"value": "Add utility function to walk cherrypy tree\n\nThis function generates a map of Resource to mounted path.\n"
},
{
"from": "gpt",
"value": "import cherrypy\nimport six\n\nfrom girder.api.rest import Resource\n\n\ndef _walk_tree(node, path=[]):\n route_map = {}\n ... | python | chosen |
[
{
"from": "human",
"value": "Add module with utility functions.\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef centroid(x, flux):\n mu = np.sum(x*flux)/np.sum(flux)\n sd = np.sqrt(np.sum(flux * (x-mu)**2)/np.sum(flux))\n return mu,sd\n\n\ndef approx_stokes_i(Axx,Ayy):\... | python | chosen |
[
{
"from": "human",
"value": "Add a script to automatically update an autogenerated table.\n"
},
{
"from": "gpt",
"value": "import sys\nimport argparse\n\nfrom ceterach.api import MediaWiki\n\nfrom difflib import Differ\n\nfrom parse_equipment import AUTOGEN_HEADER, AUTOGEN_FOOTER\n\nparser = arg... | python | chosen |
[
{
"from": "human",
"value": "Define function for determining the sum of price rows\n"
},
{
"from": "gpt",
"value": "from s2v2 import * \n\ndef calculate_sum(data_sample):\n\ttotal = 0\n\tfor row in data_sample[1:]: # slice to start at row two, but I think we should only skip row 1 if we're impor... | python | chosen |
[
{
"from": "human",
"value": "Add extra tests to make sure that the form is safe\n\nPrevious implementations of this functionality mutated the base form\nclass, which broke a bunch of stuff.\n\nI want to make sure that getting this form for one placeholder doesn’t\nchange other forms that have already been i... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for promise\n\nChange-Id: I538fcedbfbef46ae36b8eff5a20acaa28a8bfb85\nSigned-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright (c) 2017 Orange and others.\... | python | chosen |
[
{
"from": "human",
"value": "Introduce HgVCS, check for extdiff extension enabled\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, print_function\n\nimport logging\nimport subprocess\n\nfrom ..utils import _execute\nfrom .base import VCSBase\n\n\nlogger = logging.getLogg... | python | chosen |
[
{
"from": "human",
"value": "Create info.formatter subpackage, and add ApiObjectInfoFormatter base class\n"
},
{
"from": "gpt",
"value": "from typing import List\n\nfrom bot.action.util.format import DateFormatter\nfrom bot.action.util.textformat import FormattedText\nfrom bot.api.api import Api... | python | chosen |
[
{
"from": "human",
"value": "Add a test for running spark\n\nWe're using data from http://grouplens.org/datasets/movielens/\nFor this test we're using the MovieLens 100K Dataset\n"
},
{
"from": "gpt",
"value": "from pyspark import SparkConf, SparkContext\r\nimport collections\r\n\r\nconf = Spark... | python | chosen |
[
{
"from": "human",
"value": "Update description of the nagios port for check_http.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\n\nfrom charmhelpers.contrib.charmsupport import nrpe\n\n\ndef update_nrpe_checks():\n nrpe_compat = nrpe.NRPE()\n # The use of port 80 assu... | python | chosen |
[
{
"from": "human",
"value": "Create Simplified ExcelSheetColNum for Leetcode\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def titleToNumber(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n res = 0\n for i in range(len(s) - 1, -... | python | chosen |
[
{
"from": "human",
"value": "Move Union Colony Fire rescue authority to correct location\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.gis.geos import Point\nfrom django.db import models, migrations\nfrom genericm2m.utils... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.