conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add common base weigher/weigher handler for filter scheduler\n\nFilter scheduler is being used for more than one core projects (Nova\nand Cinder as of writing), the implementation shared a lot of common\ncode. This patch is to move base weigher (weighing function), weigher\nhand... | python | chosen |
[
{
"from": "human",
"value": "Test command fallback and queue.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom tornado.httpclient import AsyncHTTPClient\nfrom tornado.testing import gen_test, AsyncTestCase\nfrom blackgate import Command, component\n\nclass TestCommand(AsyncTestCa... | python | chosen |
[
{
"from": "human",
"value": "Add basic web api server\n\nSo far allows you to get and send lines but that's about it. Still, this means I can actually make pircel say shit \\o/\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\npossel.resources\n------------... | python | chosen |
[
{
"from": "human",
"value": "[util] Add python ROM_EXT manifest generator\n\nThis script takes .hjson input file that contains ROM_EXT manifest\nmetadata. This metadata is parsed and fed into the mako that uses it\ntogether with the template file to produce C header.\n\nIn future we could add the asm templa... | python | chosen |
[
{
"from": "human",
"value": "Add test for Keen script for Preprint providers.\n"
},
{
"from": "gpt",
"value": "import datetime\n\nfrom tests.base import OsfTestCase\nfrom osf_tests.factories import PreprintFactory, PreprintProviderFactory\nfrom osf.models import PreprintService\nfrom nose.tools ... | python | chosen |
[
{
"from": "human",
"value": "Add Grove Thumb Joystick example\n"
},
{
"from": "gpt",
"value": "# GrovePi + Grove Thumb Joystick\r\n# http://www.seeedstudio.com/wiki/Grove_-_Thumb_Joystick\r\n\r\nimport time\r\nimport grovepi\r\n\r\n# Connect the Thumb Joystick to analog port A0\r\n\r\n# Uses two... | python | chosen |
[
{
"from": "human",
"value": "Create initial unit tests for run_component module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport shutil\nfrom nose.tools import raises, with_setup\nfrom dakotathon.run_component import run_component, main\nfrom dakotathon.dak... | python | chosen |
[
{
"from": "human",
"value": "Add pre-script migration generationkwh module\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom oopgrade import oopgrade\nimport netsvc\n\n\ndef up(cursor, installed_version):\n logger= netsvc.Logger()\n print \"somenergia-generationkwh_0.0.1.1: Hem entrat ... | python | chosen |
[
{
"from": "human",
"value": "Add temporary corpus document generator - toolset need to be reworked.\n"
},
{
"from": "gpt",
"value": "import joblib\n\npath_dict = joblib.load('data/filepath_dict.txt')\n\ndef tmp_gen():\n for i in range(len(path_dict)):\n path = path_dict[i]\n wit... | python | chosen |
[
{
"from": "human",
"value": "Add a test for missing migrations.\n\nThis commit detects missing migrations by running makemigrations\nwith the --dry-run flag and checking for the 'No changes detected'\nmessage on stdout. Otherwise, the error includes information on\nthe migrations that are missing.\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Add scaffold for the unit test\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Author: Bo Maryniuk <bo@suse.de>\n#\n# Copyright 2017 SUSE LLC\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 migrations for reminder field.\n"
},
{
"from": "gpt",
"value": "from django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('fetsy', '0004_tags'),\n ]\n\n operations = [\n migrations.AddField... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for BaseModel\n"
},
{
"from": "gpt",
"value": "import uuid\nfrom bloop import Column, UUID, Boolean, DateTime, String\nmissing = object()\n\n\ndef test_default_model_init(User):\n ''' Missing attributes aren't set to `None` or any other placeholder ... | python | chosen |
[
{
"from": "human",
"value": "Add a unit testing stub for the Theme object\n"
},
{
"from": "gpt",
"value": "# This module is part of the GeoTag-X project builder.\n# Copyright (C) 2015 UNITAR.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the ... | python | chosen |
[
{
"from": "human",
"value": "Add missing test for ErrorHandlingURLopener\n\nI forgot to add this with commit\ndf9cfda52e952bb4d69cc0ee724e713cd6f468d5\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom openelex.base.fetch import ErrorHandlingURLopener, HTTPError\n\nclass Test... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add tool to extract SSI from TOPKAPI simulation results\n"
},
{
"from": "gpt",
"value": "__all__ = ['extract_ssi']\n\nfrom datetime import datetime, timedelta\n\nimport h5py\nimport numpy as np\nimport numpy.ma as ma\n\n# gzip compression flag\ncomp = 6\n\ndef e... | python | chosen |
[
{
"from": "human",
"value": "Add backoff retry async example"
},
{
"from": "gpt",
"value": "import asyncio\nimport logging\n\nimport aiohttp\nimport backoff\n\n\n@backoff.on_exception(backoff.expo,\n aiohttp.errors.ClientError,\n max_tries=8)\nasync def ... | python | chosen |
[
{
"from": "human",
"value": "Add util script to check for broken links.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nfrom subprocess import Popen, PIPE\n\nimport os\nimport urllib2\nimport sys\n\nutilDir = os.path.dirname(os.path.realpath(__file__))\n\nignores = ['localhost', '127.... | python | chosen |
[
{
"from": "human",
"value": "Add another module useful for GitHub actions: get a repo's latest release URL"
},
{
"from": "gpt",
"value": "import argparse\nimport subprocess\nimport os\nfrom github import Github\nimport re\n\ng = Github(os.environ[\"GITHUB_TOKEN\"])\nparser = argparse.ArgumentPar... | python | chosen |
[
{
"from": "system",
"value": "Add simple equation to calculate Doppler shift\n"
},
{
"from": "human",
"value": "\"\"\"\nDoppler\n=======\n\nDoppler shift module.\n\"\"\"\nfrom __future__ import division\n\n\ndef velocity_from_doppler_shift(c, f1, f2):\n \"\"\"\n Calculate velocity based on... | python | chosen |
[
{
"from": "human",
"value": "Add script that updates Solr configuration on ZooKeeper\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\n\nfrom mc_solr.constants import *\nfrom mc_solr.solr import update_zookeeper_solr_configuration\n\nif __name__ == \"__main__\":\n par... | python | chosen |
[
{
"from": "human",
"value": "Add fetch recipe for the Skia repository.\n\nTested with the following command lines:\n\n$ cd somewhere\n$ mkdir some-test-dir\n$ cd some-test-dir\n$ fetch skia\n$ cd skia\n # confirm it is what we expected.\n\nBUG=None\nTEST=see above\nR=agable@chromium.org\n\nReview URL: https... | python | chosen |
[
{
"from": "human",
"value": "Add subclassing example for RawCol\n"
},
{
"from": "gpt",
"value": "from flask_table import Table, Col\n\n\nclass RawCol(Col):\n \"\"\"Class that will just output whatever it is given and will not\n escape it.\n \"\"\"\n\n def td_format(self, content):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add minimal regression tests of reading ACA hdr3 data\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBasic functionality and regression tests for ACA hdr3 (diagnostic) telemetry.\n\"\"\"\n\nimport numpy as np\n\nfrom .. import aca_hdr3\n\n\ndef test_MSIDset():\n \"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add sleep duration histogram plotter\n"
},
{
"from": "gpt",
"value": "import plotly as py, plotly.graph_objs as go\nfrom csvparser import parse\nfrom os.path import basename, splitext\nfrom sys import argv\n\ndata_file = argv[1]\nraw_data = parse(data_file)\n\nsleep_... | python | chosen |
[
{
"from": "human",
"value": "Add script to retrain a model for a given param set\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (C) 2006-2019 Music Technology Group - Universitat Pompeu Fabra\n#\n# This file is part of Gaia\n#\n# Gaia is free soft... | python | chosen |
[
{
"from": "human",
"value": "tests/api: Add tests for \"GET /aircraft-models\"\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom skylines.model import AircraftModel\n\n\ndef test_list_empty(db_session, client):\n res = client.get('/aircraft-models')\n assert res.status_code == 200\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a couple of tests for lsxfel\n"
},
{
"from": "gpt",
"value": "from karabo_data import lsxfel\nfrom karabo_data import H5File\n\ndef test_lsxfel_file(mock_lpd_data, capsys):\n with H5File(mock_lpd_data) as f:\n img_ds, index = lsxfel.find_image(f)\n ... | python | chosen |
[
{
"from": "human",
"value": "Create CUDA cast tests based on CPU cast tests\n"
},
{
"from": "gpt",
"value": "from numba import unittest_support as unittest\nimport numpy as np\nfrom numba import cuda, types\nimport struct\n\n\ndef float_to_int(x):\n return np.int32(x)\n\n\ndef int_to_float(x)... | python | chosen |
[
{
"from": "human",
"value": "Create migration for blog status\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2016-06-02 16:10\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):... | python | chosen |
[
{
"from": "human",
"value": "Add script to get number of apps blocked without duplicates\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n# Get the number of apps blocked by each Motorola patent\n# and plot agains the number of citations to that patent\n\nimport pandas as pd\nimport matplotli... | python | chosen |
[
{
"from": "human",
"value": "Add a simple boilerplate to process jobs.\n"
},
{
"from": "gpt",
"value": "import os\nos.environ['DJANGO_SETTINGS_MODULE'] = 'greatbigcrane.development'\nimport zmq\nimport time\nimport json\n\naddr = 'tcp://127.0.0.1:5555'\n\ncontext = zmq.Context()\nsocket = contex... | python | chosen |
[
{
"from": "human",
"value": "Add tests for custom context processor\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for Custom context processors.\n\"\"\"\nimport os\n\nfrom django.conf import settings\nfrom django.test import TestCase, override_settings\n\n\nclass FooterCategoriesContextProcesso... | python | chosen |
[
{
"from": "human",
"value": "Add migration for auto_now removal\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-03-29 17:51\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport django.utils.timezone\nimport osf.utils.fie... | python | chosen |
[
{
"from": "human",
"value": "Add cycle test of remove useless symbols\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 19.08.2017 16:13\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy impo... | python | chosen |
[
{
"from": "human",
"value": "Add solution to hamming numbers kata\n"
},
{
"from": "gpt",
"value": "# You are given as input an unsorted array of n distinct numbers, \n# where n is a power of 2. \n# Give an algorithm that identifies the second-largest number in the array, \n# and that uses at mos... | python | chosen |
[
{
"from": "human",
"value": "Add shell class for type checkers\n"
},
{
"from": "gpt",
"value": "import six\n\n\nclass SubscriptableType(type):\n def __getitem__(self, key):\n return self\n\n\n@six.add_metaclass(SubscriptableType)\nclass CheckedPMap(object):\n pass\n\n\n@six.add_meta... | python | chosen |
[
{
"from": "human",
"value": "Add version upgrade plug-in object\n\nThese are for plug-ins that upgrade preference files to newer versions of the application.\n\nContributes to issue CURA-844.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015 Ultimaker B.V.\n# Cura is released under the terms... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for table outputter\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nunittests for table outputter\n'''\n\n# Import Python Libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Testing Libs\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add migration that has been pending for a long time\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2019-03-08 02:15\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migr... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add a Matplotlib helper functions module\n\n* So far this only contains a function to create a ListedColormap from\n ColorBrewer palette specs.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nA collection of helper functions to aid the construction of custom\nfigures ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 345. Reverse Vowels of a String\n\n345. Reverse Vowels of a String: https://leetcode.com/problems/reverse-vowels-of-a-string/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def reverseVowels(self, s):\n \"\"\"\n :type ... | python | chosen |
[
{
"from": "human",
"value": "Add script used to subvolume new EM volumes\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nfrom gala import imio\nimport numpy as np\n\nslices = [(slice(None), slice(None, 625), slice(None, 625)),\n (slice(None), slice(None, 625), slice(625, None))... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for sympy_parser\n"
},
{
"from": "gpt",
"value": "from sympy.parsing.sympy_parser import parse_expr\nfrom sympy import *\n\ndef test_implicit_multiplication_application():\n x = Symbol('x')\n inputs = {\n '2*x': 2 * x,\n '3.00': Flo... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Namespace component\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom gaphor import UML\nfrom gaphor.core.modeling import Diagram\nfrom gaphor.ui.namespace import Namespace, popup_model\n\n\n@pytest.fixture\ndef namespace(event_manager, element_fac... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for logging from apel.common.__init__\n"
},
{
"from": "gpt",
"value": "from cStringIO import StringIO\nimport logging\nimport os\nimport sys\nimport tempfile\nimport unittest\n\nfrom apel.common import set_up_logging\n\n\nclass LoggingTest(unittest.TestC... | python | chosen |
[
{
"from": "human",
"value": "Add test for very basic things\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport unittest\nimport pandas as pd\nimport pdfplumber\nimport sys, os\nimport six\n\nimport logging\nlogging.disable(logging.ERROR)\n\nHERE = os.path.abspath(os.path.dirname(__fi... | python | chosen |
[
{
"from": "human",
"value": "Add tests for ElasticSearch classes.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the ElasticSearch module\"\"\"\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for tshark sub-module\n"
},
{
"from": "gpt",
"value": "import mock\n\nfrom pyshark.tshark.tshark import (\n get_tshark_display_filter_flag,\n get_tshark_interfaces,\n get_tshark_version,\n)\n\n@mock.patch('pyshark.tshark.tshark.subprocess.check_out... | python | chosen |
[
{
"from": "human",
"value": "Add Python project generation script.\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\nimport sys\n\n# get the path to the directory containing the script\nprojects_directory = os.path.dirname(os.path.realpath(__file__))\n\nplatform_name = sys.platform\... | python | chosen |
[
{
"from": "human",
"value": "Add tool to send a jump to application command.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport utils\nimport commands\n\ndef parse_commandline_args():\n parser = utils.ConnectionArgumentParser(description='Send a jump to application command.')\n ... | python | chosen |
[
{
"from": "human",
"value": "Make the initial account migrations\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-11 19:06\nfrom __future__ import unicode_literals\n\nimport apps.accounts.models\nfrom django.db import migrations, models\nimport dj... | python | chosen |
[
{
"from": "human",
"value": "Add primitive library search support\n"
},
{
"from": "gpt",
"value": "\"\"\"A module for consuming the Penn Libraries API\"\"\"\nimport requests\n\nBASE_URL = \"http://dla.library.upenn.edu/2.0.0/search\"\n\n\ndef search(query):\n \"\"\"Search Penn Libraries Frank... | python | chosen |
[
{
"from": "human",
"value": "Test locale is set based on query param\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom cla_public.apps.base.views import set_locale\n\nfrom cla_public.app import create_app\nfrom flask import request\n\nclass LocaleTest(unittest.TestCase):\n\n def setUp(self... | python | chosen |
[
{
"from": "human",
"value": "Apply refactoring done to authorize.net form/gateway to braintree.\n"
},
{
"from": "gpt",
"value": "from django import forms\n\n\nclass PaymentFormBase(forms.Form):\n\n def __getitem__(self, key):\n \tpayment_fields = self._get_payment_fields()\n if key ... | python | chosen |
[
{
"from": "human",
"value": "Add a python-only alternative to dbbindings.py\n\nPushing a small web app that can return Bookworm API calls through Python, rather than Apache HTTP Server. It is currently a very simple porting of the Apache code that runs on port 8080, and is intended for minimal installs.\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add sketch for POI selector widget\n"
},
{
"from": "gpt",
"value": "from functools import partial\n\nimport numpy as np\nimport pandas as pd\nimport pyqtgraph as pg\n\nfrom pyqtgraph.Qt import QtGui, QtCore\n\nfrom graphysio.plotwidgets.plotwidget import PlotWidget\n... | python | chosen |
[
{
"from": "human",
"value": "Add test to instantiate unrolling block\n"
},
{
"from": "gpt",
"value": "from mock import Mock\n\nfrom malcolm.modules.scanning.blocks import unrolling_block\nfrom malcolm.testutil import ChildTestCase\n\n\nclass TestUnrollingBlock(ChildTestCase):\n def test_unrol... | python | chosen |
[
{
"from": "human",
"value": "Add Capabilities Client unit tests\n\nChange-Id: I0bb5d0d7b775ee41dedf6ac30ece3698d585f072\n"
},
{
"from": "gpt",
"value": "# Copyright 2017 AT&T Corporation.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n... | python | chosen |
[
{
"from": "human",
"value": "Add scripts to create release notes from git log\n\nThese script generates a list of commits from git log between\n<since> and <until>. The output of this script is in asciidoc\nformat containting list of commits subject and body.\n\nBug: issue 1272\nChange-Id: I32b2ee055e81c566... | python | chosen |
[
{
"from": "human",
"value": "Add a script to add back the missing [terminal] part_of [skeleton] relationships\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom common import db_connection\n\nimport sys\n\nif len(sys.argv) != 3:\n print >> sys.stderr, \"Usage: %s <PROJECT-ID> <USE... | python | chosen |
[
{
"from": "human",
"value": "Add utilities to make writing ros tests less painful.\n"
},
{
"from": "gpt",
"value": "import roslaunch\nimport functools\nimport subprocess\n\ndef with_roscore(obj):\n \"\"\"Decorator to run all tests in a testcase with their own roscore.\n\n This wraps the se... | python | chosen |
[
{
"from": "human",
"value": "[SR] Add basic CLI for SyncWrite requests\n\nAdd sync_repl.py; a basic command-line interface to making Synchronous\nReplication requests.\n\nExample usage - to perform a set with durability requirements to key\n'test' setting its value to 'XXX':\n\n ./sync_repl.py localhost:... | python | chosen |
[
{
"from": "human",
"value": "Add an example of a generator->freevar->cell->generator reference-cycle that\ndoesn't get cleaned up and thus leaks.\n"
},
{
"from": "gpt",
"value": "\n# This leaks since the introduction of yield-expr and the use of generators\n# as coroutines, trunk revision 39239.... | python | chosen |
[
{
"from": "human",
"value": "Test that redirects from root URL are performed appropriately.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, unicode_literals\n\nfrom django.core.urlresolvers import reverse\nfrom rest_framework.test import APITestCase\n\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add array backend for data tables\n\nThis simple backend performs all operations inside python's runtime\nmemory. It is suitable for working with small data sets and experimenting\nwith data-tables.\n\nThe actual backend is not fully finished as it is not essential. It lacks\npe... | python | chosen |
[
{
"from": "human",
"value": "Add tool for converting EXO data from latex to JSON\n"
},
{
"from": "gpt",
"value": "\n# EXO Convesion Script\n# Using specification v1.01\n# J.C. Loach (2013)\n\n# Textual replacements\nremove = {r\"\\centering\":\"\", r\"newline\":\"\", r\"tabular\":\"\"};\n\n# Mai... | python | chosen |
[
{
"from": "human",
"value": "Add management command to migrate countries to list\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import LabelCommand\nfrom django_countries.countries import COUNTRIES\nfrom corehq.apps.domain.models import Domain\n\nclass Command(LabelCommand):\n... | python | chosen |
[
{
"from": "system",
"value": "Add migration for deployment country to countries\n"
},
{
"from": "human",
"value": "from django.core.management.base import LabelCommand\nfrom django_countries.countries import COUNTRIES\nfrom corehq.apps.domain.models import Domain\n\nclass Command(LabelCommand):\... | python | chosen |
[
{
"from": "human",
"value": "Use NLTK to get word stems (useful for categorization)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\n# Install nltk: 'sudo pip install -U pyyaml nltk'\nfrom nltk.stem.lancaster import LancasterStemmer \n\nc = {'cname1': ['hello', 'rice', 'increasing'], '... | python | chosen |
[
{
"from": "human",
"value": "Add test file for otp script\n"
},
{
"from": "gpt",
"value": "import unittest\nimport random\nimport datetime \nimport emission.net.ext_service.otp.otp as otp\nimport emission.core.wrapper.location as ecwl\nimport emission.storage.decorations.local_date_queries as ec... | python | chosen |
[
{
"from": "human",
"value": "Add push api script to get a version's salesforce id from its namespace\nand version number including support for patch and beta versions\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport csv\nfrom push_api import SalesforcePushApi\n\n# Force UTF8 output... | python | chosen |
[
{
"from": "human",
"value": "Add test for CryptoTicker widget\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2021 elParaguayo\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n#... | python | chosen |
[
{
"from": "human",
"value": "Add task to migrate TariffPrice and NCSOConcession data\n\nThis file can be removed once the migration is done. (Should it be a\ndata migration?)\n"
},
{
"from": "gpt",
"value": "# This is a one-off command to migrate all TariffPrice and NCSOConcession data\n# from ... | python | chosen |
[
{
"from": "human",
"value": "Add simple util to help convert to new event system\n"
},
{
"from": "gpt",
"value": "import os\r\n\r\n\r\ndef iter_filenames(dir, ignore):\r\n for dirpath, dirnames, filenames in os.walk(dir):\r\n for fname in filenames:\r\n filename = os.path.jo... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 481. Magical String\n\n481. Magical String: https://leetcode.com/problems/magical-string/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def magicalString(self, n):\n \"\"\"\n :type n: int\n :rtype: int\n ... | python | chosen |
[
{
"from": "system",
"value": "Upgrade libchromiumcontent to remove dom storage quota\n\nCloses #897.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport platform\nimport sys\n\nBASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_COMMIT... | python | chosen |
[
{
"from": "human",
"value": "Add management command to move icons and banners to static locations\n"
},
{
"from": "gpt",
"value": "\"\"\"Resize all game banners to a fixed size\"\"\"\nimport os\nimport shutil\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\... | python | chosen |
[
{
"from": "human",
"value": "Add python loop with else demo\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\n\"\"\"\n # test_loop_with_else.py\n # \n # Copyright(C) By AbsentM. 2018\n # \n # Author: AbsentM\n # Date: 2018/03/18\n # \n # Description: Test python loop with else demo\n #\n # Chan... | python | chosen |
[
{
"from": "human",
"value": "Create script to migrate email\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.models import User\nfrom copy import deepcopy\n\n\ndef _migrate(file_path):\n arq = open(file_path)\n for line in arq.readlines():\n old_email, new_email = line.stri... | python | chosen |
[
{
"from": "human",
"value": "Add integration tests for simultaneous updates\n\nConvergence allows us to start a stack update while a previous update (or\ncreate) is still in progress. If a resource is found to be locked by a\nprevious graph traversal when the new traversal comes to update it, the\nearlier t... | python | chosen |
[
{
"from": "human",
"value": "Validate files needed by Android tools\n\nBUG=catapult:#2546\n\nReview-Url: https://codereview.chromium.org/2194743002\n"
},
{
"from": "gpt",
"value": "# Copyright 2016 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style l... | python | chosen |
[
{
"from": "human",
"value": "Add spectral graph display script\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom scipy import io, sparse, linalg\n# run this from elegant scipy chapter\n\nchem = np.load('chem-network.npy')\ngap = np.load('gap-network.npy')\nneuron_types = np.load('neuron-... | python | chosen |
[
{
"from": "human",
"value": "linter: Add test case for custom_check.py\n\nFixes #5406.\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom itertools import chain\nfrom mock import patch, MagicMock\nfrom unittest import TestCase\n\nfrom tools.linter_lib.custom_check import build_custom_checkers\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a test which executes the Solidity contract over an Ethereum RPC, and then compares the result with the Python emulation of the Solidity contract.\n"
},
{
"from": "gpt",
"value": "import json\nfrom hypothesis import given, assume, example\nimport hypothesis.strat... | python | chosen |
[
{
"from": "human",
"value": "Check in plain RNN test.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport numpy as np\nimport theano\nfrom theano import tensor as T\n\nfrom rembed.plain_rnn import RNN\nfrom rembed.util import VariableStore, CropAndPad, IdentityLayer\n\n\nclass RNNTestCase... | python | chosen |
[
{
"from": "human",
"value": "Add stupidly simple HTTP server using standard python 3\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nfrom argparse import ArgumentParser, ArgumentDefaultsHelpFormatter\nimport os, http.server\n\ndef main(args):\n os.chdir(args.directory)\n addr = ('... | python | chosen |
[
{
"from": "human",
"value": "Add SgExpressionEvaluator - Evaluates expressions given fields and values\n"
},
{
"from": "gpt",
"value": "\"\"\"A set of utility functions to evaluate expressions.\n\nSample Usage:\n print(SgExpressionEvaluator.EvaluateExpressionInRow([\"a\", \"bb\", \"ccc\"], [1... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of download script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom utils.summary_downloader import SummaryDownloader\n\nif __name__ == '__main__':\n\n # setting target dir and time interval of interest\n ... | python | chosen |
[
{
"from": "human",
"value": "Replace older dups management script"
},
{
"from": "gpt",
"value": "'''\nCompare File Contents and remove duplicate files\n\n get sha256 hash for each file found\n use dictionary to check for duplicates\n delete duplicates\n\nDave Cuthbert\n(C) 2021-02-12\nM... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for coefficient_proratisation\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom nose.tools import assert_equal\n\nfrom openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.allegements import *\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add monkeyrunner script of cpu energy usage\n\nSigned-off-by: Emiliano Firmino <05e638a1dec5cbdb4665208eae603124467a154b@gmail.com>\n"
},
{
"from": "gpt",
"value": "from com.android.monkeyrunner import MonkeyRunner as mkr\nfrom com.android.monkeyrunner import MonkeyD... | python | chosen |
[
{
"from": "human",
"value": "Add bitmask for subscribed events to intervention table.\n"
},
{
"from": "gpt",
"value": "from alembic import op\nimport sqlalchemy as sa\n\n\n\"\"\"empty message\n\nRevision ID: 91351a73e6e2\nRevises: 63262fe95b9c\nCreate Date: 2018-03-08 15:34:22.391417\n\n\"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Link.url type change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-08-30 21:02\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport share.models.fields\n\n\nclass Migrat... | python | chosen |
[
{
"from": "human",
"value": "Add greatest digit in number with python in math\n"
},
{
"from": "gpt",
"value": "number = 201328361572\nmaxDigit = -1\n\n# convert number into unique set of digits and iterate over it\nfor c in set(str(number)):\n # parse back to int and compare vs known max\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for dates in mpl.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nimport matplotlib\n# Force matplotlib to not use any Xwindows backend.\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport datetime\nfrom matplotlib.dates ... | python | chosen |
[
{
"from": "human",
"value": "Add a script that generates a test workflow with needed paralellism\n\nChange-Id: I6b1087f95b88a881e074a0af4f6f8be6d9413bc7\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\n\ntry:\n wf_name = str(sys.argv[1])\n branch_cnt = int(sys.argv[2... | python | chosen |
[
{
"from": "human",
"value": "Add check run dir file read in script\n"
},
{
"from": "gpt",
"value": "import argparse\nimport sys\nfrom os import listdir\nfrom os.path import join\n\n\nfrom pymagicc.io import read_cfg_file, MAGICCData\n\n\ndef print_summary(cannot_read, ignored, dir_to_check):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration - that created bug, where table had wrong name\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-08-26 12:16\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migr... | python | chosen |
[
{
"from": "human",
"value": "Print a presence/absence table from a directory of FASTA-formatted sequence files\n"
},
{
"from": "gpt",
"value": "#for a directory of FASTA gene family files, compute a gene presence-absence (or Count-type) table\nfrom __future__ import print_function\nimport os, re... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.