conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add tests for generate resource view\n"
},
{
"from": "gpt",
"value": "import os\nfrom django.test import tag\nfrom django.urls import reverse\nfrom tests.BaseTestWithDB import BaseTestWithDB\nfrom tests.resources.ResourcesTestDataGenerator import ResourcesTestDataGen... | python | chosen |
[
{
"from": "human",
"value": "Add command remove non leaf annotations\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom datasets.models import *\nimport json\nfrom datasets.models import Annotation, Dataset\n\n\nclass Command(BaseCommand):\n help = 'Rem... | python | chosen |
[
{
"from": "system",
"value": "Update dumping to osf logic\n"
},
{
"from": "human",
"value": "from scrapi.processing.osf import crud\nfrom scrapi.processing.osf import collision\nfrom scrapi.processing.base import BaseProcessor\n\n\nclass OSFProcessor(BaseProcessor):\n NAME = 'osf'\n\n def ... | python | chosen |
[
{
"from": "human",
"value": "Add an example command to toggle between disassembly-only and source mode.\n\nSometimes you are debugging in source, but you really only want to see\nthe disassembly. That's easy to do but you have to set a few variables.\nThis command toggles between your old values, and a dis... | python | chosen |
[
{
"from": "human",
"value": "Remove dixon and asterisk test\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2016-05-18 22:22\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add sample smart tool for testing purposes\n"
},
{
"from": "gpt",
"value": "import argparse\n\nfrom dtoolcore import DataSet\n\ndef main(dataset_path, identifier, output_path):\n dataset = DataSet.from_path(dataset_path)\n fpath = dataset.abspath_from_identifie... | python | chosen |
[
{
"from": "human",
"value": "Add test case for special tokens\n"
},
{
"from": "gpt",
"value": "from tests import TestCase\n\n\nclass SignedIntegerTokenTestCase(TestCase):\n def setup_method(self, method):\n TestCase.setup_method(self, method)\n self.session.add(\n sel... | python | chosen |
[
{
"from": "human",
"value": "Add file with premium dates task\n"
},
{
"from": "gpt",
"value": "from datetime import date\n\n\ndef get_first_payment_date(signup_date, previous_premium):\n raise NotImplementedError()\n\n\ndef get_end_date(sign_up_date, cancel_date):\n raise NotImplementedErr... | python | chosen |
[
{
"from": "human",
"value": "Add trivial pricing handler - Product/Variant field getter\n"
},
{
"from": "gpt",
"value": "from django.db.models import Min, Max\nfrom ...pricing import Price\n\nclass FieldGetter(object):\n def __init__(self, field_name='price', currency=None):\n self.cur... | python | chosen |
[
{
"from": "human",
"value": "Add script to build OpenSpace with no modules enabled\n"
},
{
"from": "gpt",
"value": "import os\nfrom subprocess import call\n\n# To be called from the build folder in the OpenSpace\nmodules = os.listdir(\"../modules\")\n\ncmd = [\"cmake\"]\ncmd.append(\"-DGHOUL_USE... | python | chosen |
[
{
"from": "human",
"value": "Add migration file to reflect use of db_column in models"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django.contrib.gis.db.models.fields\n\n\nclass Migration(migra... | python | chosen |
[
{
"from": "human",
"value": "Add migration for removing deadline\n"
},
{
"from": "gpt",
"value": "\"\"\"removed deadline column pimpy\n\nRevision ID: 299d2746edd\nRevises: 40f1fd0d52\nCreate Date: 2015-07-18 13:21:16.172796\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '299d2... | python | chosen |
[
{
"from": "human",
"value": "Add betweeness centrality and load centrality test.\n\n--HG--\nextra : convert_revision : svn%3A3ed01bd8-26fb-0310-9e4c-ca1a4053419f/networkx/trunk%401110\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom nose.tools import *\nimport networkx\n\nclass TestB... | python | chosen |
[
{
"from": "human",
"value": "Add an uncommitted test file\n"
},
{
"from": "gpt",
"value": "import mock\nimport unittest\n\nfrom .models import B\nfrom json import dumps\nfrom sir import util\nfrom sir.schema import searchentities\n\n\nclass VersionCheckerTest(unittest.TestCase):\n def setUp(s... | python | chosen |
[
{
"from": "human",
"value": "Order legs of a flight trip using recursion"
},
{
"from": "gpt",
"value": "def next_leg(flights, source):\n \"\"\"Find and append next flight to trip\"\"\"\n for leg in flights:\n if leg[0] == source:\n trip.append(leg)\n source = l... | python | chosen |
[
{
"from": "human",
"value": "Add small test script for python bindings\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# This is just a simple test script to check whether the python bindings are\n# actually working as intended\n\nfrom __future__ import print_function, absolute_import... | python | chosen |
[
{
"from": "human",
"value": "TST: Add basic smoke tests for dask.\n"
},
{
"from": "gpt",
"value": "import event_model\nfrom bluesky.plans import count\nimport numpy\nfrom ophyd.sim import NumpySeqHandler\n\nfrom ..core import DaskFiller\n\n\ndef test_fill_event(RE, hw):\n docs = []\n\n def... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for packager.core.flavor.py\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n\nfrom packager.core.flavor import debian_check\nfrom nose.tools import *\nfrom subprocess import call\n\ndef test_debian_check():\n ret = call([\"test\", \"-f\", \"/etc... | python | chosen |
[
{
"from": "human",
"value": "Add harvester for Huskie Commons\n\nCloses [#SHARE-114]\n"
},
{
"from": "gpt",
"value": "'''\nHarvester for the Huskie Commons for the SHARE project\n\nExample API call: http://commons.lib.niu.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc\n'''\nfrom __future... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for Task 3\n"
},
{
"from": "gpt",
"value": "__author__ = 'Nino Bašić <nino.basic@fmf.uni-lj.si>'\n\nimport unittest\nfrom revolver import Revolver\n\n\nclass RevolverTest(unittest.TestCase):\n\n def test_iter(self):\n r = Revolver([[1], [20, 10... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add utility script to create JRE tarballs.\n\nThese tarballs will be uploaded to the Midas server to be\nused by the SCIFIOImageIO module.\n\nChange-Id: I180cf0957221762ddf62b14e3712b70fe19e03bb\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\ndescripti... | python | chosen |
[
{
"from": "human",
"value": "[algorithm] Solve hackerrank linked list problem\n\nThis is the solution of \"get-the-value-of-the-node-at-a-specific-position-from-the-tail\" problem.\n"
},
{
"from": "gpt",
"value": "# https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-po... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for Django app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n dep... | python | chosen |
[
{
"from": "human",
"value": "Add tests for permutation group class\n\nThe permutation group class is tested with the S3 group. This also\ntests the correctness of the Schreier-Sims algorithm in libcanon. The\npicklability is also tested.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the per... | python | chosen |
[
{
"from": "human",
"value": "Add test for image upload widget\n"
},
{
"from": "gpt",
"value": "from django.core.files.uploadedfile import SimpleUploadedFile\n\nfrom adhocracy4.images import widgets\n\n\ndef test_image_input_delete_presedence():\n input = widgets.ImageInputWidget()\n jpeg_f... | python | chosen |
[
{
"from": "human",
"value": "Add script to print words for LIWC categories\n\nGiven a LIWC dictionary and a category, the script prints the words in\nthe category.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Script to print all words in a LIWC category.... | python | chosen |
[
{
"from": "human",
"value": "Test commands clean - addition\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 0xc0170\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the Licens... | python | chosen |
[
{
"from": "human",
"value": "Rename migration and fix dependency\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2019-07-23 14:26\nfrom __future__ import unicode_literals\nfrom django.db import migrations\n\nfrom osf import features\nfrom osf.utils.migr... | python | chosen |
[
{
"from": "human",
"value": "Put EarthTwinHabZone tests in same new file/class\n"
},
{
"from": "gpt",
"value": "r\"\"\"Test code for modules EarthTwinHabZone1 and EarthTwinHabZone2 within EXOSIMS PlanetPopulation.\n\nCate Liu, IPAC, 2016\"\"\"\n\nimport unittest\nimport EXOSIMS\nfrom EXOSIMS imp... | python | chosen |
[
{
"from": "human",
"value": "Add quantity to shopping items\n"
},
{
"from": "gpt",
"value": "\"\"\"Add quantity to shopping items\n\nRevision ID: 32ccd6db0955\nRevises: 430dc4ed6dd6\nCreate Date: 2015-01-06 21:59:03.761529\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '32ccd6... | python | chosen |
[
{
"from": "human",
"value": "Add migration scripts for DB schema\n\n* Add table to log desktop logins\n* Add active field for asset instance\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: a23682ccc1f1\nRevises: 9bd17364fc18\nCreate Date: 2018-04-20 10:39:31.976959\n\n\"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add automated test inspared in bcbio-nextgen code\n"
},
{
"from": "gpt",
"value": "\"\"\"This directory is setup with configurations to run the main functional test.\n\nIt exercises a full analysis pipeline on a smaller subset of data.\n\"\"\"\nimport os\nimport subp... | python | chosen |
[
{
"from": "human",
"value": "Add project for chapter 6 Automate the Boring Stuff\n"
},
{
"from": "gpt",
"value": "#!/urs/local/bin/python\n# pw.py - an insecure password locker program\n\nimport sys\nimport pyperclip\n\nPASSWORDS = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6',\n 'blog'... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new endpoints\n"
},
{
"from": "gpt",
"value": "import unittest\nimport mock\nfrom ...management.branding import Branding\n\n\nclass TestBranding(unittest.TestCase):\n def test_init_with_optionals(self):\n branding = Branding(\n doma... | python | chosen |
[
{
"from": "human",
"value": "Add script for triggering rtf build (curl is not available on build slave).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distribute... | python | chosen |
[
{
"from": "human",
"value": "Add tests for fft and ifft\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport numpy as np\nimport numpy.fft as npfft\n\nimport dask\nfrom dask.array.core import Array\nfrom dask.utils import raises\nimport dask.array as da\nfrom dask.array.fft import fft, iff... | python | chosen |
[
{
"from": "human",
"value": "Add standard migrations to contrib.sites\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-04-14 09:03\nfrom __future__ import unicode_literals\n\nimport django.contrib.sites.models\nfrom django.db import migrations, models... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for coverage scores.\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 ]\n\n o... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for server group in ComputeV2\n\nChange-Id: I43a6ce3a6d976f3d1bd68c0483c929977b660f0d\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance wit... | python | chosen |
[
{
"from": "human",
"value": "Add python template to process a folder of images"
},
{
"from": "gpt",
"value": "import os\nfrom ij import IJ, ImagePlus\nfrom ij.gui import GenericDialog\n \ndef run():\n srcDir = IJ.getDirectory(\"Input_directory\")\n if not srcDir:\n return\n dstDir = IJ.ge... | python | chosen |
[
{
"from": "human",
"value": "Add match accuracy benchmark script\n"
},
{
"from": "gpt",
"value": "from tabulate import tabulate\nimport csv\nimport yaml\nimport sys\nimport os.path as path\n\nbase_directory = path.dirname(path.dirname(path.abspath(__file__)))\nsys.path.append(base_directory)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add test of rules with EPS\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 19.08.2017 17:25\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\n\nfrom unittest import TestCase, main\nfrom grammpy import *\n\nclass A(Nonterm... | python | chosen |
[
{
"from": "human",
"value": "Add a script to show loading/saving models\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nimport numpy\n\nfrom molml.features import CoulombMatrix\nfrom molml.crystal import GenerallizedCrystal\nfrom molml.utils import load_json\n\n\n# Defi... | python | chosen |
[
{
"from": "human",
"value": "Add base Django user directory\n"
},
{
"from": "gpt",
"value": "import sqlalchemy\n\nfrom .base import Directory, User\n\nclass DjangoDirectory(Directory):\n query = \"\"\"\n SELECT\n auth_user.id,\n auth_user.date_joined,\n auth_user.is_su... | python | chosen |
[
{
"from": "human",
"value": "Add South migration for LoginAttempt.path\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(SchemaMigration):\n\n def forwards... | python | chosen |
[
{
"from": "human",
"value": "Add site engine for StudioKhimera\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2019-2020 Tobias Gruetzmacher\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom ..scraper import _ParserScraper\n\n\nclass StudioKhim... | python | chosen |
[
{
"from": "human",
"value": "Set 1 / Challenge 2 done.\n"
},
{
"from": "gpt",
"value": "def buffers_xor(buffer1, buffer2):\n \"\"\"buffer1, buffer2: byte-like objects.\"\"\"\n try:\n return bytes(b1 ^ b2 for b1, b2 in zip(buffer1, buffer2))\n except TypeError:\n print(\"Fu... | python | chosen |
[
{
"from": "human",
"value": "Add tool for creating a separate backoff node for inword positions\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport argparse\n\nimport sys\n\n\ndef main(inf, outf, word_map):\n iw_backoff_outgoing = []\n iw_backoff_incoming = []\n iw_ending_... | python | chosen |
[
{
"from": "human",
"value": "Add some initial teests for hostdb\n"
},
{
"from": "gpt",
"value": "'''\nTest hostdb\n'''\n\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional i... | python | chosen |
[
{
"from": "human",
"value": "Add query_level and query_nature functions\n"
},
{
"from": "gpt",
"value": "import os\nimport sqlite3\nimport pandas as pd\n\nDB_PATH = os.path.dirname(__file__)+\"/Tables/Pyranitar.db\"\n\ndef query_level(group, experience):\n cnx = sqlite3.connect(DB_PATH)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add the Russian example test\n"
},
{
"from": "gpt",
"value": "# Russian Language Test\nfrom seleniumbase.translate.russian import ТестНаСелен # noqa\n\n\nclass МойТестовыйКласс(ТестНаСелен):\n\n def test_пример_1(self):\n self.открытый(\"https://ru.wikiped... | python | chosen |
[
{
"from": "human",
"value": "Add current state of golddust package\n"
},
{
"from": "gpt",
"value": "# Copyright 2015-2016 John \"LuaMilkshake\" Marion\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# Yo... | python | chosen |
[
{
"from": "human",
"value": "Load data from AT20G BSS and SUperCOSMOS catalogues\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\ndef hms2dec(h, m, s):\n return 15*(h + m/60 + s/3600)\n\ndef dms2dec(d, m, s):\n if (d >= 0):\n return d + m/60 + s/3600\n else:\n return d - m/60 - s/... | python | chosen |
[
{
"from": "human",
"value": "Add pytest config file for slow tests.\n\nAdded a pytest config file in the tests folder, so that I could define a\n--runslow option to some tests. This way, I don't have to run them all\nthe time if not necessary.\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n... | python | chosen |
[
{
"from": "system",
"value": "Load the config as late as possible to avoid crashing when the configuration is not ready yet. Also this code is more reentrant\n"
},
{
"from": "human",
"value": "# Copyright (C) 2011 Yaco Sistemas (http://www.yaco.es)\n#\n# Licensed under the Apache License, Versio... | python | chosen |
[
{
"from": "human",
"value": "messenger: Add a small test client program\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2012 James McCauley\n#\n# This file is part of POX.\n#\n# POX is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Gen... | python | chosen |
[
{
"from": "human",
"value": "Add simple module to show internet connection\n"
},
{
"from": "gpt",
"value": "from i3pystatus import IntervalModule\nfrom i3pystatus.core.util import internet\n\n\nclass Online(IntervalModule):\n\n \"\"\"Show internet connection status.\"\"\"\n\n settings = (\... | python | chosen |
[
{
"from": "human",
"value": "Add script to run on IEM to compute days of 1+ inch rainfall since 1 Apr\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCreate a plot of today's total precipitation from the Stage4 estimates\n\"\"\"\n\nimport pygrib\nimport mx.DateTime\nimport iemplot\nimport numpy\nimport... | python | chosen |
[
{
"from": "system",
"value": "Correct some issues with the stats methods\n"
},
{
"from": "human",
"value": "from django.template.defaultfilters import slugify\nfrom debug_toolbar.middleware import DebugToolbarMiddleware\n\n\nclass DebugPanel(object):\n \"\"\"\n Base class for debug panels.... | python | chosen |
[
{
"from": "human",
"value": "Add 02-task sample test v2.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport solution as s\n\n\nclass SampleTest(unittest.TestCase):\n def test_five_plus_three(self):\n plus = s.create_operator('+', lambda lhs, rhs: lhs + rhs)\n x = s.create_... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for zipping galleries\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\n\nimport os\nimport glob\nimport zipfile\n\nfrom sigal.gallery import Gallery\nfrom sigal.settings import read_settings\n\nCURRENT_DIR = os.path.dirname(__file__)\nSAMPLE_DI... | python | chosen |
[
{
"from": "system",
"value": "Fix bug with updated auth backend\n\nNow it checks to see if an email is being submitted.\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\nfrom django.contrib.auth.backends import ModelBackend\n\n\nclass Emailbackend(ModelBackend):\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add event indexing service client\n\nAdd script that serves as client to EPA Event Indexing Service. The\nscript has a convenience function for querying EPA with minimal\narguments and returns GeoJSON.\n"
},
{
"from": "gpt",
"value": "\"\"\"Wrapper with convenience f... | python | chosen |
[
{
"from": "human",
"value": "Add sim procedure for Random.nextInt\n"
},
{
"from": "gpt",
"value": "from ..java import JavaSimProcedure\nfrom angr.engines.soot.values.thisref import SimSootValue_ThisRef\nfrom angr.engines.soot.values.instancefieldref import SimSootValue_InstanceFieldRef\nimport l... | python | chosen |
[
{
"from": "human",
"value": "Add a simple peer selector which automatically connects to any new jam instance it hears about\n"
},
{
"from": "gpt",
"value": "import sets\nimport Axon\n\nclass PeerSelector(Axon.Component.component):\n Inboxes = {\"inbox\" : \"\",\n \"control\" : \... | python | chosen |
[
{
"from": "human",
"value": "Bring my Github up to date, with latest CSP.\n"
},
{
"from": "gpt",
"value": "cats = {\n 'kb': '''\n\n\n\nName(Felis, Catus)\nName2(Catus, Cat)\nName(Felis, Chaus)\nName2(Chaus, JungleCat)\nName(Panthera, Tigris)\nName2(Tigris, Tiger)\nName(Panthera, Onca)\nName2(... | python | chosen |
[
{
"from": "human",
"value": "Make a new prophage dir\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCreate a prophage.tbl file from a phispy directory that does not contain one.\n\"\"\"\n\nimport os\nimport sys\nimport argparse\nfrom evaluation import make_prophage_tbl\n\ndef make_new_prophage_tbl(ph... | python | chosen |
[
{
"from": "human",
"value": "Create the state for get a person from database.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport json\n\nimport requests\nfrom flexbe_core import EventState\nfrom rospy import logerr, loginfo\nfrom sara_msgs.msg import Entity\n\n\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add integration test for sns\n"
},
{
"from": "gpt",
"value": "import os\nfrom asyncaws import SNS\nfrom tornado.testing import AsyncTestCase, gen_test\nfrom random import randint\n\naws_key_id = os.environ['AWS_ACCESS_KEY_ID']\naws_key_secret = os.environ['AWS_SECRET... | python | chosen |
[
{
"from": "human",
"value": "Add simple tests for shub deploy\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=utf-8\n\n\nimport unittest\nfrom shub import deploy\nfrom click.testing import CliRunner\nfrom mock import Mock\n\n\nclass DeployTest(unittest.TestCase):\n def setUp(... | python | chosen |
[
{
"from": "human",
"value": "Test that 1D orbit integration agrees between Orbit and Orbits\n"
},
{
"from": "gpt",
"value": "##########################TESTS ON MULTIPLE ORBITS#############################\nimport numpy\nfrom galpy import potential\n\n# Test that integrating Orbits agrees with in... | python | chosen |
[
{
"from": "human",
"value": "Add migration to make testartifact actually CASCADE on delete.\n\nSummary:\nThis is alright if we don't care much about having dangling references\non S3/ArtifactStore (such as if we clean them separately).\n\nReviewers: paulruan\n\nReviewed By: paulruan\n\nSubscribers: changesb... | python | chosen |
[
{
"from": "human",
"value": "Solve the Fibonacci Series challenge\n"
},
{
"from": "gpt",
"value": "import sys\n\ndef fibonacci(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fibonacci(n-1) + fibonacci(n-2)\n\ninput_file = sys.argv[1]\nwith op... | python | chosen |
[
{
"from": "human",
"value": "Add test for nationality model\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.core.exceptions import ValidationError\n\nfrom master_data.models import Nationality\n\n\nclass NationalityModeTestCases(TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for self usage in static methods\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom tests.compiler import compile_base, internal_call\nfrom thinglang.compiler.errors import SelfInStaticMethod\nfrom thinglang.compiler.opcodes import OpcodePushStatic, Opco... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for anon viewing receiving page\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom gratipay.testing import Harness\n\n\nclass Tests(Harness):\n\n def test_receiving_returns_4... | python | chosen |
[
{
"from": "human",
"value": "Add directory for start symbol 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\"\"\""
}
] | python | chosen |
[
{
"from": "human",
"value": "Make modified_on and org no longer be nullable\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 (... | python | chosen |
[
{
"from": "human",
"value": "Add a class to implement a fraction in python, to deal with method overriding\n"
},
{
"from": "gpt",
"value": "#gdc(a,b) = gcd(b, a%b) OBS: Positive integer only\ndef gcd(m,n):\n while(m%n != 0):\n aux = m\n aux2 = n\n m = aux2\n n = au... | python | chosen |
[
{
"from": "system",
"value": "Fix up local.ini updater code to look specifically for 'xform_translate_path'\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8\n\n\"\"\"\nThe sole purpose of the following script is to update the\nlocal.ini file u... | python | chosen |
[
{
"from": "human",
"value": "Add script to profile benchmarking time\n"
},
{
"from": "gpt",
"value": "# Profile the basic test execution\n\nfrom pyresttest import resttest\nfrom pyresttest.benchmarks import Benchmark\nimport cProfile\n\ntest = Benchmark()\ntest.warmup_runs = 0\ntest.benchmark_ru... | python | chosen |
[
{
"from": "human",
"value": "Add test for processing invariant\n"
},
{
"from": "gpt",
"value": "\"\"\"Test that we can read and write bib entries with postprocessing.\"\"\"\n\nimport bibpy\nimport pytest\n\n\n@pytest.fixture\ndef test_string():\n return \"\"\"@article{key,\n author =... | python | chosen |
[
{
"from": "human",
"value": "Solve all but first test case\n"
},
{
"from": "gpt",
"value": "def fibonacci(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fibonacci(n - 1) + fibonacci(n - 2)\n\nn = int(input())\nprint(fibonacci(n))\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add basic smoke test that task_processing is available\n"
},
{
"from": "gpt",
"value": "# Copyright 2015-2017 Yelp Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ... | python | chosen |
[
{
"from": "human",
"value": "Add test for get_gcs_client with un-authed ID\n"
},
{
"from": "gpt",
"value": "import uuid\n\nimport pytest\n\nfrom globus_cli.services.gcs import get_gcs_client\n\n\ndef test_get_gcs_client_missing_required_auth():\n gcsid = str(uuid.uuid1())\n\n with pytest.r... | python | chosen |
[
{
"from": "human",
"value": "Add new test for symmetry with site tensors\n"
},
{
"from": "gpt",
"value": "import unittest\nimport numpy as np\nfrom spglib import get_symmetry\n\n\nclass TestGetOperationsWithSiteTensors(unittest.TestCase):\n\n def setUp(self):\n lattice = [[0, 2, 2], [2... | python | chosen |
[
{
"from": "human",
"value": "Add initial bare repository generation.\n"
},
{
"from": "gpt",
"value": "import tempfile\nimport pygit2\n\n\ntmpdir = tempfile.TemporaryDirectory(suffix='.git', prefix='branchandcommit-')\n\nprint('Creating bare repository: {}'.format(tmpdir.name))\n\nrepo = pygit2.i... | python | chosen |
[
{
"from": "human",
"value": "Add migration to create user_rank materialized view\n"
},
{
"from": "gpt",
"value": "def up(cursor, bot):\n cursor.execute(\n \"\"\"\n CREATE MATERIALIZED VIEW user_rank AS (\n SELECT\n id as user_id,\n RANK() OVER (ORDER BY ... | python | chosen |
[
{
"from": "human",
"value": "Solve is binary search tree\n"
},
{
"from": "gpt",
"value": "\"\"\" Node is defined as\nclass node:\n def __init__(self, data):\n self.data = data\n self.left = None\n self.right = None\n\"\"\"\n\nimport sys\n\n\ndef checkBST(root):\n retur... | python | chosen |
[
{
"from": "human",
"value": "Add a test for `qisrc diff`\n\nChange-Id: I32fe0d298dd8bced991c3b314ed543614266cc24\nReviewed-on: http://gerrit.aldebaran.lan/60721\nTested-by: gerrit\nReviewed-by: vbarbaresi <371b46c96c99af52f4f920034e4fcb63ece5bdb5@aldebaran-robotics.com>\n"
},
{
"from": "gpt",
"v... | python | chosen |
[
{
"from": "human",
"value": "Implement the server notice mechanism\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom twisted.words.protocols import irc\nfrom txircd.module_interface import IMode, IModuleData, Mode, ModuleData\nfrom txircd.utils import ircLower, ModeType, ... | python | chosen |
[
{
"from": "human",
"value": "Reset `not null` on some legacy fields.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-06-15 6:12\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, connection\n\n\nclass Migration(migrations... | python | chosen |
[
{
"from": "system",
"value": "Comment out project-specific secrets import warning (not needed)\n"
},
{
"from": "human",
"value": "\"\"\"Local settings and globals.\"\"\"\nimport sys\nfrom os.path import normpath, join\nfrom .base import *\n\n# Import secrets\nsys.path.append(\n abspath(join(P... | python | chosen |
[
{
"from": "human",
"value": "Add a script for converting landmarks config\n\nAdd an example script for converting old-style landmarks configurations\n(constructing an actual Landmarks instance in config.py) with the\nnew-style of using standard Python data-types (a tuple/list of dicts).\n"
},
{
"fro... | python | chosen |
[
{
"from": "human",
"value": "Add validation test for adding node label\n\nhttps://github.com/rancher/rancher/issues/24123\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom .common import * # NOQA\n\ndef test_add_node_label():\n client, cluster = get_global_admin_client_and_cluster()\n ... | python | chosen |
[
{
"from": "human",
"value": "Remove card wikiversity and rename project name\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Ideaxbox for Emmaus, France\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_NAME = u\"Jean Carré\"\... | python | chosen |
[
{
"from": "human",
"value": "Add test for scoring engine config\n"
},
{
"from": "gpt",
"value": "\nfrom scoring_engine.config_loader import ConfigLoader\nclass MockConfigLoader():\n pass\n\nConfigLoader = MockConfigLoader\n\nfrom scoring_engine.config import config\n\nclass TestConfig(object)... | python | chosen |
[
{
"from": "human",
"value": "Add two smoke tests for Elsevier client\n"
},
{
"from": "gpt",
"value": "from indra.literature import elsevier_client as ec\n\ndef test_get_fulltext_article():\n # This article is not open access so in order to get a full text response\n # with a body element r... | python | chosen |
[
{
"from": "human",
"value": "Add test that derived generator is the owner of its constituent generators\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom .exemplar_generators import EXEMPLAR_DERIVED_GENERATORS\n\n\n@pytest.mark.parametrize(\"g\", EXEMPLAR_DERIVED_GENERATORS)\ndef test_derived... | python | chosen |
[
{
"from": "human",
"value": "Test channel joins of real bot\n"
},
{
"from": "gpt",
"value": "\"\"\"\n:Copyright: 2007-2021 Jochen Kupperschmidt\n:License: MIT, see LICENSE for details.\n\"\"\"\n\nfrom irc.client import Event, NickMask, ServerConnection\nimport pytest\n\nfrom syslog2irc.irc impor... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.