conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add an experimental backend to display figures in a standalone Qt window.\n"
},
{
"from": "gpt",
"value": "# Copyright 2014, Sandia Corporation. Under the terms of Contract\n# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain\n# rights in... | python | chosen |
[
{
"from": "human",
"value": "Add command line app example"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport os\nimport sys\nimport argparse\n\n\ndef main(arguments):\n\n parser = argparse.ArgumentParser(\n description=__doc__,\n formatter_class=argpars... | python | chosen |
[
{
"from": "human",
"value": "Use lxml instead of ET\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport datetime as dt\nimport numpy as np\nimport pandas as pd\n\nfrom lxml import etree\n# test the lxml package in comparision to the standard ElementTree pkg\n\n\nfrom crocus_forcing_nc imp... | python | chosen |
[
{
"from": "human",
"value": "Add generator for tables plus SLIP room config\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport requests\nimport json\n\nclass Table(object):\n def __init__(self, x, y, width, height, name):\n self.name = name\n self.pos... | python | chosen |
[
{
"from": "human",
"value": "Move utility processors out of init file\n"
},
{
"from": "gpt",
"value": "\nimport re\n\n\ndef utility_processor():\n def unslug(string):\n return re.sub('_', ' ', string)\n\n def parse_field_data(value):\n choices = re.sub('\\r\\n', ',', value)\n... | python | chosen |
[
{
"from": "human",
"value": "tests: Add compilation tests for all samples\n"
},
{
"from": "gpt",
"value": "import os.path\nimport pytest\nimport rain.compiler as C\n\ndef ls(*path):\n path = os.path.join(*path)\n for file in os.listdir(path):\n yield os.path.join(path, file)\n\ndef lsrn(*pa... | python | chosen |
[
{
"from": "human",
"value": "Add a demo script for the CtfEditor.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis demonstrates the `CtfEditor` widget.\n\nTo use: right-click in the window to bring up a context menu. Once you've added\na color or opacity, you can drag them around by just clicking o... | python | chosen |
[
{
"from": "human",
"value": "Add temporary file for dataset creation code\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport os\nimport click\nimport logging\nfrom dotenv import find_dotenv, load_dotenv\n\n\n@click.command()\n@click.argument('input_filepath', type=click.Path(exists... | python | chosen |
[
{
"from": "human",
"value": "Add an UTF-8 helper which overloads print()\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# vim: tabstop=4 shiftwidth=4 softtabstop=4\n#\n# Copyright (C) 2017 GEM Foundation\n#\n# OpenQuake is free software: you can redistribute it and/or modify it\n# und... | python | chosen |
[
{
"from": "human",
"value": "Migrate tests for dask array conversions from dask package.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function\n\nfrom odo.backends.dask_array import append, Array, merge\nfrom dask.array.core import insert_to_ooc\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add Problem Ugly Number II\n"
},
{
"from": "gpt",
"value": "# https://leetcode.com/problems/ugly-number-ii/\n\nclass Solution(object):\n def nthUglyNumber(self, n):\n \"\"\"\n :type n: int\n :rtype: int\n \"\"\"\n ugly = [1] * n\... | python | chosen |
[
{
"from": "system",
"value": "Make sure ALLOWED_HOSTS is correctly set\n"
},
{
"from": "human",
"value": "\nDEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage'\nFILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024\nFILE_UPLOAD_HANDLERS = (\n 'djangae.storage.BlobstoreFileUploadHandler',\n 'djan... | python | chosen |
[
{
"from": "human",
"value": "Add a help script to help switching between countries\n\nThis may be useful for people using one copy for\ndevelopment who have to switch between working on\ndifferent countries.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=UTF-8\n\n# If you have ... | python | chosen |
[
{
"from": "human",
"value": "Add experimental JSON output module\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport json, math\n\nfrom .schema import SolrResponse, SolrResult\n\n\nclass SunburntJSONEncoder(json.JSONEncoder):\n def encode(self, o):\n if is... | python | chosen |
[
{
"from": "human",
"value": "Add fetch recipe for the Flutter Engine repository.\n\nTested with the following\n\n$ mkdir flutter_engine\n$ cd flutter_engine\n$ fetch flutter\n$ cd src\n\n # Confirm the source tree and dependencies are as expected.\n\nBUG=None\nTEST=see above\n\nChange-Id: Ie1a6653c3b76354e2... | python | chosen |
[
{
"from": "human",
"value": "Add module descriptions and dependencies\n\n{\r\n 'name': 'Genesis Product Multi-Image',\r\n 'description': 'This module adds multiple product images (22 currently) into a tab in product.template in a tab called Product Images',\r\n 'category': 'Website',\r\n 'versio... | python | chosen |
[
{
"from": "human",
"value": "Add a @lazy decorator for simple lazy methods.\n"
},
{
"from": "gpt",
"value": "def lazy(func):\n def lazy_func(self, *args, **kwargs):\n cached_attribute = '_cached_%s' % func.__name__\n if not hasattr(self, cached_attribute):\n setattr(s... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for security groups\n\nChange-Id: I90b29c2e48303867ae2f670643171d113e485cf1\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. Y... | python | chosen |
[
{
"from": "system",
"value": "Fix test migration for Wagtail 1.5\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport modelcluster.fields\nimport wagtail.wagtailcore.fields\n\n\nclass Migration(mig... | python | chosen |
[
{
"from": "human",
"value": "Add test for initialization that doesn't find library\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Copyright 2009-2016 Jason Stitt\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated doc... | python | chosen |
[
{
"from": "human",
"value": "Add test for `tldr init`\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom os import path\nimport unittest\n\nimport click\nfrom click.testing import CliRunner\nimport mock\nim... | python | chosen |
[
{
"from": "human",
"value": "Add handy profiled wrapper function\n"
},
{
"from": "gpt",
"value": "from fastimgproto.sourcefind.image import SourceFindImage\nfrom memory_profiler import profile\n\n@profile\ndef memprof_sourcefindimage(data, detection_n_sigma, analysis_n_sigma):\n return Source... | python | chosen |
[
{
"from": "system",
"value": "Remove cdmr main level import.\n"
},
{
"from": "human",
"value": "# Version import needs to come first so everyone else can pull on import\nfrom ._version import get_versions\n__version__ = get_versions()['version']\ndel get_versions\n\nfrom . import cdmr # noqa\n_... | python | chosen |
[
{
"from": "human",
"value": "Migrate db to make default_registrant unique for project\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-04-07 08:15\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import mig... | python | chosen |
[
{
"from": "system",
"value": "Correct description comment, add a line break"
},
{
"from": "human",
"value": "'''\nApplication from a .kv\n======================\n\nThe root application is created from the corresponding .kv. Check the test.kv\nfile to see what will be the root widget.\nThis examp... | python | chosen |
[
{
"from": "human",
"value": "Add tests for split_path/join_path functionality\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom binder.views import split_path, join_path\n\n\nclass PathTest(TestCase):\n\n\tdef _test_path(self, path_str, path_keys):\n\t\twith self.subTest(... | python | chosen |
[
{
"from": "human",
"value": "tests: Add a test for loop.create_unix_server\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport os\nimport socket\nimport tempfile\nimport uvloop\n\nfrom uvloop import _testbase as tb\n\n\nclass _TestUnix:\n def test_create_server_1(self):\n CNT = 0 ... | python | chosen |
[
{
"from": "human",
"value": "Add search vector agg test case\n"
},
{
"from": "gpt",
"value": "import sqlalchemy as sa\nfrom sqlalchemy_utils import aggregated, TSVectorType\nfrom tests import TestCase\n\n\ndef tsvector_reduce_concat(vectors):\n return sa.sql.expression.cast(\n sa.func.... | python | chosen |
[
{
"from": "human",
"value": "tests: Add tests for unicode find()/rfind()/index().\n"
},
{
"from": "gpt",
"value": "print(\"ΠΡΠΈΠ²Π΅Ρ\".find(\"Ρ\"))\nprint(\"ΠΡΠΈΠ²Π΅Ρ\".find(\"Π\"))\nprint(\"ΠΡΠΈΠ²Π΅Ρ\".rfind(\"Ρ\"))\nprint(\"ΠΡΠΈΠ²Π΅Ρ\".rfind(\"Π\"))\nprint(\"ΠΡΠΈΠ²Π΅Ρ\".index(\"Ρ\"))\nprint(\"ΠΡΠΈΠ²Π΅Ρ\".index(... | python | chosen |
[
{
"from": "human",
"value": "Add new modifier of F expression class (~F(\"boolean field\"))\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.db.models.expressions import F as BaseF\n\nclass F(BaseF):\n def __invert__(self):\n self._invert = True\n return s... | python | chosen |
[
{
"from": "human",
"value": "Add main function of the rail system optimizer\n\ndef issue#17\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTrain station Optimizer!\n\nThis program optimizes the efficiency of a train station by simulating normal\noperations and varying train schedules and escalator edi... | python | chosen |
[
{
"from": "human",
"value": "Add an example script showing how to use this library\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"Use IMAP CLI to gt a summary of IMAP account state.\"\"\"\n\n\nimport argparse\nimport getpass\nimport logging\nimport os... | python | chosen |
[
{
"from": "human",
"value": "Add session normalising malaria 3view stack\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nimport toolz as tz\nimport numpy as np\nfrom skimage import io\nimport os\nfilenames = sorted(os.listdir())\nfrom toolz import curried as c\nos.makedirs('8bit')\n# fi... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights rock paper scissors problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Rock Paper Scissors Problem\n\nfrom itertools import combinations\n\n\ndef rockPaperScissors(players):\n return sorted([[b, a] for a, b in combina... | python | chosen |
[
{
"from": "human",
"value": "Add first version of main\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport click\nimport ebisearch\nfrom pprint import pprint\n\n\n@click.group()\ndef main():\n pass\n\n\n@click.command('get_results', short_help='Get list of results')\ndef get_resu... | python | chosen |
[
{
"from": "human",
"value": "examples/hwapi: Add soft_pwm example converted to uasyncio.\n"
},
{
"from": "gpt",
"value": "# See original soft_pwm.py for detailed comments.\nimport uasyncio\nfrom hwconfig import LED\n\n\nasync def pwm_cycle(led, duty, cycles):\n duty_off = 20 - duty\n for i... | python | chosen |
[
{
"from": "human",
"value": "Add a basic test for the creatersakey management command\n"
},
{
"from": "gpt",
"value": "from django.core.management import call_command\nfrom django.test import TestCase, override_settings\nfrom django.utils.six import StringIO\n\n\nclass CreateRSAKeyTest(TestCase)... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new difference module\n"
},
{
"from": "gpt",
"value": "'''Tests for distance-based objectives, layers, etc.'''\nimport pytest\nimport numpy\nimport numpy.linalg\nfrom numpy.testing import assert_allclose\nfrom ...neural._classes.difference import word_m... | python | chosen |
[
{
"from": "human",
"value": "Add manage command for installing R dependencies\n"
},
{
"from": "gpt",
"value": "###########################################################################\n# (C) Vrije Universiteit, Amsterdam (the Netherlands) #\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add placeholder for gwas pvalue\n"
},
{
"from": "gpt",
"value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom utils.base import TestPostgapBase\n# ------------------------------------------------\n\nclass TestPValu... | python | chosen |
[
{
"from": "human",
"value": "Add a test for main-tables.rst\n"
},
{
"from": "gpt",
"value": "import os\nimport re\n\nfrom pokedex.db.tables import mapped_classes\n\ndef test_main_tables():\n \"\"\"Check that tables.py and main-tables.rst are in sync: every table should\n be documented, and... | python | chosen |
[
{
"from": "human",
"value": "Add host library to topology event test\n"
},
{
"from": "gpt",
"value": "from ryu.base import app_manager\nfrom ryu.controller import ofp_event\nfrom ryu.controller import event\nfrom ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER\nfrom ryu.controll... | python | chosen |
[
{
"from": "human",
"value": "Convert PDF to Text As a Function\n"
},
{
"from": "gpt",
"value": "from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter\nfrom cStringIO import StringIO\nfrom pdfminer.converter import TextConverter\nfrom pdfminer.layout import LAParams\nfrom pdfminer... | python | chosen |
[
{
"from": "system",
"value": "Add utility function to create or update database items\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .common import session_scope\n\n\ndef commit_db_item(db_item):\n with session_scope() as session:\n session.me... | python | chosen |
[
{
"from": "human",
"value": "Test script that demonstrate the failure to import OpenPNM in the test folder.\n\n\nFormer-commit-id: 38d931cb07cfb102415dc2ac2a68142e3ca3f22d\nFormer-commit-id: 83bb6579e4bd1d15fe39ef9dcb894519feaff707"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Create migration for the change to the more info link\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.18 on 2019-02-02 19:45\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration... | python | chosen |
[
{
"from": "human",
"value": "Add example with ResourceRouter and content negotiation\n"
},
{
"from": "gpt",
"value": "\"\"\"Example using `routing.ResourceRouter` and `negotiation` (content negotation).\n\nStart the app with\n::\n $ pip install gunicorn http\n $ gunicorn -k aiohttp.worker.... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for GeneView:show\n"
},
{
"from": "gpt",
"value": "from view_testing import ViewTest\nfrom models import Protein\nfrom models import Gene\nfrom database import db\n\n\ntest_gene_data = {\n 'name': 'BRCA1',\n 'isoforms': [\n Protein(\n ... | python | chosen |
[
{
"from": "human",
"value": "Configure will uncomment UDP config\n"
},
{
"from": "gpt",
"value": "from copy import copy\n\n\ndef run():\n ## UDP /etc/rsyslog.conf\n uncomment('/etc/rsyslog.conf', ['$ModLoad imudp', '$UDPServerRun 514'])\n ## nginx\n\n\n ## sudo service rsyslog restar... | python | chosen |
[
{
"from": "human",
"value": "Implement the server PUSH command\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import Command, ICommand, IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass ServerPush(ModuleData, Command):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add an utiity to measure salt performance.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding: utf-8\n\nimport re\nimport envoy\n\n\ndef parse_state(line):\n match = re.search('\\[(?P<state>[^\\]]+?)\\] at time', line)\n if match:\n return ... | python | chosen |
[
{
"from": "human",
"value": "Add list of words and combine it with twitter.\n"
},
{
"from": "gpt",
"value": "import urllib\nimport re\nimport math\nfrom bs4 import BeautifulSoup\n\n## This is my small project on Sentimental Analysis\n## Please NOTE: You cannot use this code without prior permi... | python | chosen |
[
{
"from": "human",
"value": "Add rule that vpc flow logs enabled\n"
},
{
"from": "gpt",
"value": "#\n# This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode)\n#\n\nimport boto3\nimport json\n\ndef evaluate_compliance(config_item, is_flow_lo... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 628. Maximum Product of Three Numbers\n\n628. Maximum Product of Three Numbers: https://leetcode.com/problems/maximum-product-of-three-numbers/\n"
},
{
"from": "gpt",
"value": "from operator import mul\nimport heapq\nclass Solution(object):\n d... | python | chosen |
[
{
"from": "system",
"value": "Fix environment variable checks for removing container\n"
},
{
"from": "human",
"value": "import os, os.path\nimport nose.tools as nose\nimport biobox_cli.container as ctn\n\ndef project_root():\n return os.path.abspath(os.path.join(os.path.dirname(__fi... | python | chosen |
[
{
"from": "human",
"value": "Rename files according to owncloud forbidden characters\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Parse tree and find files matching owncloud forbidden characters.\nRename in place or move into a specific folder\n\"\"\"\n\... | python | chosen |
[
{
"from": "human",
"value": "Add test for captcha generation/validation\n"
},
{
"from": "gpt",
"value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2022 CERN\n#\n# Indico is free software; you can redistribute it and/or\n# modify it under the terms of the MIT License; see the\n# LICE... | python | chosen |
[
{
"from": "human",
"value": "Add test to ensure policy is always authorized\n\nThis adds new unit tests to ensure that all API methods decorated\nwith @expose.expose are also calling policy.authorize() and\ncontext.to_policy_values() within the method body.\n\nThis is done by patching sys.modules to replace... | python | chosen |
[
{
"from": "human",
"value": "Add trial runner/report class adapter for old unittests.\n\nThis adds a new unittest file, `lib/bridgedb/test/test_Tests.py`, which\nruns the old unittests in `lib/bridgedb/Tests.py` with a unittest report\nadapter that is compatible with twisted.trial. It uses the underlying\nS... | python | chosen |
[
{
"from": "human",
"value": "Add separate script for starting app\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os\nfrom app.main import app\n\nif __name__ == '__main__':\n if len(sys.argv) > 1 and sys.argv[1] == 'debug':\n app.debug = True\n port = in... | python | chosen |
[
{
"from": "system",
"value": "Use prefetch related to trigger polymorphic downcast.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.db import models\n\n\nclass FilerPluginManager(models.Manager):\n def __init__(self, select_related=None):\n self._select_related ... | python | chosen |
[
{
"from": "human",
"value": "Connect to database and create if tables not exists\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sqlite3\n\n# Connexion database\ndatabase = \"../data/storage.sq3\"\nconnexion = sqlite3.connect(database)\n\ncursor = connexion.cursor()\nfor row in... | python | chosen |
[
{
"from": "human",
"value": "Add simple wolfram-style cellular automata\n"
},
{
"from": "gpt",
"value": "data = \"00000000000000000000100000000000000000000\"\n\nstr2idx = {\n \"111\": 0,\n \"110\": 1,\n \"101\": 2,\n \"100\": 3,\n \"011\": 4,\n \"010\": ... | python | chosen |
[
{
"from": "human",
"value": "Add drop ProgramDirective table migration\n"
},
{
"from": "gpt",
"value": "\n\"\"\"Remove ProgramDirective table\n\nRevision ID: 3be12e136921\nRevises: 57cc398ad417\nCreate Date: 2015-04-28 15:23:10.503624\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevisi... | python | chosen |
[
{
"from": "human",
"value": "Add CLI command to generate a secret token\n"
},
{
"from": "gpt",
"value": "import binascii\nimport logging\nimport os\n\nimport click\n\n\n@click.command()\n@click.argument('bytes', default=128)\ndef cli(bytes):\n \"\"\"\n Generate a random secret token.\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Make HF test take much less time!\n"
},
{
"from": "human",
"value": "import theanets\n\nimport util\n\n\nclass TestTrainer(util.MNIST):\n def setUp(self):\n super(TestTrainer, self).setUp()\n self.exp = theanets.Experiment(\n theanets.Aut... | python | chosen |
[
{
"from": "human",
"value": "Add pointless migration to ensure python functionality\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-04-06 21:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.model... | python | chosen |
[
{
"from": "human",
"value": "Add basic test script for mcmc_serial. Code now passes with conditions on prior.\n\nCode runs with all prior inputs on ups2 and simulated data. However, variance\nhyperparameters exhibit issues when used with improper priors on the rate\nparameter. The shape and rate parameters ... | python | chosen |
[
{
"from": "human",
"value": "Test to ensure git-project exits early if out of date\n\nSee: (CLD-2913)\n"
},
{
"from": "gpt",
"value": "#!bin/env python\n\nimport subprocess\nimport os.path\nimport unittest, re\n\n\nclass TestOldVersion(unittest.TestCase):\n\n @classmethod\n def setUpClass(... | python | chosen |
[
{
"from": "human",
"value": "Test deletion with only unapplied patches, and without the --backup option\n"
},
{
"from": "gpt",
"value": "import os, os.path\nfrom quilt.patch import Patch\nfrom six.moves import cStringIO\nimport sys\n\nfrom helpers import QuiltTest, make_file, tmp_mapping, tmp_se... | python | chosen |
[
{
"from": "human",
"value": "Add algorithm for merging arrays in place\n"
},
{
"from": "gpt",
"value": "a = [1, 3, 8, 12, 15]\nb = [4, 12, 17, 0, 0, 0, 0, 0]\n\ni = len(a) - 1\nj = len(b) - len(a) - 1\nk = len(b) - 1\n\nwhile i >= 0:\n if j >= 0:\n if a[i] > b[j]:\n while i ... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate README figure."
},
{
"from": "gpt",
"value": "\"\"\"\nDraw the example used in the README file.\n\"\"\"\n\n# Standard library modules.\n\n# Third party modules.\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.cbook as cb... | python | chosen |
[
{
"from": "human",
"value": "Add test for the config file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom os import path\nimport unittest\n\nimport click\nfrom click.testing import CliRunner\nimport mock... | python | chosen |
[
{
"from": "human",
"value": "TEST added test for dsi\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom nose.tools import assert_true, assert_false, assert_equal, assert_raises\nfrom numpy.testing import assert_array_equal, assert_array_almost_equal\n\nimport nibabel as nib\nfrom dipy.dat... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights delete digit problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Delete Digit Problem\n\n\ndef deleteDigit(n):\n s = str(n)\n return max(int(''.join(s[:i] + s[i + 1:])) for i in range(len(s)))\n # idxs = [i for i... | python | chosen |
[
{
"from": "human",
"value": "Add tests for inheriting Nap class\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for nap module.\n\nThese tests only focus that requests is called properly.\nEverything related to HTTP requests should be tested in requests' own tests.\n\"\"\"\n\nfrom mock import Mag... | python | chosen |
[
{
"from": "human",
"value": "Add a mixin to test exported metrics.\n\nMost of this mixin should be moved to prometheus_client eventually,\nsince it relies heavily on its internals.\n"
},
{
"from": "gpt",
"value": "from prometheus_client import REGISTRY\n\n\nMETRIC_EQUALS_ERR_EXPLANATION = \"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add Deep Learning with Neural Networks and TensorFlow\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Deep Learning with Neural Networks and TensorFlow.\n\nDeep learning is part of a broader family of machine learning methods based on\nlearning data r... | python | chosen |
[
{
"from": "human",
"value": "Create a SeleniumBase logo for console interfaces\n"
},
{
"from": "gpt",
"value": "\"\"\" SeleniumBase Logo Processing (for the console scripts interface)\n Logo generated from:\n http://www.patorjk.com/software/taag/#p=display&f=Slant&t=SeleniumBase \"\"\"\n\... | python | chosen |
[
{
"from": "human",
"value": "Move into uk_2017 folder and transforming the notebook into a class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__author__: 'Olivier PHILIPPE'\n__licence__: 'BSD3-clause'\n\n\"\"\"\nScrip to programatically generate notebook for... | python | chosen |
[
{
"from": "human",
"value": "contrib/management: Add command to clean up unverified users\n\nStrictly speaking we should check for the email verified status here,\nbut if a user never logged in that pretty much implies the same.\n\nPrints a list of deleted users, which we'll recieve as mail from\na cron job... | python | chosen |
[
{
"from": "human",
"value": "Test for ticket 2925, it doesn't reproduce the issue for some reason.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2007, Red Hat, Inc.\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Publi... | python | chosen |
[
{
"from": "human",
"value": "Create script to add and remove mentor's ssh key from DO droplets.\n"
},
{
"from": "gpt",
"value": "# Allows a mentor to ssh into a Digital Ocean droplet. This is designed to be\n# executed on the target machine.\n#\n# This script takes the username of the mentor as ... | python | chosen |
[
{
"from": "human",
"value": "Add missing SCP deployment file.\n"
},
{
"from": "gpt",
"value": "from grow.deployments import base\nimport errno\nimport os\nimport paramiko\n\n\nclass ScpDeployment(base.BaseDeployment):\n\n def get_destination_address(self):\n return '{}:{}'.format(self.host, ... | python | chosen |
[
{
"from": "human",
"value": "Add test for exception raising.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for the RAW sql functions.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.test import TestCase\nfrom django.db.models import connection\n\nfrom boardinghouse.models import Schema... | python | chosen |
[
{
"from": "human",
"value": "Add git api request helpers\n\nAdd helper functions for getting info on a user, and all public repos\nowned by a user\n"
},
{
"from": "gpt",
"value": "import http.client\n\nimport requests\n\nfrom . import exceptions\n\nUSER_URL = 'https://api.github.com/users/{usern... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert GTF to BED file.\n"
},
{
"from": "gpt",
"value": "import tempfile\nfrom argparse import ArgumentParser\nimport gffutils\nimport os\n\ndef disable_infer_extent(gtf_file):\n \"\"\"\n guess if we need to use the gene extent option when making... | python | chosen |
[
{
"from": "human",
"value": "Add script for switching production server\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport argparse\nimport subprocess\n\nparser = argparse.ArgumentParser()\nparser.add_argument('server', choices=['blue', 'green',],\n help='Specify server to switch... | python | chosen |
[
{
"from": "human",
"value": "Add cli progress bar example"
},
{
"from": "gpt",
"value": "# Print iterations progress\ndef printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = 'β'):\n \"\"\"\n Call in a loop to create terminal progress bar\n @p... | python | chosen |
[
{
"from": "human",
"value": "Add projects field to samples and usergroups.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\n\n\ndef main(conn):\n groups = list(r.table('usergroups').run(conn))\n for group in groups:\n ... | python | chosen |
[
{
"from": "human",
"value": "Fix the from_default field in the database\n"
},
{
"from": "gpt",
"value": "import datetime\nfrom appcomposer import app\nfrom appcomposer.db import db\nfrom appcomposer.models import ActiveTranslationMessage, TranslationBundle, TranslationMessageHistory\nfrom appcom... | python | chosen |
[
{
"from": "human",
"value": "Add a unit test for tracked().\n"
},
{
"from": "gpt",
"value": "\nfrom openrcv.resource import tracked\nfrom openrcv.utiltest.helpers import skipIfTravis, UnitCase\n\n\nclass TrackedTest(UnitCase):\n\n \"\"\"Tests for tracked().\"\"\"\n\n def test(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Set branding_type to org if itβs none\n\nSo later we can:\n- make it non-nullable later\n- remove `govuk` as an option\n\nThis is mostly for peopleβs local databases, the manual work here has\nbeen done on production already.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Add new table for industry index history\n"
},
{
"from": "gpt",
"value": "\"\"\"industry_index\n\nRevision ID: 53eb8abce4de\nRevises: 1e3725cda0b7\nCreate Date: 2015-06-19 10:38:31.398000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '53eb8abce4de... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for the test/forward directory with @expectedFailure decorator\nfor test_with_dwarf_and_run_command(self).\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@116416 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "gpt",
"value": "\"\"\"Tes... | python | chosen |
[
{
"from": "human",
"value": "Add an initial \"Hook\" object and MokshaHookMapperExtension.\n\nThese area designed to make it simple to write plugins that\nmonitor and analyze database activity.\n"
},
{
"from": "gpt",
"value": "# This file is part of Moksha.\n#\n# Moksha is free software: you can... | python | chosen |
[
{
"from": "human",
"value": "Add basic setup.py file to create application bundles on OS X.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis is a setup.py script generated by py2applet\n\nUsage:\n python setup.py py2app\n\"\"\"\n\nfrom setuptools import setup\n\nimport opencmiss.zinc.context\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to check assembly of each file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n'''\nCheck that each file assembles and that the output binary\nis identical to the original file.\n'''\nimport filecmp\nimport os\nimport subprocess\nimport shutil\nimp... | python | chosen |
[
{
"from": "human",
"value": "[RM-11742] Add tests for argparse uninstall\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 TestParserUninstall(object):\n\n d... | python | chosen |
[
{
"from": "human",
"value": "Add the example test of SeleniumBase in French\n"
},
{
"from": "gpt",
"value": "# French Language Test - Python 3 Only!\nfrom seleniumbase.translate.french import CasDeBase\n\n\nclass ClasseDeTest(CasDeBase):\n\n def test_exemple_1(self):\n self.ouvrir_url(... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.