conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script for listing running processes.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\n\nimport BaseHTTPServer\nimport json\nimport time\n\nimport psutil\n\nHOST_NAME = '0.0.0.0'\nPORT_NUMBE... | python | chosen |
[
{
"from": "system",
"value": "Add some basic tests for nbgrader fetch\n"
},
{
"from": "human",
"value": "from nbgrader.tests import run_command\nfrom nbgrader.tests.apps.base import BaseTestApp\n\n\nclass TestNbGraderFetch(BaseTestApp):\n\n def test_help(self):\n \"\"\"Does the help di... | python | chosen |
[
{
"from": "human",
"value": "Add prototype for plugin handler\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\nclass Plugins:\n cb_new_entries = []\n cb_download_complete = []\n\n p_config = {}\n\n def __init__(self):\n pass\n\n def new_e... | python | chosen |
[
{
"from": "human",
"value": ":memo: Add tutorial src for python-types\n"
},
{
"from": "gpt",
"value": "def get_full_name(first_name, last_name):\n full_name = first_name.title() + \" \" + last_name.title()\n return full_name\n\n\nprint(get_full_name(\"john\", \"doe\"))\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add tests for bias and length mismatch\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom spotpy import objectivefunctions as of\nimport numpy as np\n\n#https://docs.python.org/3/library/unittest.html\n\nclass TestObjectiveFunctions(unittest.TestCase):\n\n # H... | python | chosen |
[
{
"from": "human",
"value": "ADD mig scripts for picking list\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenUpgrade module for Odoo\n# @copyright 2015-Today: Odoo Community Association\n# ... | python | chosen |
[
{
"from": "human",
"value": "[avalanche] Add some test coverage for the buildavalancheproof RPC\n\nSummary:\nThe RPC is used everywhere in the tests but is not tested itself.\nThis diff does not intend to extend the safety checks but only check for the existing errors to prevent regressions.\n\nTest Plan:\n... | python | chosen |
[
{
"from": "human",
"value": "game/quests: Add the quest module and basic Quest, QuestTooltip classes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nQuests\n - questcache.wdb\n\"\"\"\n\nfrom .. import *\n\n\nclass Quest(Model):\n\tdef getTooltip(self):\n\t\treturn QuestTooltip(... | python | chosen |
[
{
"from": "human",
"value": "Create test for testcase order in output.\n"
},
{
"from": "gpt",
"value": "import shutil\r\nimport subprocess\r\nimport sys\r\nimport tempfile\r\nimport textwrap\r\nimport unittest\r\n\r\nfrom robot.api import ExecutionResult\r\n\r\n\r\nclass PabotTestlevelsplitOutpu... | python | chosen |
[
{
"from": "human",
"value": "Add a script to test the configure of acnhors parameters\n"
},
{
"from": "gpt",
"value": "import keras_retinanet.bin.train\nimport keras_retinanet.bin.evaluate\nfrom keras_retinanet.bin.train import get_anchors_params\nfrom keras_retinanet.preprocessing.csv_generator... | python | chosen |
[
{
"from": "human",
"value": "Build curves for a single zipfian distribution and then 3 combined\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef main():\n np.random.seed(0)\n bins = 50\n X = np.random.zipf(1.2, 1000)\n y = np.histogram(X[X<bins], bins, normed=True)[0]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a command to remove bogus 'last_party' from versions\n"
},
{
"from": "gpt",
"value": "import sys\n\nfrom candidates.popit import PopItApiMixin, popit_unwrap_pagination\nfrom candidates.update import fix_dates\n\nfrom django.core.management.base import BaseCommand... | python | chosen |
[
{
"from": "human",
"value": "Add code to print a chess board in ASCII format.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"This is the display module to show a chess board\"\"\"\n\ndef render_ascii_board(matrix):\n end_line_template = ' ---------------------------------\\n... | python | chosen |
[
{
"from": "human",
"value": "Test for presence and signature of wrapped libudev functions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2011 Sebastian Wiesner <lunaryorn@googlemail.com>\n\n# This library is free software; you can redistribute it and/or modify it\n# un... | python | chosen |
[
{
"from": "human",
"value": "Add a lambda to check on previous downloads\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport boto3\nimport datetime\nimport dateutil.relativedelta as rd\nfrom botocore.exceptions import ClientError\n\ns3 = boto3.client('s3')\nsns = boto3.client('sns')\n\nde... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for configure helper.\n"
},
{
"from": "gpt",
"value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nimport pytest\nimport mock\n\nimport bark\n\n\ndef test_default_configure():\n '''Tes... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for account model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.4 on 2016-12-16 18:02\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mig... | python | chosen |
[
{
"from": "human",
"value": "Modify ideascale connect app data model\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 ('ideasc... | python | chosen |
[
{
"from": "human",
"value": "Add tests of instancing nonterminals\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 31.08.2017 11:55\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\n\nfrom unittest import TestCase, main\nfrom grammpy import *\nfrom gr... | python | chosen |
[
{
"from": "human",
"value": "client: Add simple container_create() integration test\n\nSigned-off-by: Esben Haabendal <da90c138e4a9573086862393cde34fa33d74f6e5@haabendal.dk>\n"
},
{
"from": "gpt",
"value": "import pytest\nimport contextlib\nimport os\nimport re\n\nfrom xd.docker.client import *\... | python | chosen |
[
{
"from": "human",
"value": "Copy build post script from commcare-j2me\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"\nNotifies HQ of a new CommCare version. If artifacts are present, the build is\nconsidered a J2ME build.\n\nRequires an ApiUser (corehq.apps.api.models.ApiUser) on ... | python | chosen |
[
{
"from": "human",
"value": "Add consumer testdriver (subscribes to a topic and prints what it gets)\n"
},
{
"from": "gpt",
"value": "import AndroidConnector\nimport uuid\nimport sys\nimport time\nimport datetime\nimport AmmoMessages_pb2\n\nfrom twisted.internet import reactor\n\ndef onDataRecei... | python | chosen |
[
{
"from": "human",
"value": "Add tool for downloading pub packages\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file\n# for details. All rights reserved. Use of this source code is governed by a\n# BSD-style license that can be found in... | python | chosen |
[
{
"from": "human",
"value": "Verify salt-ssh can import from map files in states\n"
},
{
"from": "gpt",
"value": "import pytest\n\npytestmark = [\n pytest.mark.skip_on_windows(reason=\"salt-ssh not available on Windows\"),\n]\n\n\n@pytest.fixture(scope=\"module\")\ndef state_tree(base_env_sta... | python | chosen |
[
{
"from": "human",
"value": "Add ability to generate correct hosts file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport socket\nimport sys\nimport yaml\nfrom boto3.session import Session\n\n\ndef genhosts(elbip, sysdomain, outfile=sys.stdout):\n SYS_PREFIXES = [\n 'conso... | python | chosen |
[
{
"from": "human",
"value": "Add basic DataSource integration test\n"
},
{
"from": "gpt",
"value": "from contextlib import closing\n\nfrom minerva.directory import DataSource\nfrom minerva.test import with_conn\n\n\n@with_conn()\ndef test_create_data_source(conn):\n with closing(conn.cursor()... | python | chosen |
[
{
"from": "human",
"value": "Access list in seperate module\n"
},
{
"from": "gpt",
"value": "from pyramid.security import (\n Allow,\n Everyone\n)\n\nclass RootFactory(object):\n \"\"\"\n Set up what permissions groups have.\n \"\"\"\n __acl__ = [\n (Allow, 'users', 'vie... | python | chosen |
[
{
"from": "human",
"value": "Add code for objective function error\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n\"\"\"\nfrom os import path, listdir\n\nimport matplotlib\nimport pandas as pd\n\nresults_dir = 'snapshot-clustering-results-k10-noDailyBounds'\nclustered_path = p... | python | chosen |
[
{
"from": "human",
"value": "Add tests for plugin settings and alert tests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.models import User\nfrom django.shortcuts import resolve_url\nfrom django.test import Test... | python | chosen |
[
{
"from": "human",
"value": "Add a3m to jones parser.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys, os\n\ninfilef = sys.argv[1]\ninfile = open(infilef)\n\nfor l in infile:\n if '>' in l:\n continue\n upperseq = ''.join([c for c in l if not c.islower()])\n ... | python | chosen |
[
{
"from": "human",
"value": "Add plugin shell execution script\n\nChange-Id: Ie2444c332e54956c547e74fa71da5a9465c0f8c8\nSigned-off-by: George Keishing <bef0a9ecac45fb57611777c8270153994e13fd2e@in.ibm.com>\n"
},
{
"from": "gpt",
"value": "import subprocess\n\n\ndef execute_cmd(parms_string, quiet... | python | chosen |
[
{
"from": "human",
"value": "Add SQLite backend example for hierarchical.py\n"
},
{
"from": "gpt",
"value": "if __name__ == '__main__': # Avoid loading during tests.\n\n import pymc as pm\n import pymc.examples.hierarchical as hier\n\n with hier.model:\n trace = pm.sample(3000, ... | python | chosen |
[
{
"from": "human",
"value": "Make migrations for footer field type change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2016-10-24 13:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migration... | python | chosen |
[
{
"from": "human",
"value": "Create command to clean non-wetsvoorstel dossiers\n"
},
{
"from": "gpt",
"value": "import logging\n\nfrom django.core.management.base import BaseCommand\n\nfrom document.models import Dossier\n\nlogger = logging.getLogger(__name__)\n\n\nclass Command(BaseCommand):\n\... | python | chosen |
[
{
"from": "human",
"value": "Add marker for 2nd error\n"
},
{
"from": "gpt",
"value": "\"\"\"Marks all fixed errors #2 on ruwiki's CheckWikipedia.\"\"\"\nimport re\nimport pywikibot\nfrom checkwiki import load_page_list, mark_error_done, log\n\nNUMBER = \"2\"\nREGEXP = r\"\"\"\n <\\s*/?\\s*ab... | python | chosen |
[
{
"from": "human",
"value": "Add utility functions to parse and to compose the document\n"
},
{
"from": "gpt",
"value": "# Reduce the dimension of the feature vector.\n\n# This script works with tf-idf.csv (produced by tf-idf.py),\n# where each document is represented with 5 most important fea... | python | chosen |
[
{
"from": "human",
"value": "Add first pass for double link list\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\n\nclass Node(object):\n\n def __init__(self, val, prev=None, next_=None):\n self.val = val\n self.prev = prev\n self.next = next_\n... | python | chosen |
[
{
"from": "human",
"value": "Add python script that installs services\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport os\nimport socket\n\n\ndef install_pyjob_run():\n print('installing pyjob_run')\n os.system('stop pyjob_run 2>&1 > /dev/null')\n os.system('cp -f ./pyj... | python | chosen |
[
{
"from": "human",
"value": "Add missed migration for daaab63\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport wagtail.wagtailcore.fields\n\n\nclass Migration(migrations.Migration):\n\n depend... | python | chosen |
[
{
"from": "human",
"value": "Add migration for default year\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2018-02-06 15:05\nfrom __future__ import unicode_literals\n\nimport datetime\nfrom django.db import migrations, models\n\n\nclass Migration(migratio... | python | chosen |
[
{
"from": "human",
"value": "Add permissions for existing jobs via migration\n"
},
{
"from": "gpt",
"value": "# https://docs.djangoproject.com/en/dev/howto/writing-migrations/#migrations-that-add-unique-fields\n\nfrom django.db import migrations\nfrom django.contrib.auth.models import Group, Use... | python | chosen |
[
{
"from": "human",
"value": "Add file for rule's left right tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rule\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration to instance & server objects validation\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django.core.validators\n\n\nclass Migration(migrations.... | python | chosen |
[
{
"from": "human",
"value": "Add test for file download\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom django.test import TestCase\n\nfrom django.core.urlresolvers import reverse\nfrom django.core.files import File\n\nfrom django.contrib.auth.models import User\n\nfrom excerptexport.models i... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for fastmath flag\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import\n\nimport math\nimport numpy as np\n\nfrom numba import unittest_support as unittest\nfrom numba.tests.support import captured_stdout, override_co... | python | chosen |
[
{
"from": "human",
"value": "Create a new lesson file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProgram s několika variacemi implementace funkce faktorial.\n\nhttp://www.pythontutor.com/visualize.html#mode=edit\n\"\"\"\n\ndef factorial_iter(n):\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a utility to generate the master passes db\n\nAssumes that amateur.txt and groundstations.txt are in the same folder.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom itertools import product\nimport pickle\nimport sys\nimport time\n\nfrom scheduli... | python | chosen |
[
{
"from": "human",
"value": "utils.datastructures.tests: Add pickle unittests for Markers\n"
},
{
"from": "gpt",
"value": "##\n# Copyright (c) 2011 Sprymix Inc.\n# All rights reserved.\n#\n# See LICENSE for details.\n##\n\n\nimport pickle\n\nfrom semantix.utils.datastructures import Void\nfrom s... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add sql function for updating default stateid\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Add a trigger on modules to set all new inserted books to have state\n\"post-publication\" in case there is a ruleset for collation.\n\"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new utils\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3.5\n\nimport unittest\nimport datetime\n\nfrom utils import get_lookback\n\n\nclass LookbackTimeTest(unittest.TestCase):\n def test_one_week(self):\n self.assertEqual(get_lookbac... | python | chosen |
[
{
"from": "human",
"value": "Add important migration to Django 1.8\n\nThis migration makes `Person.last_login` NULL-able.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.... | python | chosen |
[
{
"from": "human",
"value": "Test cases for the datasource class.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest cases for the datasource classes.\n\n:author: Martin Norbury (mnorbury@lcogt.net)\n\"\"\"\nimport json\n\nfrom nose.tools import eq_\nfrom mock import patch\n\nimport datasource\n\n\nc... | python | chosen |
[
{
"from": "human",
"value": "Add test to reproduce ordering issues\n\nThis is an attempt to reproduce an issue reported related to the\nnon-deterministic ordering of extensions.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test suites for the extension management features.\"\"\"\n\nfrom __future__ imp... | python | chosen |
[
{
"from": "human",
"value": "Set up base class for Forward Transfer metric\n"
},
{
"from": "gpt",
"value": "################################################################################\n# Copyright (c) 2021 ContinualAI. #\n# Copyrights licensed un... | python | chosen |
[
{
"from": "human",
"value": "Add the tests that drove the previous commit.\n"
},
{
"from": "gpt",
"value": "\nimport pytest\nfrom tiddlywebplugins.markdown import render\nfrom tiddlyweb.model.tiddler import Tiddler\n\n\nenviron = {\n 'tiddlyweb.config': {\n 'markdown.wiki_link_base': '... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 647. Palindromic Substrings\n\n647. Palindromic Substrings: https://leetcode.com/problems/palindromic-substrings/\n\nApproach:\n O(n^2) with Rolling hash: https://en.wikipedia.org/wiki/Rolling_hash\n It's kind of overkill though...\n"
},
{
"from... | python | chosen |
[
{
"from": "human",
"value": "Remove the configmodel for push notifications.\n\nThis feature was used to enable/disable push notifications using\nParse.com. That service died a few years ago but this was never cleaned\nup. Cleaning it up as a part of DEPR-41 now that we've removed the code\nthat references... | python | chosen |
[
{
"from": "human",
"value": "Add Python program to calculate the day of week at start of epoch\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nProgram to compute the day of week for the epoch used.\n\"\"\"\n\nimport datetime\n\nprint('// Day of week calculation needs to know th... | python | chosen |
[
{
"from": "human",
"value": "Add script to do combined tests\n"
},
{
"from": "gpt",
"value": "import sensor, time\n# Set sensor gainceiling\nsensor.set_gainceiling(16)\n# Set sensor brightness\nsensor.set_brightness(-2)\n# Set sensor to grayscale\nsensor.set_pixformat(sensor.GRAYSCALE)\n\ndef te... | python | chosen |
[
{
"from": "human",
"value": "Add wrapper script for the LCTD verification tool\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBenchExec is a framework for reliable benchmarking.\nThis file is part of BenchExec.\n\nCopyright (C) 2007-2015 Dirk Beyer\nAll rights reserved.\n\nLicensed under the Apache L... | python | chosen |
[
{
"from": "human",
"value": "Add IPython log for downscaling Gokul's LLS zarr dataset\n"
},
{
"from": "gpt",
"value": "# IPython log file\nfrom tqdm import tqdm\nimport numpy as np\nimport dask.array as da\nimport zarr\nimport itertools\nfrom skimage.transform import downscale_local_mean\n\n\nll... | python | chosen |
[
{
"from": "human",
"value": "Convert a catalog of sources to ds9 region file\n"
},
{
"from": "gpt",
"value": "'''\nA program to turn a catalog file into a ds9 region file\n'''\n\nimport phot_utils as pu\nimport Sources as S\n\ndef makeRegionFile(filename, outname):\n catalog = open(filename, ... | python | chosen |
[
{
"from": "human",
"value": "Add windows keyboard (works, but needs rate-limiting\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom toon.input.base_input import BaseInput, DummyTime\n\nclass Keyboard(BaseInput):\n def __init__(self,\n clock_source=DummyTime,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for file deletion\n"
},
{
"from": "gpt",
"value": "from tests import PMGTestCase\nimport datetime\nimport pytz\nfrom pmg.models import db, CommitteeMeeting, Event, EventFile, File, House, Committee\nfrom tests.fixtures import dbfixture, CommitteeData, Commit... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to set realm filters.\n\n(imported from commit 6590d7eb58ea6e6afc15104dd75ad56b832858fa)\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom optparse import make_option\n\nfrom django.core.management.base import Base... | python | chosen |
[
{
"from": "human",
"value": "Add python code for graphing\n"
},
{
"from": "gpt",
"value": "from bluepy.btle import *\nfrom binascii import *\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nDEVICE_UUID = '00:0B:57:0B:F6:F6'\n\nx = np.arange(100)\ny = np.ones(100) * 560\n\nplt.ion()\nfig... | python | chosen |
[
{
"from": "human",
"value": "Allow for the post_save signal already knowing of the object at hand\n"
},
{
"from": "gpt",
"value": "from django.db import IntegrityError\nfrom random import sample\n\nfrom beer_search_v2.models import Country, Brewery, SimplifiedStyle, ProductType, Product\nfrom dj... | python | chosen |
[
{
"from": "human",
"value": "Add a version of this that works on single characters, and batches on the line. It's much simpler to explain.\n"
},
{
"from": "gpt",
"value": "from keras.models import Sequential\nfrom keras.layers import Dense\nfrom keras.utils import plot_model\nimport numpy as np\... | python | chosen |
[
{
"from": "human",
"value": "Create script for boot instance in cloud\n"
},
{
"from": "gpt",
"value": "import argparse\nimport time\n\nimport novaclient.v1_1.client as nvclient\n\n\nparser = argparse.ArgumentParser(description=\"Script for vm create\")\n\nparser.add_argument(\"-openstack_user\",... | python | chosen |
[
{
"from": "human",
"value": "Add a very basic unit test for the volume renderer widget.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport numpy as np\n\nfrom traits_enaml.testing.enaml_test_assistant import EnamlTestAssistant\n\nfrom ensemble.volren.volume_data import VolumeData\nfrom e... | python | chosen |
[
{
"from": "human",
"value": "Add task to create Lutris icons from MAME icons\n"
},
{
"from": "gpt",
"value": "\"\"\"Generate banners from ProgettoSnap marquees\"\"\"\nimport os\nfrom PIL import Image\n\nfrom django.core.files.base import ContentFile\nfrom django.core.management.base import BaseC... | python | chosen |
[
{
"from": "human",
"value": "Add test to define how basic authentication should wokr\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_authentication.py.\n\nTests hugs built-in authentication helper methods\n\nCopyright (C) 2015 Timothy Edmund Crosley\n\nPermission is hereby granted, free of cha... | python | chosen |
[
{
"from": "human",
"value": "Add migrations that were pending since the 3.2 upgrade\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.2.14 on 2022-07-05 17:19\n\nimport django.core.validators\nfrom django.db import migrations, models\nimport main.models\nimport re\n\n\nclass Migration(mig... | python | chosen |
[
{
"from": "human",
"value": "Add some minimal api tests\n"
},
{
"from": "gpt",
"value": "from nbgrader import api\n\nclass TestApi(object):\n\n def test_create_assignment(self):\n a = api.Assignment(assignment_id='foo', duedate='someday')\n assert a.assignment_id == 'foo'\n ... | python | chosen |
[
{
"from": "human",
"value": "Add core nwod linting tests\n"
},
{
"from": "gpt",
"value": "import npc\nimport pytest\nimport os\nfrom tests.util import fixture_dir\n\ndef test_has_virtue():\n char_file = fixture_dir('linter', 'nwod', 'Gotta Nada.nwod')\n with open(char_file, 'r') as char_fi... | python | chosen |
[
{
"from": "human",
"value": "Add script for visualizing 2d dictionaries.\n\nUseful for debugging.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport os\nimport itertools\nimport matplotlib.pyplot as plt\nfrom parameter_prediction.datasets import dictionary\n\ndef grouper(iterable, n, fi... | python | chosen |
[
{
"from": "system",
"value": "Remove usage of remove_undocumented from core parallel_for.\n\nremove_undocumented is causing issues with our pip tests.\nremove_undocumented is not used anywhere else in core TF code\nand we have a new mechanism for annotating the public TF API.\n"
},
{
"from": "human"... | python | chosen |
[
{
"from": "human",
"value": "Add management command to import weightings\n"
},
{
"from": "gpt",
"value": "import csv\nfrom pprint import pprint\n\nfrom django.core.management.base import BaseCommand\n\nfrom django_countries import countries\nfrom forms.modelutils import CountryRegion\n\nclass Co... | python | chosen |
[
{
"from": "human",
"value": "Test quoted-printable is always applied to text\n"
},
{
"from": "gpt",
"value": "import quopri\nfrom daemail.message import DraftMessage\n\nTEXT = 'àéîøü'\n\ndef test_quopri_text():\n msg = DraftMessage()\n msg.addtext(TEXT)\n blob = msg.compile()\n ass... | python | chosen |
[
{
"from": "human",
"value": "Add solution to Scooby doo problem\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfor i in range(1,101):\n if i%3 == 0 and i%7==0:\n print(\"Scooby Doo\")\n elif i%3 == 0:\n print(\"Scooby\")\n elif i%7 == 0:\n print(\"Doo\")... | python | chosen |
[
{
"from": "human",
"value": "Add migration after help_text changes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.20 on 2019-04-10 19:52\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migr... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests for exception handling\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport pytest\n\nfrom wait_for import wait_for, TimedOutError\n\n\nclass MyError(Exception):\n \"\"\"A sample exception for use by the tests in this module.\"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Create command to remove duplicate submitters\n"
},
{
"from": "gpt",
"value": "import logging\n\nfrom django.core.management.base import BaseCommand\nfrom django.db import transaction\n\nfrom document.models import Document\nfrom document.models import Submitter\n\nl... | python | chosen |
[
{
"from": "human",
"value": "Add script to detect missing results between yaml files that we\nintend to compare.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# vim: set sw=2 ts=2 softtabstop=2 expandtab:\nimport argparse\nimport os\nimport logging\nimport sys\nimport yaml\n\ntry:\n #... | python | chosen |
[
{
"from": "human",
"value": "Add two tests for utils.py\n"
},
{
"from": "gpt",
"value": "from redidropper.utils import clean_int, allowed_file\n#import unittest\n#class TestUtils(unittest.TestCase):\n\ndef test_clean_int():\n \"\"\"\n Verify common cases\n \"\"\"\n cases = [\n ... | python | chosen |
[
{
"from": "human",
"value": "Use command line arguments to tell it what to do\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python2.7\n\nimport sys\n\nWIDTH = 10\nLENGTH = 22\n\ndef main():\n command_line_arguments = sys.argv\n print command_line_arguments[0]\n \n if len(command_line_a... | python | chosen |
[
{
"from": "human",
"value": "Add this class useful for debugging, which logs requests passing through it.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom paste.translogger import TransLogger\n\ndef factory(config, **settings):\n\tdef filter(app):\n\t\tconfig.update(settings);\n\t\tret... | python | chosen |
[
{
"from": "human",
"value": "Remove document tables and audit table\n"
},
{
"from": "gpt",
"value": "\"\"\"Remove document-related tables\n\nRevision ID: af9b37868cf3\nRevises: 284a9ec16306\nCreate Date: 2019-06-13 17:45:43.310462\n\"\"\"\nfrom alembic import op\n\n# revision identifiers, used b... | python | chosen |
[
{
"from": "human",
"value": "Add script to compute the representation of each class in the different areal units\n"
},
{
"from": "gpt",
"value": "\"\"\"representation_classes.py\n\nCompute the representation of the emergent classes in the dataset and the\nvariance obtained for the null model.\n\... | python | chosen |
[
{
"from": "human",
"value": "Add implementation of pygametemplate.Image class which passes all unit tests :)\n"
},
{
"from": "gpt",
"value": "\"\"\"Module containing the Image class for easily adding/removing images from RAM.\"\"\"\nfrom pygametemplate import load_image\n\n\nclass Image:\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a utility for indexing structure of HDF5 files\n"
},
{
"from": "gpt",
"value": "import csv\nimport h5py\nimport sys\n\ndef hdf5_datasets(grp):\n \"\"\"Print CSV data of all datasets in an HDF5 file.\n\n path, shape, dtype\n \"\"\"\n writer = csv.write... | python | chosen |
[
{
"from": "human",
"value": "Convert Sorted Array to Binary Search Tree\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\n# author: Fei Gao <leetcode.com@feigao.xyz>\n\n# Problem: convert sorted array to binary search tree\n#\n# Given an array where elements are sorted in ascending order,\n# c... | python | chosen |
[
{
"from": "human",
"value": "Add basic unit test of getIdentifierScheme\n"
},
{
"from": "gpt",
"value": "\"\"\"test_util.py\"\"\"\n\n\nfrom d1lod import util\n\n\ndef test_can_match_doi_strings():\n \"\"\"Tests the matching algorithm which takes unstructured strings and guesses\n their ide... | python | chosen |
[
{
"from": "human",
"value": "Add ServiceTypes as a data migration instead of fixtures\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 def add_servicety... | python | chosen |
[
{
"from": "human",
"value": "Add the test for functions.py\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import (absolute_import, division,\n print_function, unicode_literals)\n\n__author__ = \"Yuji Ikeda\"\n\nimport unitt... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for calculate\n"
},
{
"from": "gpt",
"value": "from calculate import calculate\n\n\ndef test_calculate():\n assert calculate('5+5') == 10\n assert calculate('5*5') == 25\n assert calculate('10/2') == 5\n assert calculate('10-4') == 6\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests to ensure the setUp and tearDown decorators work\n"
},
{
"from": "gpt",
"value": "from dtest import *\nfrom dtest.util import *\n\n\nclass TestAlternate(DTestCase):\n alternate = None\n\n def setUp(self):\n assert_is_none(self.alternate)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to get machine characteristics\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport subprocess\nimport argparse\n\n# inspired by https://www.cyberciti.biz/faq/linux-ram-info-command/ and https://en.wikipedia.org/wiki/Hdparm\n\ndef main():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add making a signal mask and moment arrays for the CO smoothed cube\n"
},
{
"from": "gpt",
"value": "\n'''\nMake a version of the CO(2-1) data at the resolution of the 14B-088 HI data\n'''\n\nfrom spectral_cube import SpectralCube, Projection\nfrom spectral_cube.cube... | python | chosen |
[
{
"from": "human",
"value": "Add script to save a mapping for body parts to categories\n\nThe script creates a json file containing categories->(Dutch) words for\nbody parts. The mapping is based on Inger Leemans' division.\n"
},
{
"from": "gpt",
"value": "\"\"\"Make a mapping from body part wor... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.