conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a tool to convert hdf5 to bigfile.\n\nThis shall work for a lot of cases but not all. It's incomplete.\n"
},
{
"from": "gpt",
"value": "import h5py\nimport bigfile\nimport logging\nimport argparse\n\nap = argparse.ArgumentParser('h5tobigfile')\nap.add_argument(\"... | python | chosen |
[
{
"from": "human",
"value": "Add a second python implementation for problem 3\n"
},
{
"from": "gpt",
"value": "roots = []; product = 1; x = 2; n = 600851475143; y = n;\nwhile product != n:\n\twhile (y % x == 0):\n\t\troots.append(x)\n\t\ty /= x\n\t\tproduct *= roots[-1]\n\tx += 1\nprint max(root... | python | chosen |
[
{
"from": "human",
"value": "Build stacks, wait for completion, show status of each\n"
},
{
"from": "gpt",
"value": "__author__ = 'ayost'\n\nimport os\nimport re\nimport sys\nfrom time import sleep\nimport boto.cloudformation\nimport boto.cloudformation.stack\n\nSCRIPT_LOCATION = os.path.abspath... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of Salt output analyzer script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n#\n\nimport sys\nimport yaml\nimport logging\n\n###############################################################################\n\ndef load_yaml_data(file_pat... | python | chosen |
[
{
"from": "human",
"value": "Add solution to chapter-3 collatzsequence\n"
},
{
"from": "gpt",
"value": "# Collatz Sequence practice project from Automate Boring Stuff - Chapter 3\n# https://automatetheboringstuff.com/chapter3/\n\ndef collatz(number):\n\tif number%2==0:\n\t\tprint(number//2)\n\t\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Android SDK packages\n"
},
{
"from": "gpt",
"value": "# MIT licensed\n# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.\n\nimport pytest\npytestmark = pytest.mark.asyncio\n\nasync def test_android_addon(get_version):\n assert await get_... | python | chosen |
[
{
"from": "human",
"value": "Add django command for updating ERF areas\n"
},
{
"from": "gpt",
"value": "import os\nimport argparse\nfrom django.core.management.base import BaseCommand\nfrom firecares.firestation.models import FireDepartment\nfrom firecares.tasks.update import update_parcel_depar... | python | chosen |
[
{
"from": "human",
"value": "Create crop and region model\n"
},
{
"from": "gpt",
"value": "# models.py\n#\n# Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>\n# Licensed under MIT\n# Version 0.0.0\n\nfrom app import db\nfrom slugify import slugify\n\nclass Crop(db.Model):\n id = ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to merge a bunch of quake style traces and write some summary statistics.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Converts a bunch of processedTrace files from Second Life into a\n# single trace file, where all coordinates have been conve... | python | chosen |
[
{
"from": "human",
"value": "Handle withdrawal of a player\n\nAdded function to handle all the changes after a player quits withdraws\nfrom the game\n"
},
{
"from": "gpt",
"value": "import pygame\nimport sys\nfrom pygame.locals import *\n\nfrom variables import *\nfrom Player import *\nfrom Card... | python | chosen |
[
{
"from": "human",
"value": "DOC: Add simple buy and hold example.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright 2015 Quantopian, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licen... | python | chosen |
[
{
"from": "human",
"value": "Add extraction script as per request"
},
{
"from": "gpt",
"value": "\"\"\" Extract some data for Colin \n\n1951-2010 Annual GDDs by climate district Apr 1 - Oct 31\n1951-2010 Frost-free days ...\n\n\"\"\"\nimport psycopg2\nimport pandas as pd\npgconn = psycopg2.conn... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating headers from glsl\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\nwith open(sys.argv[1], 'w') as outfile:\n with open(sys.argv[2], 'r') as infile:\n outfile.write('namespace {0} {{\\n'.format(sys.argv[3]))\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate templates\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python3\n\nfrom argparse import ArgumentParser\nfrom argparse import ArgumentTypeError\nimport itertools\nimport os\nimport string\nfrom shutil import copyfile\nimport pathlib\n\ndef v... | python | chosen |
[
{
"from": "human",
"value": "Add tests to image_xpress module\n"
},
{
"from": "gpt",
"value": "from microscopium.screens import image_xpress\nimport collections as coll\n\n\ndef test_ix_semantic_filename():\n test_fn = \"./Week1_22123/G10_s2_w11C3B9BCC-E48F-4C2F-9D31-8F46D8B5B972.tif\"\n e... | python | chosen |
[
{
"from": "human",
"value": "Set up command with arguments\n"
},
{
"from": "gpt",
"value": "import sys\nimport traceback\nimport argparse\nfrom PIL import Image\n\ndef binterpret(filename, abx, aby):\n try:\n img = Image.open(filename)\n except IOError:\n traceback.print_exc(... | python | chosen |
[
{
"from": "human",
"value": "Add script for demostrating cathicng multiple exceptions\n"
},
{
"from": "gpt",
"value": "def take_beer(fridge, number=1):\n if not isinstance(fridge, dict):\n raise TypeError(\"Invalid fridge\")\n\n if \"beer\" not in fridge:\n raise ValueError(\... | python | chosen |
[
{
"from": "human",
"value": ":new: Add change encoding add on\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\n\nfrom owlmixin import OwlMixin\nfrom modules.models import ResponseAddOnPayload\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\nclass Config(OwlMixin):\n def __... | python | chosen |
[
{
"from": "human",
"value": "Add tests suite for spoiler tag.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSkCode spoiler tag test code.\n\"\"\"\n\nimport unittest\n\nfrom skcode.etree import TreeNode\nfrom skcode.tags import (SpoilerTagOptions,\n DEFAULT_RECOGNIZED_TAGS)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add example from listing 7.8\n"
},
{
"from": "gpt",
"value": "'''\nListing 7.8: Testing atomic operations\n'''\n\nimport numpy as np\nimport pyopencl as cl\nimport utility\n\nkernel_src = '''\n__kernel void atomic(__global int* x) {\n\n __local int a, b;\n\n a = ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for Cython functions that mirror pure Python tests\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\nimport numpy as np\nimport numpy.testing as npt\nfrom nimble import Events\nimport nimble.cyfunc.debounce as cy\n\n\nclass TestAsArrayMet... | python | chosen |
[
{
"from": "human",
"value": "Add script to dynamically deploy adapters\n"
},
{
"from": "gpt",
"value": "import requests\nimport json\nimport argparse\nimport uuid\nimport pprint\n\n\ndef main():\n parser = argparse.ArgumentParser(\n description='Deploy adapter to Tomviz acquisition ser... | python | chosen |
[
{
"from": "human",
"value": "DEBUG and TEST. Plenty of Typos\n"
},
{
"from": "gpt",
"value": "import dpkt, socket, pygeoip, optparse\n\n\ndef banner():\n\tprint \"#### Use Python to build a Google Map #####\"\n\tprint \"\"\n\ndef retKML(ip):\n\trec = gi.record_by_name(ip)\n\ttry:\n\t\tlongit... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration needed to support Variable value encryption\n"
},
{
"from": "gpt",
"value": "\"\"\"add is_encrypted column to variable table\n\nRevision ID: 1968acfc09e3\nRevises: bba5a7cfc896\nCreate Date: 2016-02-02 17:20:55.692295\n\n\"\"\"\n\n# revision ide... | python | chosen |
[
{
"from": "human",
"value": "Add a trivial GNOME Music test.\n"
},
{
"from": "gpt",
"value": "from pydbus import SessionBus\nfrom gi.repository import GObject, GLib\nimport subprocess\nfrom time import sleep\n\nloop = GObject.MainLoop()\n\nsubprocess.Popen(\"gnome-music\")\nsleep(5)\nprint(\"Wai... | python | chosen |
[
{
"from": "human",
"value": "Add Nubank class for handling the requests\n"
},
{
"from": "gpt",
"value": "import json\nimport requests\n\n\nclass NuException(BaseException):\n pass\n\n\nclass Nubank:\n headers = {\n 'Content-Type': 'application/json',\n 'X-Correlation-Id': 'WE... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Receipt model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n dependen... | python | chosen |
[
{
"from": "human",
"value": "Create NeblinaCore to handle sending and receiving packet.\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n###################################################################################\n#\n# Copyright (c) 2010-2016 Motsai\n#\n# The MIT License (... | python | chosen |
[
{
"from": "human",
"value": "Add example on subclassing commands.Context\n"
},
{
"from": "gpt",
"value": "import random\n\nimport discord\nfrom discord.ext import commands\n\n\nclass MyContext(commands.Context):\n async def tick(self, value):\n # reacts to the message with an emoji\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a tool-info moduel for ABC\n"
},
{
"from": "gpt",
"value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>\n#\n# SPDX-... | python | chosen |
[
{
"from": "human",
"value": "Add utility to generate bearer keys for twitter\n"
},
{
"from": "gpt",
"value": "import requests\nimport base64\nimport sys\n\nif len(sys.argv) < 3:\n print \"Usage: twitter_application_auth.py <consumer key> <consumer secret>\"\n sys.exit(1)\n\nconsumer_key = ... | python | chosen |
[
{
"from": "human",
"value": "Add script for processing COCA ngrams.\n"
},
{
"from": "gpt",
"value": "from data import data, process_common\n\nUNIGRAM_REFERENCE = 'data/g1m_1gram.txt'\nSRCS_PATTERN = 'data/corpus/coca/w%s_.txt'\nOUTS_PATTERN = 'data/coca_%sgram.txt'\nREFERENCE = {}\n\n\ndef load_... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for LoggingHandler.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport unittest\n\nimport teres\nimport teres.handlers\nimport logging\nimport os.path\nimport shutil\nimport StringIO\nimport tempfile\n\n\nclass LoggingHandl... | python | chosen |
[
{
"from": "human",
"value": "Add functions to test LIF IO\n"
},
{
"from": "gpt",
"value": "import os\nfrom lesion import lifio\n\nfrom numpy.testing.decorators import skipif\nfrom numpy.testing import assert_equal, assert_allclose\n\ncurrdir = os.path.abspath(os.path.dirname(__file__))\n\ntest_l... | python | chosen |
[
{
"from": "human",
"value": "Check that mideu package config exists (assumes that home and current dir do not have config present)\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nimport unittest\nimport os\n\nfrom mciutil.cli.common import get_config_filename\n\n\nclass ... | python | chosen |
[
{
"from": "human",
"value": "Add test for 'position_tolerance' when symmetrizing.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik\n# Author: Dominik Gresch <greschd@gmx.ch>\n\"\"\"\nTests for the 's... | python | chosen |
[
{
"from": "human",
"value": "Add first tests for `FeatureProducer()`\n\nThese tests do not test all code paths, but it is a start. We still need\nto add a test file to read.\n"
},
{
"from": "gpt",
"value": "import collections\nimport datetime\nimport pytest\nimport numpy as np\nfrom PIL import I... | python | chosen |
[
{
"from": "human",
"value": "Add a quick check that we can preprocess strings.\n"
},
{
"from": "gpt",
"value": "import chstrings\nimport config\n\nimport unittest\n\nclass CHStringsTest(unittest.TestCase):\n @classmethod\n def add_smoke_test(cls, cfg):\n def test(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Write a simple adapter in functest project to run TESTON\nJIRA:FUNCTEST-46\n\nChange-Id: I146ec926da6cbbd2535d0997326a13bd545f42c6\nSigned-off-by: Qinglong Lan <0cd11e1cd771fa5a3124ae83fdff3084638adefb@huawei.com>\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDescription:... | python | chosen |
[
{
"from": "human",
"value": "TST: Add test for repr mixin\n"
},
{
"from": "gpt",
"value": "from ...orm import SetupTrump, SymbolManager\n\nclass TestToolsSQLA(object):\n \n def setup_method(self, test_method):\n self.eng = SetupTrump()\n self.sm = SymbolManager(self.eng)\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for boring articles.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\ndef make_articles_boring(apps, schema_editor):\n Article = apps.get_model(\"news\",... | python | chosen |
[
{
"from": "human",
"value": "Update last commit: add act-experience-update example\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 Tensorforce Team. 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": "Implement the merge sort algorithm.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n'''\nMerge Sort.\n\nBest, Average, Worst: O(nlogn).\n'''\n\n\ndef merge_sort(array, result, left, right, order):\n\n if right - left < 2:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add database migrations and creation script\n"
},
{
"from": "gpt",
"value": "from flask_script import Manager\nfrom flask_migrate import Migrate, MigrateCommand\n\nfrom app import db, create_app\nfrom app.models import User, BucketList, Item\n\napp = create_app(\"dev... | python | chosen |
[
{
"from": "human",
"value": "Add a test module where canvas unit tests will go\n\nOnly a simple line drawing test there for now...\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import assert_equal\n\nfrom pyagg import GraphicsState, Color, ndarray_canvas_rgb24\n\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add test for empty LogEndogTransformer\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy.testing import assert_array_almost_equal\nfrom scipy import stats\nimport pytest\n\nfrom pmdarima.preprocessing import LogEndogTransforme... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to upload a build\n"
},
{
"from": "gpt",
"value": "\"\"\"This script upload a newly-build version of CocoMUD for Windows.\n\nThe Download wiki page on Redmine are updated.\n\nRequirements:\n This script needs 'python-redmine', which you can obtain with... | python | chosen |
[
{
"from": "human",
"value": "Add cascade for easier deletion of users from database.\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 577ad345788e\nRevises: 3b655c2d1a85\nCreate Date: 2015-11-17 11:18:22.685983\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision =... | python | chosen |
[
{
"from": "human",
"value": "Add DB migration script for attributes table\n"
},
{
"from": "gpt",
"value": "\"\"\"Add table for additional user attributes\n\nRevision ID: 888b56ed5dcb\nRevises: d5870fd2f2a4\nCreate Date: 2021-02-10 12:17:40.880224\n\n\"\"\"\n\n# revision identifiers, used by Alem... | python | chosen |
[
{
"from": "human",
"value": "Add quick and dirty script to generate a fake postage stamp cue (PSC).\n"
},
{
"from": "gpt",
"value": "from datetime import datetime as dt\nfrom datetime import timedelta as tdelta\nimport numpy as np\nfrom astropy.io import fits\nimport astropy.units as u\nfrom ast... | python | chosen |
[
{
"from": "human",
"value": "Add django command for triggering campaigns scheduler\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom django.core.management.base import BaseCommand\n\nfrom SMSFlyCRM.SMSApp.tasks import scheduleRecurringCampaignTasksFor\n\n\nclass Command(BaseCo... | python | chosen |
[
{
"from": "human",
"value": "Rename order field in LevelType (3/3)\n\nStage 3: ONLY remove the old column via a migration.\n\nDE-1829\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Hold off on migration\"\n\nThis reverts commit d0cd939e90917bc06b71fb6a6a5aedd881f24840.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2018-10-09 19:24\nfrom __future__ import unicode_literals\n\nfrom django.db im... | python | chosen |
[
{
"from": "human",
"value": "Add Riak counter datatype tests\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom aioriak.bucket import Bucket, BucketType\nfrom aioriak import datatypes\nfrom aioriak.tests.base import IntegrationTest, AsyncUnitTestCase\n\n\nclass DatatypeUnitTestBase:\n dty... | python | chosen |
[
{
"from": "system",
"value": "Fix digests `DummyBackend` method signatures.\n\nThis makes them consistent with the base backend API.\n\nRIP @tkaemming, stung by dynamic typing.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom contextlib import contextmanager\n\nf... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for HelloController\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sys\nimport os\nsys.path.append(os.path.join(os.path.dirname(__file__), \"..\", \"..\"))\n\nfrom pkg_resources import require\nrequire(\"mock\")\nfrom mock import Mock\n\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add generate data using jmeter: add fabric script.\n"
},
{
"from": "gpt",
"value": "from datetime import datetime, timedelta\nfrom fabric.api import local, task, lcd\nimport random\n\n@task\ndef create_salesman_order():\n \"\"\"\n Create Sales Order GT\n # 1... | python | chosen |
[
{
"from": "human",
"value": "Automate calculation of canonical URLs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport re\n\nVERSION_MASK = \"__version__\"\n\n\ndef split_version(f):\n m = re.match(\"(master|v[0-9]+\\\\.[0-9]+)/\", f)\n if m:\n return m.grou... | python | chosen |
[
{
"from": "human",
"value": "Add very basic NumbersApi example\n"
},
{
"from": "gpt",
"value": "from bessie import BaseClient, Endpoint\n\n\nclass NumbersApi(BaseClient):\n\n\tendpoints = [\n\t\tEndpoint('GET', 'random', None),\n\t\tEndpoint('GET', '<n>/trivia', None),\n\t\tEndpoint('GET', '<n>/... | python | chosen |
[
{
"from": "human",
"value": "Add tests for pyramid functions\n"
},
{
"from": "gpt",
"value": "from numpy.testing import assert_array_equal, run_module_suite\nfrom skimage import data\nfrom skimage.transform import (pyramid_reduce, pyramid_expand,\n build_gaussian_py... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for KoomBook USA Apache\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\n\nLANGUAGE_CODE = 'en'\nIDEASCUBE_NAME = 'WHITE MOUNTAIN APACHE'\nHOME_CARDS = STAFF_HOME_CARDS + [\n {\n '... | python | chosen |
[
{
"from": "human",
"value": "Add a script for running rfmake on emerge data\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance wit... | python | chosen |
[
{
"from": "human",
"value": "Add verify locale keys usage script\n"
},
{
"from": "gpt",
"value": "import json\nimport os\n\nROOT_PATH = os.path.dirname(os.path.dirname(__file__))\nDEFAULT_LOCALE_PATH = os.path.join(ROOT_PATH, \"app/locales/taiga/locale-en.json\")\n\n\ndef keywords(key, value):\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for (and fix a minor bug in) the last two commits.\n"
},
{
"from": "gpt",
"value": "from validator.errorbundler import ErrorBundle\nfrom validator.testcases import scripting\n\nscripting.traverser.DEBUG = True\n\ndef _test(script):\n err = ErrorBundle()\... | python | chosen |
[
{
"from": "human",
"value": "Add placeholder for gold standard\n"
},
{
"from": "gpt",
"value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom utils.base import TestPostgapBase\n# ------------------------------------------------\n\n# TODO: Expec... | python | chosen |
[
{
"from": "human",
"value": "Add test for phenotypes page.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom flask import url_for\n\ndef test_phenotypes(app, institute_obj):\n # GIVEN an initialized app\n # GIVEN a valid user and institute\n\n with app.test_client() as clie... | python | chosen |
[
{
"from": "human",
"value": "Add windows ip module integration tests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Import Python libs\nfrom __future__ import absolute_import\nimport re\n\n# Import Salt Testing libs\nfrom tests.support.case import ModuleCase\nfrom tests.support.un... | python | chosen |
[
{
"from": "human",
"value": "Add basic accepted talks template tag\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nfrom django import template\n\nfrom conference import models\n\nfrom ..utils import profile_url, talk_title\n\nregister = template.Library()\n\n# These mus... | python | chosen |
[
{
"from": "human",
"value": "Add a `create_engine` function which creates an engine from a DSN.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nKatagawa engines are the actual SQL connections behind the scenes. They actually emit the raw SQL to the database\nserver, and return the results produced.\n\"... | python | chosen |
[
{
"from": "human",
"value": "Add the Legendre benchmark in Sage\n"
},
{
"from": "gpt",
"value": "print \"import...\"\nfrom timeit import default_timer as clock\nfrom sage.all import var, Integer\nprint \" done.\"\n\ndef fact(n):\n if n in [0, 1]:\n return 1\n else:\n retur... | python | chosen |
[
{
"from": "human",
"value": "完成了第80题: Remove Duplicates from Sorted Array II\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def removeDuplicates(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n k = 2\n if len(nums) ==... | python | chosen |
[
{
"from": "human",
"value": "Add script to make the .num.txt.gz file from the fastq\n"
},
{
"from": "gpt",
"value": "import gzip\nfrom sys import argv\n\nif __name__ == \"__main__\":\n fastq = gzip.open(argv[1], 'rt')\n base, _ = argv[1].rsplit('.remap', 1)\n num = gzip.open(base+'.to.r... | python | chosen |
[
{
"from": "human",
"value": "Add tests for login-as URLs.\n"
},
{
"from": "gpt",
"value": "from django.core.urlresolvers import reverse\n\nfrom go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper\n\n\nclass TestLoginAs(GoDjangoTestCase):\n\n def setUp(self):\n self.vumi_... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for KoomBook Kytabu\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\n\nLANGUAGE_CODE = 'fr'\nIDEASCUBE_NAME = 'KYTABU'\nHOME_CARDS = STAFF_HOME_CARDS + [\n {\n 'id': 'blog',\n }... | python | chosen |
[
{
"from": "human",
"value": "Create migration febbe2d7e47b for fernet columns\n\nUpdates fastly_encrypted_api_key and aws_encrypted_secret_key to use\nLargeBinary types for their columns.\n"
},
{
"from": "gpt",
"value": "\"\"\"Use LargeBinary for fernet key columns.\n\nRevision ID: febbe2d7e47b\... | python | chosen |
[
{
"from": "human",
"value": "Add first test for views\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.models import User as AuthUser\nfrom django.core.urlresolvers import resolve\nfrom django.http import HttpRequest\nfrom django.template.loader import render_to_string\nfrom django.test... | python | chosen |
[
{
"from": "human",
"value": "Add tests for ir downgrade patch\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import, division\n\nfrom numba.cuda.testing import unittest\nfrom numba.cuda.testing import skip_on_cudasim\nfrom numba.cuda.cudadrv.nvvm import llvm39_t... | python | chosen |
[
{
"from": "system",
"value": "Update the PyPI version to 0.2.16.\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 ret... | python | chosen |
[
{
"from": "system",
"value": "Allow file to be called from other directories\n"
},
{
"from": "human",
"value": "import os\n\nimport pytest\n\n@pytest.fixture\ndef setup(request):\n def teardown():\n print(\"Running make clean\")\n os.system('make clean')\n print(\"Complet... | python | chosen |
[
{
"from": "human",
"value": "Add management command for finding commconnect enabled projects\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.domain.models import Domain\n\nclass Command(BaseCommand):\n args = \"\"\n help = \"\"\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Update migrations for Django 1.11 and Python 3\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.20 on 2019-03-27 19:51\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrat... | python | chosen |
[
{
"from": "human",
"value": "Add cache script for the warnings\n\n"
},
{
"from": "gpt",
"value": "# Need something to cache the warnings GIS files, since they are so \n# huge.\n\nimport os\n\nFINAL = \"/mesonet/share/pickup/wwa/\"\n\nfor year in range(1986,2010):\n cmd = \"wget -q -O %s/%s_all.... | python | chosen |
[
{
"from": "human",
"value": "Add script for upating readme with auto-generated pack list.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nScript which updates README.md with a list of all the available packs.\n\"\"\"\n\nimport os\nimport copy\nimport argparse\n\nimport yaml\n\n... | python | chosen |
[
{
"from": "human",
"value": "Put StarFinderBase is separate module\n"
},
{
"from": "gpt",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module implements the base classes for detecting stars in an\nastronomical image. Each star-finding class should defin... | python | chosen |
[
{
"from": "human",
"value": "Add function to load CSV roll tables into dicts\n\nSpecify the format for roll table CSV files. Dashes are used to\nspecify ranges for consistency with tables printed in the core\nrulebooks. Headers are optional simply to give flexibility.\n\nRange tuples are used in the dict ev... | python | chosen |
[
{
"from": "human",
"value": "Add test to trap for missing services\n\nRecently when there was an issue with the magnum devstack plugin causing\nthe shade gate to not have swift, we didn't notice except through the\nansible tests. That's because we have a bunch of has_service checks in\nthe tests themselves ... | python | chosen |
[
{
"from": "human",
"value": "Add generic test for custom content resolution\n"
},
{
"from": "gpt",
"value": "from corehq.apps.users.models import CommCareUser\nfrom corehq.messaging.scheduling.models import CustomContent\nfrom corehq.messaging.scheduling.scheduling_partitioned.models import (\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Gaussian LDA preparation script.\n"
},
{
"from": "gpt",
"value": "import argparse\nimport logging\nimport os\n\nfrom gensim.models import Word2Vec\n\nlogging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)\n\nif __name__ == \"_... | python | chosen |
[
{
"from": "system",
"value": "Use more gunicorn threads when pooling database connector isn't available. \n\nWhen using postgres with meinheld, the best you can do so far (as far as I know) is up the number of threads."
},
{
"from": "human",
"value": "import subprocess\nimport sys\nimport setup_... | python | chosen |
[
{
"from": "human",
"value": "Add test for refresh token\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nfrom .base import TestCase\nfrom .base import create_server, sqlalchemy_provider, cache_provider\nfrom .base import db, Client, User, Token\n\n\nclass TestDefaultProvider(TestCase):\n d... | python | chosen |
[
{
"from": "human",
"value": "Add an example of SeleniumBase Chart Maker\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\n\n\nclass MyChartMakerClass(BaseCase):\n\n def test_chart_maker(self):\n self.create_pie_chart(title=\"Automated Tests\")\n self.add_data_p... | python | chosen |
[
{
"from": "human",
"value": "Add tests for file blocks and file info\n"
},
{
"from": "gpt",
"value": "import inspect\nimport posixpath\n\nfrom utils import *\n\n\ndef test_block_locations(hdfs):\n testname = inspect.stack()[0][3]\n fname = posixpath.join(TEST_DIR, testname)\n\n data = b... | python | chosen |
[
{
"from": "human",
"value": "Add new task class RemoveElementsXPath for removing XML elements using\nXPath selectors\n"
},
{
"from": "gpt",
"value": "import glob\nimport os\nimport lxml.etree as ET\nfrom xml.sax.saxutils import escape\nfrom cumulusci.core.tasks import BaseTask\n\nclass RemoveEle... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for import_local_roles script\n"
},
{
"from": "gpt",
"value": "from pyramid import testing\nfrom tempfile import mkstemp\nimport os\nimport json\n\n\nclass TestImportLocalRoles: # pragma: no cover\n\n def test_import_local_roles(self, registry):\n ... | python | chosen |
[
{
"from": "human",
"value": "Include the database migration this time\n"
},
{
"from": "gpt",
"value": "\"\"\"Add Code of Conduct and Data Policy agreement columns\n\nRevision ID: 8888a0f4c1ef\nRevises: fa869546b8ca\nCreate Date: 2019-09-01 01:17:02.604266\n\n\"\"\"\n\n\n# revision identifiers, u... | python | chosen |
[
{
"from": "human",
"value": "Implement the quick sort algorithm.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n'''\nQuick Sort. It is an application of divide and conquer strategy.\n\nBest, Average: O(nlogn), Worst: O(n^2).\n'''\n\n\ndef partion(array, left, ... | python | chosen |
[
{
"from": "human",
"value": "Add wrapper code to emit all of the XML things\n"
},
{
"from": "gpt",
"value": "\nimport precinct\nimport electoralDistrict\n\n\ndef emitProlog():\n print '<?xml version=\"1.0\"?>'\n print '<VipObject xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" sche... | python | chosen |
[
{
"from": "human",
"value": "Add a script to find the relationship between numbers of prior art citations and numbers of blocking actions, and types of blocking actions\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Jan 24 14:56:23 2016\n\n@au... | python | chosen |
[
{
"from": "human",
"value": "Add file to securely hash passwords\n"
},
{
"from": "gpt",
"value": "\nfrom hashlib import sha512 # crypto-secure hashing algorithm\nfrom pbkdf2 import PBKDF2 # key-stretching algorithm\nfrom os import urandom # crypto-secure random number gen\n\nITERATIONS = 5000\nS... | python | chosen |
[
{
"from": "human",
"value": "Add DB migration for more explicit ordering of work & creator models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n depen... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.