conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Test for a recursive directory lister.\n"
},
{
"from": "gpt",
"value": "#Test to see recursive directory lister\nimport os\ndef lister(dir_name):\n os.chdir(dir_name)\n dirs = os.listdir(os.getcwd())\n for file in dirs:\n if not os.path.isdir(file):\n... | python | chosen |
[
{
"from": "human",
"value": "Add a nose plugin to clear the database after every test.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2010-2012 Cidadania S. Coop. Galega\n#\n# This file is part of e-cidadania.\n#\n# e-cidadania is free software: you can redistribute... | python | chosen |
[
{
"from": "human",
"value": "Add solution for Problem063 written in Python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright © Manoel Vilela 2017\n#\n# @team: DestructHub\n# @project: ProjectEuler\n# @author: Manoel Vilela\n# @e... | python | chosen |
[
{
"from": "human",
"value": "Introduce templatetag for fetching image thumbnails\n"
},
{
"from": "gpt",
"value": "import logging\nimport warnings\n\nfrom django.template.context_processors import static\nfrom django import template\nfrom django.conf import settings\n\nlogger = logging.getLogger(... | python | chosen |
[
{
"from": "human",
"value": "Add management command to load all version fixtures\n\nBecause life's too short\n"
},
{
"from": "gpt",
"value": "import os\nimport re\n\nfrom django.conf import settings\nfrom django.core.management import call_command, BaseCommand\n\n\nclass Command(BaseCommand):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add an example that uses filterReactions AND pdep at the same time\n"
},
{
"from": "gpt",
"value": "# Data sources\ndatabase(\n thermoLibraries = ['primaryThermoLibrary'],\n reactionLibraries = [],\n seedMechanisms = [],\n kineticsDepositories = ['trainin... | python | chosen |
[
{
"from": "human",
"value": "[placement] Add functional test to verify presence of policy\n\nAdd a test that traverses all available placement URLs at the latest\nmicroversion and tries to access them as non-admin. If something other\nthan a 403 response is given a failed test with a message like\n\n met... | python | chosen |
[
{
"from": "human",
"value": "Add new module to statically host an arbitrary directory\n"
},
{
"from": "gpt",
"value": "import flask\n\n\n__author__ = 'paul.tunison@kitware.com'\n\n\nclass StaticDirectoryHost (flask.Blueprint):\n \"\"\"\n Module that will host a given directory to the given... | python | chosen |
[
{
"from": "human",
"value": "Add management command to populate last_modified fields\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.commtrack.models import Product, Program\nfrom dimagi.utils.couch.database import iter_docs\nfrom datetime i... | python | chosen |
[
{
"from": "human",
"value": "Create a state for add an object\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport json\nimport requests\nfrom flexbe_core import EventState, Logger\n\n\nclass Wonderland_Add_Object(EventState):\n\t'''\n\tAdd an object to Wonderland.\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to delete couch phone numbers\n"
},
{
"from": "gpt",
"value": "from corehq.apps.sms.mixin import VerifiedNumber\nfrom corehq.apps.sms.models import PhoneNumber\nfrom dimagi.utils.couch.database import iter_docs_with_retry, iter_bulk_delete_with_doc_type_ve... | python | chosen |
[
{
"from": "human",
"value": "Add a demo app to illustrate the result\n"
},
{
"from": "gpt",
"value": "import wx\n#import matplotlib\n\nclass AnalysisDemo(wx.Frame):\n def __init__(self, *args, **kw):\n super(AnalysisDemo, self).__init__(*args, **kw)\n self.initMain()\n\n def ... | python | chosen |
[
{
"from": "human",
"value": "Add test for fqdn thread leak\n\nI wasn't positive what other errors could be raised here, but we did\nhave a user reporting thread leaks, and the existing code *could* have\nthread leaks if unhandled exceptions are raised on the ThreadPool.\n\nThis test *should* work - there mi... | python | chosen |
[
{
"from": "human",
"value": "Add script which will compute the number of 'bonnes boites' per rome\n"
},
{
"from": "gpt",
"value": "import pandas as pd\n\nif __name__ == '__main__':\n\n df = pd.read_csv('prediction_per_company_per_rome2019-11-08.csv')\n df_rome_nb_bonne_boite = df.groupby([... | python | chosen |
[
{
"from": "human",
"value": "Add cmd to force send of cancelled repeat records\n"
},
{
"from": "gpt",
"value": "import csv\nimport datetime\nimport re\nimport time\n\nfrom django.core.management.base import BaseCommand\n\nfrom corehq.motech.repeaters.const import RECORD_CANCELLED_STATE\nfrom cor... | python | chosen |
[
{
"from": "system",
"value": "Fix attach in case of multiple threads.\n"
},
{
"from": "human",
"value": "# This file is meant to be run inside lldb as a command after\n# the attach_linux.dylib dll has already been loaded to settrace for all threads.\ndef __lldb_init_module(debugger, internal_dic... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for the concordance view\n\nThese tests can be run simply using `python test_concordance.py`.\nThe test suite is currently very limited. It is a tool to refactoring\nthe current code.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom concordanc... | python | chosen |
[
{
"from": "human",
"value": "Add migration to modify on_delete\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.27 on 2020-03-26 12:52\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nc... | python | chosen |
[
{
"from": "human",
"value": "Add sanity tests for baremetal power state commands\n\nAdd sanity testcases for commands:\nopenstack baremetal node reboot,\nopenstack baremetal node power on,\nopenstack baremetal node power off.\n\nChange-Id: I24bc2dcd1ef27d918b072ea686d53c0c8aa8b7ab\nPartial-Bug: #1642597\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add a migration to add the 'Other' field to QueuedImage.why_allowed\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n depend... | python | chosen |
[
{
"from": "human",
"value": "Add plugin for Nova server state metrics\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom argparse import ArgumentParser\nimport socket\nimport time\n\nfrom novaclient.v3 import Client\n\nDEFAULT_SCHEME = '{}.nova.states'.format(socket.gethostname())\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Add tests for run docker mgmt command\n"
},
{
"from": "gpt",
"value": "from StringIO import StringIO\n\nfrom django.test import TestCase\nfrom mock import patch\n\nfrom core.management.commands import run_docker\nfrom projects.models import Project\nfrom builds.model... | python | chosen |
[
{
"from": "human",
"value": "Increase text index property size\n\nThe index property size should support strings of the same length as\ncustom attribute definition titles.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2... | python | chosen |
[
{
"from": "human",
"value": "Add Summarization API code for blog post"
},
{
"from": "gpt",
"value": "import indicoio\nimport csv\n\nindicoio.config.api_key = 'YOUR_API_KEY'\n\ndef clean_article(article):\n return article.replace(\"\\n\", \" \").decode('cp1252').encode('utf-8', 'replace')\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Add a command prototype to list all items from a playlist\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.contrib.auth.models import Us... | python | chosen |
[
{
"from": "human",
"value": "[AC-6516] Add datamigration to create staff clearances\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2019-06-12 19:38\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nSTAFF = \"Staff\" # don'... | python | chosen |
[
{
"from": "human",
"value": "Add file to write templates to json\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\nimport json\nimport os\n\nif __name__ == \"__main__\":\n parser = OptionParser()\n parser.add_option(\"-P\", ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for expert bid [WAL-976]\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.1 on 2017-07-07 15:09\nfrom __future__ import unicode_literals\n\nfrom decimal import Decimal\nimport django.core.validators\nfrom django.db im... | python | chosen |
[
{
"from": "human",
"value": "Set students current flag based on enrolled and attending\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport logging\nfrom datetime import date\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db import transaction\n\nfrom a... | python | chosen |
[
{
"from": "human",
"value": "Add a script to \"untie\" tied model weights.\n\nMight need some more work in updating \"layers\" parameter.\n\nCould help address issue #39.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport climate\nimport cPickle as pickle\nimport gzip\nimport numpy... | python | chosen |
[
{
"from": "human",
"value": "Add soft margin SVM and added kernels and class\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Soft Margin SVM classification with kernels for machine learning.\n\nSoft margin SVM is basically an SVM (see folder **supportVectorMachine**) which\nhas s... | python | chosen |
[
{
"from": "human",
"value": "Test for the chipseq pipeline code\n"
},
{
"from": "gpt",
"value": "\"\"\"\n.. Copyright 2017 EMBL-European Bioinformatics Institute\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the Li... | python | chosen |
[
{
"from": "human",
"value": "Migrate database for model changes.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('api', '000... | python | chosen |
[
{
"from": "human",
"value": "Add low level Gemini serial command script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"\nA simple script for sending raw serial commands to Gemini.\n\"\"\"\n\nimport time\nimport serial\nimport readline\n\ndef main():\n\n ser = serial.Serial('... | python | chosen |
[
{
"from": "human",
"value": "Add microservice plugin for adding static attributes to responses.\n"
},
{
"from": "gpt",
"value": "import os\n\nimport yaml\n\nfrom satosa.internal_data import DataConverter\nfrom satosa.micro_service.service_base import ResponseMicroService\n\n\nclass AddStaticAttr... | python | chosen |
[
{
"from": "human",
"value": "Test float precision in json encoding.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport fedmsg.encoding\n\nfrom nose.tools import eq_\n\n\nclass TestEncoding(unittest.TestCase):\n def test_float_precision(self):\n \"\"\" Ensure that float precision ... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating test certificates\n"
},
{
"from": "gpt",
"value": "import trustme\n\n# Create a CA\nca = trustme.CA()\n\n# Issue a cert signed by this CA\nserver_cert = ca.issue_cert(u\"www.good.com\")\n\n# Save the PEM-encoded data to a file\nca.cert_pem.w... | python | chosen |
[
{
"from": "human",
"value": "Create database column class (DBCol)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\n dbcol.py: DBCol is a struct describing an sqlite database table column\n\"\"\"\n\n\n# ----------------------------DATABASE-COLUMN-----------------------------#\nc... | python | chosen |
[
{
"from": "human",
"value": "Add a handler for performing client load testing.\n\nReview URL: http://codereview.appspot.com/3844044\n\ngit-svn-id: a751b5b3dcfba0ee4592a85c40d2fdd063ca0d53@379 4ff78f4a-9131-11de-b045-6380ec9940d4\n"
},
{
"from": "gpt",
"value": "# Copyright 2011, Google Inc.\n# A... | python | chosen |
[
{
"from": "human",
"value": "Test mobile set password form\n"
},
{
"from": "gpt",
"value": "from collections import namedtuple\nfrom django.contrib.auth import get_user_model\nfrom django.test import TestCase\nfrom corehq.apps.users.forms import SetUserPasswordForm\n\nProject = namedtuple('Proje... | python | chosen |
[
{
"from": "human",
"value": "Add infrastructure for counting database queries\n"
},
{
"from": "gpt",
"value": "from contextlib import contextmanager\nimport json\nimport os\nimport re\nimport sys\nfrom django.conf import settings\nfrom django.db import connection, reset_queries\n\n\ncount = {}\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script to build plugin.\n"
},
{
"from": "gpt",
"value": "import os\nUnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'\nUATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')\nFullPluginFile = os.path.abspath('UnrealCV.uplugin')\nos... | python | chosen |
[
{
"from": "human",
"value": "Add task files for celery async process\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n\n#app_mail/tasks.py\nimport requests\nimport simplejson as json\n\nfrom django_backend_test.celery import app\nfrom django.template.loader import render_to_string\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add migration to assign appropriate sheets to Transnational CountryRegion\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db import migrations\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add script to test HOTS\n\nAdd Python script to test Higher-Order Encoder Time Stamping with\nsampled data.\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\nevents = [\n (1162704874, -5547),\n (1179727586, -5548),\n (1209562198, -5547),\n (1224960... | python | chosen |
[
{
"from": "human",
"value": "Add a standalone simulation script (really a duplicate of sensitivity.py)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThis script runs stand-alone simulation on an RMG job. This is effectively the \nsame script as sensi... | python | chosen |
[
{
"from": "human",
"value": "Read Temperature from DS18B20. Post the data to data.sparkfun.com\n"
},
{
"from": "gpt",
"value": "from machine import Pin\nfrom ds18x20 import DS18X20\nimport onewire\nimport time\nimport machine\nimport ujson\nimport urequests\n\ndef posttocloud(temperature):\n ke... | python | chosen |
[
{
"from": "human",
"value": "Add example script to post experiment and task data\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport requests\n\n\ndomain = 'http://dakis.gimbutas.lt/api/'\nexp_data = {\n \"description\": \"First successful post through API\",\n \"algorithm\":... | python | chosen |
[
{
"from": "human",
"value": "Add tests for lead price\n"
},
{
"from": "gpt",
"value": "import unittest\nimport datetime\nimport json\nimport sys\n\nsys.path.append('..')\nimport sabre_dev_studio\nimport sabre_dev_studio.sabre_exceptions as sabre_exceptions\n\n'''\nrequires config.json in the sam... | python | chosen |
[
{
"from": "human",
"value": "Introduce hades test fixtures and first tests.\n"
},
{
"from": "gpt",
"value": "from datetime import datetime, timedelta\n\nfrom pycroft.model import session\nfrom pycroft.model.hades import radgroup_property_mappings, radcheck\nfrom tests import FactoryDataTestBase\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for float->int symbols (esp for 32-bit windows and linux)\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport numba.unittest_support as unittest\nfrom numba.compiler import compile_isolated\nfrom numba import types\n\n\nclass Test... | python | chosen |
[
{
"from": "human",
"value": "Migrate listings.syndication, FeedType.content_type should not be unique.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\nclass Migration(Schem... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the different input variations.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom shapely.geometry import LineString, Point\n\nfrom directions.base import _parse_points\n\nclass DirectionsTest(unittest.TestCase):\n def setUp(self):\n se... | python | chosen |
[
{
"from": "human",
"value": "Add monadic utilities MonadicDict and MonadicDictCursor.\n\n* wqflask/utility/monads.py: New file.\n"
},
{
"from": "gpt",
"value": "\"\"\"Monadic utilities\n\nThis module is a collection of monadic utilities for use in\nGeneNetwork. It includes:\n\n* MonadicDict - mo... | python | chosen |
[
{
"from": "human",
"value": "Test asyncio in python 3.6\n"
},
{
"from": "gpt",
"value": "import asyncio\n\nasync def routine0(s,n):\n print('CRT:',s,':',n)\n\nasync def routine(id, n):\n print('TEST[%s] %d'%(id,n))\n if not n:\n return\n n -= 1\n await routine(id, n)\n await routine0(id... | python | chosen |
[
{
"from": "human",
"value": "Add example with sklearn pipeline\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUMAP as a Feature Extraction Technique for Classification\n---------------------------------------------------------\n\nThe following script shows how UMAP can be used as a feature extraction\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for systemd module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport unittest\nfrom unittest import mock\nfrom unittest.mock import MagicMock, patch\n\nfrom portinus import systemd\n\nclass testSystemd(unittest.TestCase):\n\n def setUp(self... | python | chosen |
[
{
"from": "human",
"value": "Update driver value in Seat model.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef populate_driver_in_seats(apps, schema_editor):\n Seat = apps.get_model(\"drive... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for php5-fpm pools to php7\n"
},
{
"from": "gpt",
"value": "import os\nimport glob\nfrom shutil import copy2\n\nfrom moulinette.utils.log import getActionLogger\n\nfrom yunohost.tools import Migration\nfrom yunohost.service import _run_service_command... | python | chosen |
[
{
"from": "human",
"value": "Add an interface for Markov Chains\n"
},
{
"from": "gpt",
"value": "from random import choice\n\nclass MarkovChain(object):\n \"\"\" An interface for signle-word states Markov Chains \"\"\"\n\n def __init__(self, text=None):\n self._states_map = {}\n ... | python | chosen |
[
{
"from": "human",
"value": "Add one test case for IOTOS-358\n\nTo check SQlite is integrated in image\n\nSigned-off-by: Wu Dawei <b8fdb5b9f0b6b29b63287bce074c688ca08d8ead@intel.com>\n"
},
{
"from": "gpt",
"value": "from oeqa.oetest import oeRuntimeTest\n\nclass AppFwTest(oeRuntimeTest):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add SolveTimer\n- print number of iterations and elapsed time to console while running ml.solve()\n- see docstring for usage\n"
},
{
"from": "gpt",
"value": "try:\n from tqdm.auto import tqdm\nexcept ModuleNotFoundError:\n raise ModuleNotFoundError(\"SolveTimer... | python | chosen |
[
{
"from": "human",
"value": "Add a simple script that runs the pipeline for the single specified user\n\nUser can be specified by either email or UUID.\nCalls the pipeline functions.\n"
},
{
"from": "gpt",
"value": "import json\nimport logging\nimport argparse\nimport numpy as np\nimport uuid\n\... | python | chosen |
[
{
"from": "human",
"value": "Add migration to backfill recipient counts\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 dependencies = [\n ('msg... | python | chosen |
[
{
"from": "human",
"value": "Add script that creates a filtered list of required packages\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport shutil\nimport d1_dev.util\nimport os\nimport pip._internal.utils.misc\nimport re\n\n\nREQUIREMENTS_FILENAME = 'requirements.txt'\n\n\n# Modu... | python | chosen |
[
{
"from": "human",
"value": "Add a migration to load users and buckets\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLoad initial user and bucket data from seed files.\n\"\"\"\nimport logging\nimport os\nimport subprocess\nimport sys\n\nlog = logging.getLogger(__name__)\n\n\ndef up(db):\n names = ... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for directive_sections -> relationships\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: anze... | python | chosen |
[
{
"from": "human",
"value": "Test case for RPC HTTP handler.\n"
},
{
"from": "gpt",
"value": "import time\n\nimport requests\nfrom weavelib.messaging import Receiver\nfrom weavelib.rpc import RPCServer, ServerAPI\nfrom weavelib.services import BaseService\n\nfrom weaveserver.core.services import... | python | chosen |
[
{
"from": "human",
"value": "Change meta option for Github\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-05-24 15:03\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n de... | python | chosen |
[
{
"from": "system",
"value": "Add Django version trove classifiers.\n"
},
{
"from": "human",
"value": "import os\nfrom setuptools import setup, find_packages\n\n\nNAME = 'djangae'\nPACKAGES = find_packages()\nDESCRIPTION = 'Django integration with Google App Engine'\nURL = \"https://github.com/p... | python | chosen |
[
{
"from": "human",
"value": "[AC-7570] Add test for email backend coverage\n"
},
{
"from": "gpt",
"value": "from mock import patch\nfrom django.core import mail\nfrom django.test import TestCase\nfrom django.urls import reverse\n\nfrom impact.minimal_email_handler import MinimalEmailHandler\n\nc... | python | chosen |
[
{
"from": "human",
"value": "Add boolean matrix generator - from mocogenomics\n"
},
{
"from": "gpt",
"value": "import itertools\n\nletters = ['A','R','N','D','C','E','Q','G','H','I','L','K','M','F','P','S','T','W','Y','V']\n\n# generates a matrix from all peptides and saves to CSV\ndef generateB... | python | chosen |
[
{
"from": "human",
"value": "Add in some tests for cities\n"
},
{
"from": "gpt",
"value": "import testtools\n\nimport cities\n\n\nclass TestCities(testtools.TestCase):\n def test_largest(self):\n largest = 'Sydney'\n self.assertEqual(largest, cities.largest(cities.get_cities()).... | python | chosen |
[
{
"from": "human",
"value": "Add test for setting scheduler parameters\n\nAdd a test setting scheduler parameters to validate the\nprevious bugfix to strncpy of field names.\n\nSigned-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>\n"
},
{
"from": "gpt",
"value":... | python | chosen |
[
{
"from": "human",
"value": "Add a script to download files from url\n"
},
{
"from": "gpt",
"value": "import urllib2\n'''\nScript to download pdf from a url, you need specify the website URL, and change the \nfilename in the loop, it mostly useful to download a sequence of files with the \nfilen... | python | chosen |
[
{
"from": "system",
"value": "Update the PyPI version to 0.2.12\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n retu... | python | chosen |
[
{
"from": "human",
"value": "Add a basic smoke test to check for exceptions and programming errors.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport unittest\nimport sys\nsys.path.insert(0, '../mafia')\n\nfrom game import Game\nfrom game import Player\n\nclass TestMessenger:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Chuck Norris bot to the team\n"
},
{
"from": "gpt",
"value": "import telegram\n\n\nLAST_UPDATE_ID = None\n\n\ndef main():\n\n ''' This is the main function that has to be called '''\n\n global LAST_UPDATE_ID\n\n # Telegram Bot Authorization Token\n bo... | python | chosen |
[
{
"from": "system",
"value": "Add project_security.xml file entry in update_xml section\n\nbzr revid: mga@tinyerp.com-1950891d2c32d7af7c7ba38518a3abdba822b091"
},
{
"from": "human",
"value": "{\n\t\"name\" : \"Project Management\",\n\t\"version\": \"1.0\",\n\t\"author\" : \"Tiny\",\n\t\"website\... | python | chosen |
[
{
"from": "human",
"value": "Add a small test script to call individual methods of a driver"
},
{
"from": "gpt",
"value": "# -*- Mode: Python; coding: utf-8 -*-\n# vi:si:et:sw=4:sts=4:ts=4\n\n##\n## Copyright (C) 2007 Async Open Source <http://www.async.com.br>\n## All rights reserved\n##\n## Th... | python | chosen |
[
{
"from": "human",
"value": "Add unittests to test environment.py methods\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nu\"\"\"\nCopyright 2016 Telefónica Investigación y Desarrollo, S.A.U.\nThis file is part of Toolium.\n\nLicensed under the Apache License, Version 2.0 (the \"Licens... | python | chosen |
[
{
"from": "human",
"value": "Add implementation of more generic store calls\n"
},
{
"from": "gpt",
"value": "from ktbs_bench.graph_store import GraphStore\nimport rdflib\n\nrdflib.plugin.register('BN', rdflib.store.Store, 'ktbs_bench.bnsparqlstore', 'SPARQLUpdateStore')\n\n\ndef get_sparqlstore(... | python | chosen |
[
{
"from": "human",
"value": "Add open time range support.\n"
},
{
"from": "gpt",
"value": "import datetime\nimport flask\nimport functools\nfrom app import app\n\n# Use dateutil if available\ntry:\n from dateutil import parser as dateutil\nexcept ImportError:\n dateutil = None\n\nclass GameTim... | python | chosen |
[
{
"from": "human",
"value": "Add a unittest on plot_figs module."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010 Jérémie DECOCK (http://www.jdhp.org)\n\nimport unittest\nimport os\nimport sys\n\ndirname = os.path.dirname(__file__)\nif dirname... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of season goal leader retrieval\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport requests\nfrom lxml import html\n\n\nSEASON_URL_TEMPLATE = \"http://www.hockey-reference.com/leagues/NHL_%d.html\"\nCAREER_GO... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 553. Optimal Division\n\n553. Optimal Division: https://leetcode.com/problems/optimal-division/\n\nApproach1\n Bottom-up DP\n"
},
{
"from": "gpt",
"value": "from fractions import Fraction\nclass Solution(object):\n def optimalDivision(self, ... | python | chosen |
[
{
"from": "human",
"value": "Add Python script to generate (huge) test dumps.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport random\n\n\nWORLDS = [None] * 8 + ['world', 'world_nether', 'creative', 'hardcore']\n\nREGIONS = [None] * 20 + ['Region%d' % i for i in range(10)]\n\nNUM... | python | chosen |
[
{
"from": "human",
"value": "Add a convenience python script to inline the imports of a file.\n\nUseful for making files to trim down into minimal test cases.\n"
},
{
"from": "gpt",
"value": "from __future__ import with_statement\r\nimport os\r\n\r\nfile_contents = {}\r\nfile_imports = {}\r\n\r\... | python | chosen |
[
{
"from": "human",
"value": "Add tool to fix MP4 file timestamp from GPMF GPS clock\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport datetime\nimport shutil\n\nimport gpmf.extract\nimport gpmf.parse\nimport hachoir.editor\nimport hachoir.parser\nimport hachoir.stream\nfrom hachoir... | python | chosen |
[
{
"from": "human",
"value": "Add python script that should submit to view.cwl API\n\nArvados-DCO-1.1-Signed-off-by: Benjamin Carr <ben@curii.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport fnmatch\nimport requests\nimport time\nimport os\nimport glob\n\n# You can alternativ... | python | chosen |
[
{
"from": "human",
"value": "Add spider for Giant Eagle\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport json\nimport re\n\nimport scrapy\nfrom locations.items import GeojsonPointItem\nfrom locations.hours import OpeningHours\n\n\nDAY_MAPPING = {\n 1: \"Su\",\n 2: \"Mo\",\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for APNS message.\n"
},
{
"from": "gpt",
"value": "import mock\n\nfrom django.test import TestCase\nfrom django.conf import settings\n\nfrom zerver.models import PushDeviceToken, UserProfile\nfrom zerver.models import get_user_profile_by_email\nfrom zerver.... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking Python3 compatibility\n\nNote that it only actually works as intended if it's run using Python3.\n\nChange-Id: Ic41ea54e2d1eceabacfcfbb935ac1d029e563645\nReviewed-on: https://skia-review.googlesource.com/c/buildbot/+/387136\nReviewed-by: Joe Gregorio <b9c... | python | chosen |
[
{
"from": "human",
"value": "Add a \"image me [thing]\" handler\n"
},
{
"from": "gpt",
"value": "import re\nimport json\nimport asyncio\nimport random\nimport aiohttp\n\n\nGOOGLE_IMAGE_API = 'http://ajax.googleapis.com/ajax/services/search/images'\n\n\ndef plugin(bot):\n @bot.respond(re.compi... | python | chosen |
[
{
"from": "human",
"value": "Correct empty lines in imported files\n"
},
{
"from": "gpt",
"value": "print('\\n\\n\\n\\n')\nprint('Now:\\n')\n\n\nfor p in c.all_positions():\n try:\n # Corrects empty lines around @language python\\n@tabwidth -4\n if p.h.startswith('@clean') and p... | python | chosen |
[
{
"from": "human",
"value": "Add scripts printing special:mode.yml from model.npz\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport argparse\nimport numpy as np\nimport yaml\n\n\nDESC = \"Prints version and model type from model.npz file.\"\nS2S_SPECIAL_NODE = \"speci... | python | chosen |
[
{
"from": "human",
"value": "Add Naive Bayes base class:\n"
},
{
"from": "gpt",
"value": "\"\"\"\nNaive Bayes Classifier\nIncludes gaussian, bernoulli and multinomial models\n\"\"\"\n\nimport abc\nimport numpy as np\n\nclass NaiveBayes:\n \"\"\"\n Naive Bayes Classifier\n Given class la... | python | chosen |
[
{
"from": "human",
"value": "Add presubmit check for run-bindings-tests\n\nrun-bindings-tests should be run (and succeed) for any changes to\nSource/bindings. This is particularly important to make sure tests are\nrebaselined when changes are made to the code generator.\nThis adds a PRESUBMIT.py script to d... | python | chosen |
[
{
"from": "human",
"value": "Add missing component of previous commit\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis module contains small utility classes and functions which do not clearly belong to one part of the project.\n\"\"\"\n\nimport enum\n\n\nclass ChoicesEnum(enum.Enum):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Test for selecting mysql search backend\n"
},
{
"from": "gpt",
"value": "from wolis.test_case import WolisTestCase\nfrom wolis import utils\n\nclass SearchBackendMysqlTest(WolisTestCase):\n @utils.restrict_database('mysql*')\n @utils.restrict_phpbb_version('>=3... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.