conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a test to the notification list endpoint\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n###############################################################################\n# Copyright Kitware Inc.\n#\n# Licensed under the Apache... | python | chosen |
[
{
"from": "human",
"value": "Create similar category counter command\n"
},
{
"from": "gpt",
"value": "import logging.config\nfrom operator import or_\n\nfrom django.core.management.base import BaseCommand\n\nfrom crawler.models import *\n\nlogger = logging.getLogger('crawler.command')\n\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add framework for new Twisted plugin to be filled in as functionality is actually implemented\n"
},
{
"from": "gpt",
"value": "from twisted.application.service import IServiceMaker\nfrom twisted.plugin import IPlugin\nfrom twisted.python import usage\nfrom zope.inter... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for IP regex\n\nFixes #360\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom pycroft.helpers import net\n\n\nclass IpRegexTestCase(unittest.TestCase):\n def test_ip_regex(self):\n regex = net.ip_regex\n self.assertTrue(regex.ma... | python | chosen |
[
{
"from": "human",
"value": "Add new utility base file for module discovery\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Copyright (C) 2017 Kubos Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for DataHandler\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.append('..')\nimport unittest\nfrom datahandler import data_handler_factory\nfrom sweep import Sweep\n\n\nclass DataHandlerTestCase(unittest.TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test Python program.\n"
},
{
"from": "gpt",
"value": "from peer import begin_tran, end_tran, shared\n\nbegin_tran()\nlst = shared.setdefault('lst', [0, 1])\nend_tran()\n\nwhile True:\n begin_tran()\n next_num = lst[-2] + lst[-1]\n s.append(next_num)\n end_t... | python | chosen |
[
{
"from": "human",
"value": "Add small utility module for kb_ commands.\n"
},
{
"from": "gpt",
"value": "# Copyright 2010 Mike Wakerly <opensource@hoho.com>\n#\n# This file is part of the Pykeg package of the Kegbot project.\n# For more information on Pykeg or Kegbot, see http://kegbot.org/\n#\n... | python | chosen |
[
{
"from": "human",
"value": "Add layer creation sanity checks\n"
},
{
"from": "gpt",
"value": "from thinc.api import registry\nimport pytest\n\n\n@pytest.mark.parametrize(\n \"name,kwargs\",\n [\n (\"CauchySimilarity.v0\", {}),\n (\"Dropout.v0\", {}),\n (\"Embed.v0\", ... | python | chosen |
[
{
"from": "human",
"value": "Add problem 2 even fibonacci numbers python solution\n"
},
{
"from": "gpt",
"value": "#\n'''\nProject Euler - Problem 2 - Even Fibonacci numbers\nhttps://projecteuler.net/problem=2\n\nEach new term in the Fibonacci sequence is generated by adding the previous two\nte... | python | chosen |
[
{
"from": "human",
"value": "Add export script for committee members\n"
},
{
"from": "gpt",
"value": "\"\"\"Export a CSV listing committee members with term dates.\"\"\"\n\nimport unicodecsv as csv\nimport os\nimport collections\n\nfrom pombola.core.models import Person, Organisation, Organisati... | python | chosen |
[
{
"from": "human",
"value": "Add a test for crossmatch\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, division, absolute_import\nfrom tests import FlexGetBase\n\nclass TestCrossmatch(FlexGetBase):\n __yaml__ = \"\"\"\n tasks:\n test_title:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a mock log handler for aggregating log messages\n"
},
{
"from": "gpt",
"value": "import logging\n\n\nclass MockHandler(logging.Handler):\n def __init__(self, *args, **kwargs):\n self.reset()\n logging.Handler.__init__(self, *args, **kwargs)\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Declare number of Networks used during testing\n\nDone via conftest.py file (a special feature of pytest)\nthat calls pandana.network.reserve_num_graphs.\n"
},
{
"from": "gpt",
"value": "import pandana.network as pdna\n\n# Pandana uses global state for networks,\n# s... | python | chosen |
[
{
"from": "human",
"value": "Test example to recreate kernel from hackathon and explore loopy tutorial\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport loopy as lp\n\ntarget = lp.CudaTarget()\n\nkernel = lp.make_kernel(\n\t\"{ [i_node,j_node]: 0<=i_node,j_node<n_node}\", \n\t\"\"\"\n\... | python | chosen |
[
{
"from": "system",
"value": "Change old 'sliver' ref to instance\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom core.models import User, Service, SingletonModel, PlCoreBase, Instance\nfrom core.models.plcorebase import StrippedCharField\nimport os\nfrom django.db import m... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for _compat.py\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nUnit tests for salt.config\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\nimport logging\nimport sys\n\n# Import Salt... | python | chosen |
[
{
"from": "human",
"value": "Add a counter to help with debugging.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env\n\nfrom pupa.core import db\n\n\nfor orga in db.organizations.find({\"classification\": \"committee\"}):\n memberships = db.memberships.find({\n \"organization_id\": orga[... | python | chosen |
[
{
"from": "human",
"value": "Add a factility to list regions/locations.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n'''\nCreated on Dec 15, 2014\n\n@author: lwoydziak\n'''\nfrom jsonconfigfile import Env\nfrom providers import digitalOceanHosting\n\n'''usage: \nlist_locations.py ... | python | chosen |
[
{
"from": "human",
"value": "Convert a fasta file to fastq\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport argparse\nfrom rob import read_fasta\n\n__author__ = 'Rob Edwards'\n\nparser = argparse.ArgumentParser(description='Convert a fasta file to fastq, faking the qual scores')\np... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert positions by adding extra columns for build\n"
},
{
"from": "gpt",
"value": "\"\"\"\nWill read a gzipped file containing build conversion info for snps (based on\nsnpdb), and save these extra values to the fasttrack database.\n\nRecent version i... | python | chosen |
[
{
"from": "human",
"value": "Add initial upgrade for supporting exp_info\n"
},
{
"from": "gpt",
"value": "\"\"\"Add experiment information\n\nRevision ID: 2ecc7c4ec0c5\nRevises: None\nCreate Date: 2013-04-21 19:16:09.441855\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '2ecc7... | python | chosen |
[
{
"from": "human",
"value": "Add module for optional dependency checking\n"
},
{
"from": "gpt",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Checks for optional dependencies using lazy import from\n`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Test Email Notifier SMTP Password\n"
},
{
"from": "gpt",
"value": "from kubernetes.client import CustomObjectsApi\nfrom .common import random_str\n\n\ndef test_notifier_smtp_password(admin_mc, remove_resource):\n client = admin_mc.client\n name = random_str()\n... | python | chosen |
[
{
"from": "human",
"value": "Add file for converting the tokenizer tests to tree tests (assuming html5lib works with them correctly)\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport json\nimport re\n\nimport html5lib\nimport support\nimport test_parser\nimport test_tokenizer\n\np =... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests for the xcor2 module.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom numpy import all, array\n\nfrom .. import np, xcor2\n\n\ndef test_zeropad():\n x = array([[1]])\n y = array([[1, 0, 0], [0, 0, 0], [0, 0, 0]])\n z = xcor... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 538. Convert BST to Greater Tree\n\n538. Convert BST to Greater Tree: https://leetcode.com/problems/convert-bst-to-greater-tree/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(s... | python | chosen |
[
{
"from": "human",
"value": "Add config without dropout for 250 hidden units\n"
},
{
"from": "gpt",
"value": "Config(\n net=Config(\n dim_dec=250,\n dim_bidir=250,\n dims_bottom=[250],\n dec_transition='GatedRecurrent',\n enc_transition='GatedRecurrent',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add input dialog for links\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport wx\nimport platform\n\n\nclass InputLink(wx.Dialog):\n def __init__(self, parent, id, title, ico_folder):\n\n if platform.system() == 'Darwin':\n wx.Dialo... | python | chosen |
[
{
"from": "human",
"value": "Add utils package with offtopic functions\n\nAdd Gender class for proper Gender representation\n"
},
{
"from": "gpt",
"value": "# Author: Álvaro Parafita (parafita.alvaro@gmail.com)\n\nclass Gender:\n \"\"\"\n Class to represent gender as ints.\n Def... | python | chosen |
[
{
"from": "human",
"value": "Add work from exercise 21 in lpthw.\n"
},
{
"from": "gpt",
"value": "def add(a, b):\n print \"ADDING %d + %d\" % (a, b)\n return a + b\n\ndef subtract(a, b):\n print \"SUBTRACTING %d - %d\" % (a, b)\n return a -b\n\ndef multiply(a, b):\n print \"MULTIP... | python | chosen |
[
{
"from": "human",
"value": "Add testcase for toolbar and tray palettes.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2007, Red Hat, Inc.\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published ... | python | chosen |
[
{
"from": "human",
"value": "Add an example to decorate each of the functions in the class.\n"
},
{
"from": "gpt",
"value": "from functools import wraps\n\n\ndef decorate_all_functions(func_decorator):\n def decorator(cls):\n for name, obj in vars(cls).items():\n if callable... | python | chosen |
[
{
"from": "human",
"value": "Add reminder for testing gross total volume\n"
},
{
"from": "gpt",
"value": "from gypsy import gross_total_volume\n\ndef test_pl():\n # TODO: known value\n # TODO: 0 as an input\n # TODO: negative as an input\n # TODO: scalar and array\n gross_total_vo... | python | chosen |
[
{
"from": "human",
"value": "Add first basic version of exercise 4.1.\n"
},
{
"from": "gpt",
"value": "# 4-1. Pizzas\n\nfavorite_pizzas = [\"Columpus\", \"Marco Polo\", \"Amerikana\"]\n\nfor pizza in favorite_pizzas:\n\tprint(pizza)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Upgrade procedure for EDRN portal\n\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n# Copyright 2010 California Institute of Technology. ALL RIGHTS\n# RESERVED. U.S. Government Sponsorship acknowledged.\n#\n# Upgrade an existing installation of the EDRN public po... | python | chosen |
[
{
"from": "human",
"value": "Test RESTCONF device (for XRD and eventually other debugging purposes)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# Copyright 2015 - 2016 Boling Consulting Solutions, bcsw.net\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add example showing how to pickle/unpickle a BSpline object\n"
},
{
"from": "gpt",
"value": "###################################################################################\n# Pickle/unpickle functionality for the BSpline class. #\n# Wo... | python | chosen |
[
{
"from": "human",
"value": "Add basic argument parser that will be used in basic srt tools\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport sys\n\n\ndef parse_basic_args(args=sys.argv[1:]):\n parser = argparse.ArgumentParser(description=__doc__)\n parser.a... | python | chosen |
[
{
"from": "human",
"value": "Test two windows drawing GL with different contexts.\n\n\n\ngit-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@45 14d46d22-621c-0410-bb3d-6f67920f7d95\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\n'''\n\n__docformat__ = 'restructuredtext'\n__versio... | python | chosen |
[
{
"from": "human",
"value": "Create a script that parse asm/unistd_64.h to fetch syscalls ids.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nfrom __future__ import print_function\n\nimport argparse\nimport sys\nimport re\n\nPREAMBULE = \"\"\"\n#include <python2.7/Python.h>\n\n#inclu... | python | chosen |
[
{
"from": "human",
"value": "Add example of an inwardly-propagating cylindrical flame\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nAn inwardly-propagating, cylindrical, strained, lean flame.\nThe flame radius, defined by the centroid of the heat release\nrate, is specified. Th... | python | chosen |
[
{
"from": "human",
"value": "Add test for have_term method if array is passed\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\"\"\"\nfrom unittest import TestCase\nfrom grammpy import Grammar\... | python | chosen |
[
{
"from": "human",
"value": "Add migration operation for easy add/remove component types in regions\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\nALL_REGIONS = object()\n\n\nclass _ManageComponentTypeInRegions(migrations.RunPython):\n \"\"\"\n Requires all migratio... | python | chosen |
[
{
"from": "human",
"value": "Set up ISAPI link for directory monitor\n\nadded isapi_monitor.py\n"
},
{
"from": "gpt",
"value": "import win32traceutil\r\nimport monitor_directory\r\nimport isapi_wsgi\r\n\r\ndef __ExtensionFactory__ ():\r\n return isapi_wsgi.ISAPISimpleHandler (monitor_direc... | python | chosen |
[
{
"from": "human",
"value": "Add test for rating signals\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom django.core.exceptions import ObjectDoesNotExist\n\nfrom adhocracy4.ratings import models\n\n\n@pytest.mark.django_db\ndef test_delete_of_content_object(rating):\n question = rating... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the AcceptedUpload parser\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nimport os, sys\nsys.path.append... | python | chosen |
[
{
"from": "human",
"value": "Add STATS type to display online opers\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom txircd.utils import now\nfrom zope.interface import implements\n\nclass StatsOnlineOpers(Modu... | python | chosen |
[
{
"from": "system",
"value": "Extend get_channel_id_* to return the full path to the exported DBs.\n"
},
{
"from": "human",
"value": "import fnmatch\nimport logging as logger\nimport os\nimport uuid\n\nlogging = logger.getLogger(__name__)\n\ndef _is_valid_hex_uuid(uuid_to_test):\n try:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for combinatorial loops\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom myhdl import *\n\ntimes_called = 0\n\n@block\ndef Demonstration():\n a = Signal(False)\n\n @instance\n def poke_loop():\n yield del... | python | chosen |
[
{
"from": "human",
"value": "Create initial state for UNP from lattice simulation.\n"
},
{
"from": "gpt",
"value": "import uci.BorisUpdater as BorisUpdater\nimport uci.Ptcls as Ptcls\nimport numpy as np\n\n\n# Some helpful constants.\nfund_charge = 1.602176565e-19\n\n\n# Mass of Sr88 ions.\natom... | python | chosen |
[
{
"from": "human",
"value": "Add ass3 work until question 7, Come up with both iterative and analytical growth function for the two interval problem\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom scipy.special import comb\ndef hoeffding_inequality_sample_size_needed(probability, error... | python | chosen |
[
{
"from": "human",
"value": "Add basic functionality for transforming boolean equation to tt schema"
},
{
"from": "gpt",
"value": "\"\"\"\r\nA module for extracting an manipulating information from Boolean equations.\r\n\"\"\"\r\n\r\nfrom tt.utils import without_spaces\r\n\r\neq_transform_sym_di... | python | chosen |
[
{
"from": "human",
"value": "Add script to get all memories\n"
},
{
"from": "gpt",
"value": "import argparse\nimport os\n\nparser = argparse.ArgumentParser(description='Collect memories from a corpus')\nparser.add_argument('-c', '--corpus_dir', default='hp_corpus',\n type=str,... | python | chosen |
[
{
"from": "human",
"value": "Add migrations to models from django18 upgrade\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django_extensions.db.fields\n\n\nclass Migration(migrations.Migration)... | python | chosen |
[
{
"from": "human",
"value": "Add script for extracting SOLr data\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nCrawl the SOLr indexes to get all dataset documents for a particular project\nand extract enough information to create a snapshot of the current state. \n\nQuerying S... | python | chosen |
[
{
"from": "human",
"value": "Add a script that fixes tag files\n\nThe kaf files used for annotation were generated using folia files\ncontain strange ids (starting with lg-added). Unfortunately, these\nfolia files were not saved. Therefore, the word ids in the kaf files\nmust be updated to the word ids in t... | python | chosen |
[
{
"from": "human",
"value": "Add a simplified test that works\n"
},
{
"from": "gpt",
"value": "\na = 1.123456\nb = 10\nc = -30\nd = 34\ne = 123.456\nf = 19892122\n\n# form 0\ns = \"b=%d\" % b\nprint s\n\n# form 1\ns = \"b,c,d=%d+%d+%d\" % (b,c,d)\nprint s\n\n# form 2\n#s = \"b=%(b)0d and c=%(c)d... | python | chosen |
[
{
"from": "human",
"value": "Fix cinder functional tests job\n\nWe have to register cinder objects to run functional tests.\n\nCloses-Bug: #1674627\nChange-Id: Ib385382878185c958ea813e324b0e88961662a3a\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"Li... | python | chosen |
[
{
"from": "human",
"value": "Migrate certification for existing settings\n\n- [WAL-622]\n\nCopy certifications from existing openstack service settings to\nexistings openstack_tenant service settings.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_litera... | python | chosen |
[
{
"from": "human",
"value": "Update intervention language editing to use list passed in via context\n"
},
{
"from": "gpt",
"value": "from django.conf.urls import url\n\nfrom .views import ManifestList, ManifestDetail, CanvasDetail, \\\n CanvasAutocomplete\n\n# override the default djiffy view... | python | chosen |
[
{
"from": "human",
"value": "Test Completeness of Tokens against the USFM files\n\nThis program tests the completeness of the token list against the usfm\r\nfiles from the tokens created. This will help us in testing if any words or\r\nphrases that are not correctly represented in the token list.\r\n\r\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test in the gallery to show how to deal with function that can return both Geometry and Raster\n"
},
{
"from": "gpt",
"value": "\"\"\"\nReproject a Raster using ST_Transform\n=====================================\n\nThe `ST_Transform()` function (and a few othe... | python | chosen |
[
{
"from": "human",
"value": "Add the folder creating endpoint\n"
},
{
"from": "gpt",
"value": "import asyncio\n\nfrom waterbutler.server import utils\nfrom waterbutler.server.handlers import core\n\n\nclass FolderHandler(core.BaseHandler):\n\n ACTION_MAP = {\n 'GET': 'create_folder',\n... | python | chosen |
[
{
"from": "human",
"value": "Create Publisher models\nbasic architecture publication\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom datetime import datetime\n\n\n\nclass PublisherMnager(models.... | python | chosen |
[
{
"from": "human",
"value": "Set transparency of QGIS Raster Layer\n\nRun in QGIS Python Console.\n"
},
{
"from": "gpt",
"value": "from qgis.core import QgsRasterTransparency\n\nprint 'Start'\nactive_layer = l = qgis.utils.iface.mapCanvas().currentLayer()\nraster_transpareny = active_layer.rend... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 405. Convert a Number to Hexadecimal\n\n405. Convert a Number to Hexadecimal: https://leetcode.com/problems/convert-a-number-to-hexadecimal/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def toHex(self, num):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to create a ticket category\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Create a ticket category for a party.\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nimport click\n\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem A4\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*- \n\n# Copyright 2014 Fabian M.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating LaTex qtree descriptions\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Produce LaTex qtree output from the parglare parse trees.\n\nfrom parglare import Grammar, GLRParser, NodeNonTerm\n\nINPUT = '1 + 2 * 3 + 4'\n\ngrammar = r''... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for AppConfig\n\nOh, that sweet, sweet 100% coverage. Aw yiss.\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom clean_fields.apps import CleanFieldsConfig\n\n\nclass CleanFieldsConfigTestCase(TestCase):\n def test_name_class_at... | python | chosen |
[
{
"from": "human",
"value": "Add tests for algorithm choices\n\nThe addition of these tests increases coverage to 100%.\n"
},
{
"from": "gpt",
"value": "import wlgen\r\nimport paw\r\nfrom .base import paw_test\r\n\r\n\r\nclass choose_algo_test(paw_test):\r\n def test_choose_gen_wordlist(self)... | python | chosen |
[
{
"from": "human",
"value": "Add methods for Todd ANN\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nANN based on Todd's design\n\"\"\"\n\nfrom pybrain.structure.connections.connection import Connection\nfrom pybrain.datasets.sequential import SequentialDataSet\nfrom scipy imp... | python | chosen |
[
{
"from": "human",
"value": "chore(pictures): Set status in-progress for existing pictures\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8; -*-\n# This file is part of Superdesk.\n# For the full copyright and license information, please see the\n# AUTHORS and LICENSE files distributed with ... | python | chosen |
[
{
"from": "human",
"value": "Add bulk custom property example\n"
},
{
"from": "gpt",
"value": "import requests\nfrom orionsdk import SwisClient\n\nnpm_server = 'localhost'\nusername = 'admin'\npassword = ''\n\nverify = False\nif not verify:\n from requests.packages.urllib3.exceptions import I... | python | chosen |
[
{
"from": "human",
"value": "Solve Minimum Absolute Difference in an Array\n"
},
{
"from": "gpt",
"value": "#!/bin/python3\n\nimport sys\n\n\ndef minimum_absolute_difference(array):\n sorted_pairs = zip(sorted(array)[:-1], sorted(array)[1:])\n differences = [abs(a - b) for a, b in sorted_p... | python | chosen |
[
{
"from": "human",
"value": "Add some basic console tests\n"
},
{
"from": "gpt",
"value": "from AcmeTinyHelperConsole import AcmeTinyHelperConsole\n\nclass TestAcmeTinyHelper:\n\n def test_run(self, capsys):\n console = AcmeTinyHelperConsole()\n\n opts = [('--path', '/etc/letsen... | python | chosen |
[
{
"from": "human",
"value": "Add fetal anomaly scan model\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import Column, Integer, Date, Index, Boolean, String\n\nfrom radar.database import db\nfrom radar.models.common import MetaModelMixin, uuid_pk_column, patient_id_column, patient_relationshi... | python | chosen |
[
{
"from": "human",
"value": "Add the first test that actually tests ah_bootstrap.use_astropy_helpers directly. Will be adding more tests soon following the same general pattern.\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom setuptools.sandbox import run_setup\n\nfrom . import run_cmd\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Revert \"Added version printing\"\"\n\nThis reverts commit 7f392958bc8d4327e0e9d6dc169eee26ea80c279.\n"
},
{
"from": "gpt",
"value": "import sys\n\nif __name__ == '__main__':\n print 'Hello world'\n print 'Your current version is', sys.version\n pri... | python | chosen |
[
{
"from": "human",
"value": "Create a script for printing the chatroom topic with the next event.\n"
},
{
"from": "gpt",
"value": "import urllib\nimport yaml\nfrom datetime import datetime\nfrom icalendar import Calendar\n\n# Load configuration data\nwith open('config.yaml', 'r') as f:\n conf... | python | chosen |
[
{
"from": "human",
"value": "Convert between period, semimajor axis, and total mass for Keplerian orbit.\n\nFor cases where a quick and easy conversion between period and semimajor axis\nis needed for some sort of binary system, this function will be able to do the\nconversion relatively quickly by taking o... | python | chosen |
[
{
"from": "system",
"value": "Revert to 2.1.0.dev0 for test release.\n"
},
{
"from": "human",
"value": "# This file is imported from __init__.py and exec'd from setup.py\n\nMAJOR = 2\nMINOR = 1\nMICRO = 0\nRELEASE = False\n\n__version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)\n\nif not RELEASE:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test to json default\n"
},
{
"from": "gpt",
"value": "from cartolafc.util import json_default\nfrom datetime import datetime\n\ndef test_json_default():\n date = datetime(\n year=2019,\n month=10,\n day=10,\n hour=0,\n minute... | python | chosen |
[
{
"from": "human",
"value": "Create address column on person table\n"
},
{
"from": "gpt",
"value": "\"\"\"Create address column in person table\n\nRevision ID: 534f7c1fb55f\nRevises: 13d42d50c79a\nCreate Date: 2013-05-12 14:33:19.490150\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevi... | python | chosen |
[
{
"from": "human",
"value": "Add solution to challenge 3.\n"
},
{
"from": "gpt",
"value": "from __future__ import division\nimport base64\nimport collections\nimport string\n\nexpected_frequency = {\n 'e': .12702,\n 't': .9056,\n 'a': .8167,\n 'o': .7507,\n 'i': .6966,\n 'n': .... | python | chosen |
[
{
"from": "human",
"value": "Print an int as a hex value\n"
},
{
"from": "gpt",
"value": "'''\n\nTask: Convert a non-negative integer to a hex value for printing\n\n\nCopyright 2017, Dave Cuthbert. License MIT\n'''\n\n\ndef int_to_hex(number):\n \"\"\"\n Check 0 \n >>> int_to_hex(0)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add first version of tests file\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\n\nfrom expects import *\nimport xml.dom.minidom\nfrom sii.resource import SII\nfrom dicttoxml import dicttoxml\n\nclass Period():\n def __init__(self, name):\n self.na... | python | chosen |
[
{
"from": "human",
"value": "Add logistic regression experiment; matching RF performance\n"
},
{
"from": "gpt",
"value": "# IPython log file\n# Run this in the NewEM data folder\n\n\nfrom gala import classify\nX, y = classify.load_training_data_from_disk('training-data-0.h5',\n names=['da... | python | chosen |
[
{
"from": "human",
"value": "Add function to return list of stocks\n"
},
{
"from": "gpt",
"value": "import datetime\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib import finance\nfrom matplotlib.collections import LineCollection\t\nfrom sklearn import cluster, covariance, ... | python | chosen |
[
{
"from": "human",
"value": "Add simple tests that the release information exists\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom magnate import release\n\n\ndef test_release_info():\n assert hasattr(release, 'AUTHOR')\n assert hasattr(release, 'MAINTAINER')\n assert hasattr(rele... | python | chosen |
[
{
"from": "human",
"value": "Add sample for Plasma effect.\n"
},
{
"from": "gpt",
"value": "from asciimatics.renderers import Plasma\nfrom asciimatics.scene import Scene\nfrom asciimatics.screen import Screen\nfrom asciimatics.effects import Print\nfrom asciimatics.exceptions import ResizeScreen... | python | chosen |
[
{
"from": "human",
"value": "Add script for cookie cutting\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\" Utility functions for spatial processing.\"\"\"\nimport click\nimport fiona\nimport logging\nimport numpy as np\nimport numpy.ma as ma\nimport os\ni... | python | chosen |
[
{
"from": "human",
"value": "Add an example test in Portuguese\n"
},
{
"from": "gpt",
"value": "# Portuguese Language Test - Python 3 Only!\nfrom seleniumbase.translate.portuguese import CasoDeTeste\n\n\nclass MinhaClasseDeTeste(CasoDeTeste):\n\n def test_exemplo_1(self):\n self.abrir_... | python | chosen |
[
{
"from": "human",
"value": "Add system info test script.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom myDevices.os.systeminfo import SystemInfo\nfrom myDevices.utils.logger import setInfo, info\n\n\nclass SystemInfoTest(unittest.TestCase):\n def setUp(self):\n setInfo()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for math functions in nopython context.\n"
},
{
"from": "gpt",
"value": "import math\nimport numpy as np\nimport unittest\n#import logging; logging.getLogger().setLevel(1)\n\nfrom numba import *\n\ndef test_exp(a):\n return math.exp(a)\n\ndef test_sqrt(a)... | python | chosen |
[
{
"from": "human",
"value": "Add simple unit test module\n"
},
{
"from": "gpt",
"value": "import os, sys, unittest\nfrom pointfree import *\n\nclass CurryingTest(unittest.TestCase):\n def testCurrying1(self):\n @curryable\n def add(a, b):\n return a + b\n\n @cu... | python | chosen |
[
{
"from": "human",
"value": "Add a test for update_condmatr\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- encoding: utf-8 -*-\n\nimport unittest as ut\n\nimport stripeline.maptools as mt\nimport numpy as np\n\n\nclass TestMaptools(ut.TestCase):\n\n def test_condmatr(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a helper script, ported to Python.\n\n* tools/dev/wc-format.py: New.\n Prints the working copy format of a given directory.\n\n\ngit-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@995260 13f79535-47bb-0310-9956-ffa450edef68\n"
},
{
"from": "gpt",
"value":... | python | chosen |
[
{
"from": "human",
"value": "Add tests for documents models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom documents.models import Document, Page\nfrom users.models import User\nimport pytest\nimport mock\n\nfrom documents.models import ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.