conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a test for when the user renames a resource\n"
},
{
"from": "gpt",
"value": "c_uuid = None\n\ndef store_c_uuid():\n global c_uuid\n c_uuid = next(iter(reality.resources_by_logical_name('C')))\n\ndef check_c_replaced():\n test.assertNotEqual(c_uuid,\n ... | python | chosen |
[
{
"from": "human",
"value": "Solve \"Xs or Os Referee\" problem\n"
},
{
"from": "gpt",
"value": "def checkio(array):\n if array[0][0] == array[0][1] == array[0][2] or array[0][0] == array[1][0] == array[2][0] or array[0][0] == array[1][1] == array[2][2]:\n return array[0][0]\n if ar... | python | chosen |
[
{
"from": "human",
"value": "Add script that generates page numbers.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport glob\nimport os\nimport sys\n\nsys.path.insert(0, 'publisher')\n\nimport options\n\noutput_dir = 'output'\ndirs = [d for d in glob.glob('%s/*' % output_dir) if os... | python | chosen |
[
{
"from": "human",
"value": "Add in demo script to get client credentials.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nreg... | python | chosen |
[
{
"from": "human",
"value": "Use exception handler function for try-except\n"
},
{
"from": "gpt",
"value": "\"\"\" Be DRY (don't repeat yourself), use exception handler function for try-except \"\"\"\n\ndef handle_exception(func):\n def inner(*args, **kwargs):\n try:\n retur... | python | chosen |
[
{
"from": "human",
"value": "Make the script work on python 2 and print actions.\n"
},
{
"from": "gpt",
"value": "\nfrom __future__ import print_function\n\nimport subprocess\nimport sys\n\n\nDOCKER_CREATE_IN = 'docker create -it nodev {}'\nDOCKER_SIMPLE_CMD_IN = 'docker {} {container_id}'\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add management command to check for multiple parent types\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.domain.models import Domain\n\n\nclass Command(BaseCommand):\n def handle(self, *args, **options):\n ... | python | chosen |
[
{
"from": "human",
"value": "[hbase] Load binary data into HBase\n"
},
{
"from": "gpt",
"value": "##\n## Insert various data into HBase\n##\n\n## cd $HUE_HOME (e.g. cd /usr/share/hue(/opt/cloudera/parcels/CDH-XXXXX/share/hue if using parcels))\n## build/env/bin/hue shell\n##\n\nfrom hbase.api im... | python | chosen |
[
{
"from": "human",
"value": "Add data migration to update already existing talk states\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\n# Data migration for the changed talk status\n\ndef change_pen... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Doc creation\n"
},
{
"from": "gpt",
"value": "'''Test Doc sets up tokens correctly.'''\nfrom __future__ import unicode_literals\nimport pytest\n\nfrom ...vocab import Vocab\nfrom ...tokens.doc import Doc\nfrom ...lemmatizerlookup import Lemmatizer\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Define interface between cli and data analysis"
},
{
"from": "gpt",
"value": "\"\"\"\nIn this module we define the interface between the cli input provided\nby the user and the analytics required by the user\n\"\"\"\n\ndef cmd_list_basic(args):\n\t\"\"\"\n\tList the ... | python | chosen |
[
{
"from": "human",
"value": "Add script to import Wikidata IDs from EveryPolitician\n"
},
{
"from": "gpt",
"value": "from everypolitician import EveryPolitician\n\nfrom django.core.management.base import BaseCommand\n\nfrom pombola.core.models import Person\n\n\nclass Command(BaseCommand):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add manage.py utility to delete non members who dont get the mailout\n"
},
{
"from": "gpt",
"value": "# https://docs.djangoproject.com/en/1.11/howto/custom-management-commands/\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.conf imp... | python | chosen |
[
{
"from": "human",
"value": "Add test script to replace ocr mistakes\n\nAdded a script that finds matches for ocr mistakes using the fuzzywuzzy\nlibrary (based on Levenstein distance) and a list of words in the\nannotated texts. It seems only more noise is introduced.\n"
},
{
"from": "gpt",
"val... | python | chosen |
[
{
"from": "human",
"value": "Add unique to keys.AcccessKey.password per user\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 svnrdump-simulator replaying a dump file for testing\n\nTo ease testing without depending on a reachable svn server, this\ncompact python script mimics parts of svnrdumps behaviour. It\nrequires the remote url to start with sim://.\n\nStart and end revisions are evaluated... | python | chosen |
[
{
"from": "human",
"value": "Convert unicode characters to ASCII using Canonical Decomposition (NFD).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUnicode to ASCII Utility\n========================\n\"\"\"\n\nimport sys\nreload(sys)\nsys.setdefaultenco... | python | chosen |
[
{
"from": "system",
"value": "Add one more empty line to end of import to adjust to H306\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport argparse\nimport sys\n\nimport cv2\nimport numpy\nimport six.moves.cPickle as pickle\n\nparser = argparse.ArgumentParser(description='Compute ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for customer transaction parameters generator.py\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport simulation_parameters as sim_param\n\nfrom generators.transaction_generator.customer_transaction_parameters_generator import CustomerTransaction... | python | chosen |
[
{
"from": "human",
"value": "Add tool for json and JSONschema pretty printing\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\nimport argparse\nimport sys\nimport json\nimport textwrap\nfrom collections import OrderedDict\ntry:\n import yaml\nex... | python | chosen |
[
{
"from": "human",
"value": "Add a small script to update motech-version in the pom\n\nChange-Id: I15f828394346dd8260e1f1c2e899a6adf6c27d5d\n"
},
{
"from": "gpt",
"value": "import sys\nfrom xml.dom.minidom import parse\n\npom = open(\"pom.xml\")\ndom = parse(pom)\npom.close()\nmv = dom.getElemen... | python | chosen |
[
{
"from": "human",
"value": "Add the utility script that generated vtkDICOMVM.h\n"
},
{
"from": "gpt",
"value": "\"\"\"\nGenerate the enum code for the VM header file.\n\"\"\"\n\ndef getmin(k):\n if ((k & 0x8000) != 0):\n return (k & 0x7fff)\n else:\n return (k >> 8)\n\ndef g... | python | chosen |
[
{
"from": "human",
"value": "Add an initial tower that doesnt parse yet\n"
},
{
"from": "gpt",
"value": "# --------\n# |@ >|\n# --------\nlevel.description(\"You see before yourself a long hallway with stairs at \"\n \"the end. There is nothing in the way.\")\nlevel.tip(\... | python | chosen |
[
{
"from": "system",
"value": "Make the command to actually send the overdues\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand, CommandError\nfrom velkoja.holvichecker import HolviOverdueInvoicesHandler\n\nclass Command(BaseCommand):\... | python | chosen |
[
{
"from": "human",
"value": "Add some linear algebra algorithms.\n"
},
{
"from": "gpt",
"value": "# 一些基本的线性代数算法\n\nimport numpy as np\n\n\ndef lu(A):\n # LU 分解,要求必须非奇异\n A = A.copy()\n U = np.zeros(A.shape)\n L = np.eye(A.shape[1])\n for i in range(A.shape[1] - 1):\n U[:i +... | python | chosen |
[
{
"from": "system",
"value": "Fix issues with the terminal prompt example\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n'''Powerline terminal prompt example.\n'''\n\nimport os\nimport sys\nsys.path.append(os.path.join(os.path.dirname(__file__), '../..'))\n\nfrom lib.core import Power... | python | chosen |
[
{
"from": "human",
"value": "Add 12/1 part 1 solution\n"
},
{
"from": "gpt",
"value": "# Advent of Code\n# Dec 1, Part 1\n# @geekygirlsarah\n\nimport struct\n\ninputFile = \"input.txt\"\n\n# Tracking vars\nx = 0\ny = 0\nfacing = \"N\"\n\nwith open(inputFile) as f:\n while True:\n conte... | python | chosen |
[
{
"from": "human",
"value": "Add json tools to toolkit\n\nCreate a new toolkit to interface with json files"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# __ ___ ___ _ __ ___ ___ _ ___ ___ _\n# (_ |\\/| | __ | |_ (_ | __ /\\ | | | / \\ |\\/| /\\ ... | python | chosen |
[
{
"from": "human",
"value": "Add parsing and adding model to db tests\n"
},
{
"from": "gpt",
"value": "from scout.server.app import create_app\nfrom scout.server.extensions import store\n\n\ndef test_rank_model_from_url_snv(adapter, case_obj):\n \"\"\"Test parsing and saving a SNV rank model ... | python | chosen |
[
{
"from": "human",
"value": "Add sparse matrix operations test\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nimport math\nimport numpy as np\nimport pyviennacl as p\nimport scipy.sparse.linalg as spspla\nfrom _common import *\nfrom itertools import product\n\nsize, sparsity... | python | chosen |
[
{
"from": "human",
"value": "Add very simple tests to ensure feature is enabled\n"
},
{
"from": "gpt",
"value": "import sys\nfrom typing import Any, Callable\n\nimport pytest\n\nfrom tests.lib import PipTestEnvironment, TestPipResult\n\nPipRunner = Callable[..., TestPipResult]\n\n\n@pytest.fixtu... | python | chosen |
[
{
"from": "human",
"value": "Drop unused PostgreSQL sequences from Folsom.\n\nIn Folsom the snapshots and volumes tables were converted to use\nUUID's. When we performed this conversion in Folsom a couple of\nunused PostgreSQL sequences were left behind.\n\nThis migration removes the snapshots_id_seq and vo... | python | chosen |
[
{
"from": "human",
"value": "Implement the usermodes on connect module\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass AutoUserModes(ModuleData):\n implements(IPlug... | python | chosen |
[
{
"from": "human",
"value": "Add a test case to validate that 'type lookup' picks Swift vs. ObjC properly in the REPL\n"
},
{
"from": "gpt",
"value": "# TestREPLTypeLookup.py\n#\n# This source file is part of the Swift.org open source project\n#\n# Copyright (c) 2014 - 2015 Apple Inc. and the Sw... | python | chosen |
[
{
"from": "human",
"value": "Add a basic test for rmf3_dump\n"
},
{
"from": "gpt",
"value": "import unittest\nimport RMF\nimport subprocess\n\n\nclass Tests(unittest.TestCase):\n\n def test_help(self):\n \"\"\"Test rmf3_dump --help\"\"\"\n p = subprocess.Popen(['rmf3_dump', '--h... | python | chosen |
[
{
"from": "human",
"value": "Add script to write serial capture\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport serial\nimport time\nimport json\n\ndef main():\n with open('data.json') as fh:\n values = json.load(fh)\n with s... | python | chosen |
[
{
"from": "human",
"value": "Add an expanded k-mer set.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis module provides an API for reading and writing sets (sorted lists)\nof *k*-mers in an uncompressed form using the builtin Python array type.\n\nIt is good for small sets of *k*-mers, where the c... | python | chosen |
[
{
"from": "human",
"value": "Create some testing helper classes\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.core.urlresolvers import reverse\n\nfrom rest_framework.test import APIClient\n\n\nclass APITestCase(TestCase):\n\n def setUp(self):\n self.cli... | python | chosen |
[
{
"from": "human",
"value": "lib/files: Add tests for `sanitise_filename()` function\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom skylines.lib import files\nfrom skylines.lib.types import is_unicode\n\n\n@pytest.mark.parametrize(\n \"input,expected\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for assert executable\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom dusty.preflight import _assert_executable_exists, PreflightException\n\nclass PreflightTest(TestCase):\n def test_assert_executable_exists(self):\n _asser... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 523. Continuous Subarray Sum\n\n523. Continuous Subarray Sum: https://leetcode.com/problems/continuous-subarray-sum/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd or i... | python | chosen |
[
{
"from": "human",
"value": "Update names and change headers\n"
},
{
"from": "gpt",
"value": "from worker import SpiderWorker\nfrom bloomset import BloomSet\nfrom queue import SpiderQueue\nimport utilities\n\nclass Spider:\n\tdef __init__(self , baseUrl, numthreads=1, depth=1):\n\t\t\tself.baseU... | python | chosen |
[
{
"from": "system",
"value": "Check and create the tests file folder using an absolute path\n"
},
{
"from": "human",
"value": "from os import mkdir\nfrom os.path import abspath, dirname, exists, join\nfrom shutil import rmtree\n\nfrom tvrenamr.config import Config\nfrom tvrenamr.main import TvRe... | python | chosen |
[
{
"from": "human",
"value": "Implement python interface for Node API\n"
},
{
"from": "gpt",
"value": "import requests\nimport json\n\napiUrl = 'http://localhost:3000/dronesym/api/node'\n\ndef update_drone(id, status):\n\tresponse = requests.post(apiUrl + '/update/' + str(id), json=status, header... | python | chosen |
[
{
"from": "human",
"value": "Add a script for printing file upload moments in the stream\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#\n# Copyright 2015 Secure Systems Group, Aalto University https://se-sy.org/.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");... | python | chosen |
[
{
"from": "human",
"value": "Add preliminary class interface for Archiver\n"
},
{
"from": "gpt",
"value": "from website.project import signals as project_signals\n\nclass StatResult(object):\n\n def __init__(self, target, problems=[], num_files=0, disk_usage=0, owners=[]):\n self.targe... | python | chosen |
[
{
"from": "human",
"value": "Use mitmproxy to get basic information\n"
},
{
"from": "gpt",
"value": "# Run this with mitmdump -q -s morph_proxy.py\n\ndef request(context, flow):\n # print out all the basic information to determine what request is being made\n # coming from which container\n #... | python | chosen |
[
{
"from": "system",
"value": "Add Apache 2.0 license to source file\n\nAs per OpenStack licensing guide lines [1]:\n[H102 H103] Newly contributed Source Code should be licensed under\nthe Apache 2.0 license.\n[H104] Files with no code shouldn't contain any license header nor\ncomments, and must be left comp... | python | chosen |
[
{
"from": "human",
"value": "Add view for a single Entry\n"
},
{
"from": "gpt",
"value": "from pyramid.view import (\n view_config,\n view_defaults,\n )\n\nfrom ....views.finalisecontext import FinaliseContext\n\n@view_defaults(context='...traversal.v1.Entry',\n route... | python | chosen |
[
{
"from": "human",
"value": "Implement the Campaign Folders endpoint\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\"\"\"\nThe Campaign Folders API endpoints\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaign-folders/\nSchema: https://api.mailchimp.com... | python | chosen |
[
{
"from": "human",
"value": "Add helper to get the coin price\n"
},
{
"from": "gpt",
"value": "import json\nimport requests\n\n\ndef get_coin_price(coin_name):\n url = \"https://bittrex.com/api/v1.1/public/getticker?market=USDT-{}\".format(coin_name)\n data = requests.get(url).json()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for ensuring log backrefs are correct\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom website.app import init_app\nfrom website import models\nfrom modularodm.storedobject import ensure_backrefs\n\ndef main():\n init_app(routes=False)\n ... | python | chosen |
[
{
"from": "human",
"value": "Test multiple invocations of same job in one flow\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT\n# All rights reserved. This work is under a BSD license, see LICENSE.TXT.\n\nfrom jenkinsflow.flow import serial\nfrom .... | python | chosen |
[
{
"from": "human",
"value": "Add module for atomic file writes and waits"
},
{
"from": "gpt",
"value": "import os\nfrom tempfile import mkstemp\nimport time\n\n\nclass atomic_write(object):\n \"\"\"Perform an atomic write to a file.\n\n Use as::\n\n with atomic_write('/my_file') as ... | python | chosen |
[
{
"from": "human",
"value": "Add the serialization functions for the User objects.\n"
},
{
"from": "gpt",
"value": "import HTMLParser\nimport random\nimport re\n\nfrom django.contrib.auth.models import User\nfrom rest_framework import serializers\n\nfrom . import models\n\nclass UserSerializer(s... | python | chosen |
[
{
"from": "human",
"value": "Add migration to remove payout status from sourcing projects\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2017-10-30 21:49\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef forward(apps,... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests to check parsing of timestamps\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright 2016 BMC Software, Inc.\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": "Create COM port selection GUI.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os, serial, wx\nfrom serial.tools import list_ports\n\nclass COMPort:\n def __init__(self, id, name):\n self.id = id\n self.name ... | python | chosen |
[
{
"from": "human",
"value": "Add a simple script to plot data.\n"
},
{
"from": "gpt",
"value": "import sys\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ncolors = [\"b\", \"g\", \"r\", \"c\", \"m\", \"y\", \"k\"]\nweeks = [\"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"49\",... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 504. Base 7\n\n504. Base 7: https://leetcode.com/problems/base-7/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def convertToBase7(self, num):\n \"\"\"\n :type num: int\n :rtype: str\n \"\"\"\n if... | python | chosen |
[
{
"from": "human",
"value": "Add tests for save_data_to_file function\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nimport unittest\nfrom unittest import mock\n\nfrom web_scraper.core import file_handler... | python | chosen |
[
{
"from": "human",
"value": "Add tests for SU2 drudge without abstract lattice\n"
},
{
"from": "gpt",
"value": "\"\"\"Test for the SU2 drudge.\"\"\"\n\nfrom sympy import Rational, I\n\nfrom drudge import SU2LatticeDrudge\n\n\ndef test_su2_without_symbolic_index(spark_ctx):\n \"\"\"Test SU2 la... | python | chosen |
[
{
"from": "human",
"value": "Add thrown together date script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport requests\nimport time\nfrom bs4 import BeautifulSoup\n\nday = \"02-01-2020\"\nlast_day_string = \"03-01-2020\"\npage = requests.get(\"https://www.sfstation.com/calendar/{}... | python | chosen |
[
{
"from": "human",
"value": "Add pwm Python code for LED\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nled0 = open('/dev/rtled0', 'a')\nn = 0\n\nwhile True :\n\tprint >> led0, \"%d\" % (0 if n%5 else 1)\n\tn = n + 1\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add autonym and synonym commands\n"
},
{
"from": "gpt",
"value": "from difflib import get_close_matches\n\nimport discord\n\nfrom pcbot import Annotate\nimport plugins\nclient = plugins.client\n\n\ndef load_wordlist(filename: str):\n with open(\"plugins/wordlib/Si... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test for ComboBox\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis test is adopted form nbtk, but since it's summer it uses\nMunich's most famous Beergarden instead of places in London ;)\n\"\"\"\nimport clutter\nimport nbtk\n\ndef title_changed_cb(box, psp... | python | chosen |
[
{
"from": "human",
"value": "Add utility for validation and plot for heatmap\n"
},
{
"from": "gpt",
"value": "import seaborn as sns\nimport matplotlib.pyplot as plt\n\nfrom ..utility.validation import check_dataframe, check_cols\n\ndef compute_correlation(data=None, cols=None, method='pearson'):... | python | chosen |
[
{
"from": "human",
"value": "Add script to download pre-trained models\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os.path as osp\n\nimport fcn\n\n\ndef main():\n # models converted from caffe\n path = fcn.data.download_vgg16_chainermodel()\n print('==> downloaded t... | python | chosen |
[
{
"from": "human",
"value": "Add test for external and environmental stuff\n\nHere: Commandline\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Testing environmental and external behavior\n#\nimport pytest\nfrom pycket.test.test_basic import run_fix, run\nf... | python | chosen |
[
{
"from": "human",
"value": "Add function signature / argument specification oddity\n"
},
{
"from": "gpt",
"value": "# makes total sense\n# syntax error in Python 2\n# works in Python 3\n\ndef func(positional, *optional, defaulted='missing'):\n print(positional, optional, defaulted)\n\nfunc('... | python | chosen |
[
{
"from": "human",
"value": "Create a state for add an human\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport json\nimport requests\nfrom flexbe_core import EventState, Logger\n\n\nclass Wonderland_Add_Human(EventState):\n\t'''\n\tAdd an human to Wonderland. For ... | python | chosen |
[
{
"from": "human",
"value": "Make a separate script for data generation.\n"
},
{
"from": "gpt",
"value": "# DATA ACQUISITION\nimport pymongo\nfrom bluesky import RunEngine\nfrom bluesky.plans import scan\nfrom bluesky.preprocessors import SupplementalData\nfrom ophyd.sim import det, motor\n\n\nc... | python | chosen |
[
{
"from": "human",
"value": "Add Necrodancer floor shuffle script.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport random\n\nZONES = 5\nFLOORS = 3\n\nBOSSES = [\n 'Deep Blues',\n 'King Conga',\n 'Death Metal',\n 'Coral Riff',\n 'Fortissimole',\n]\n\nSONGS = {\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for fields in Cisco Nexus table\n\nChange-Id: Ib31ec7f92d568c21d607b0bf003494acd1e3a3e8\nCloses-bug: #1232360\n"
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n#\n# Copyright 2013 OpenStack Foundation\n#\n# License... | python | chosen |
[
{
"from": "human",
"value": "Add example with iso volume\n"
},
{
"from": "gpt",
"value": "import ipaddr\nfrom devops.helpers.helpers import SSHClient\n\ndef one(manager):\n environment = manager.environment_create('cdrom')\n internal_pool = manager.create_network_pool(\n networks=[i... | python | chosen |
[
{
"from": "human",
"value": "Add script that creates markdown versions of content files and flattens the content directory structure.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# This program flattens the content hierarchy of documents generated using the wr... | python | chosen |
[
{
"from": "human",
"value": "Test for multiple config decorators\n"
},
{
"from": "gpt",
"value": "import unittest\nimport webracer\n\nclass ConfigDecoratorTest(unittest.TestCase):\n def test_config_decorator(self):\n @webracer.config(host='decoratortesthost', port=5544)\n class ... | python | chosen |
[
{
"from": "human",
"value": "Add script to transform folia into kaf\n\nAdded the first version of the script to transform folia xml into kaf.\nThe script is not finished, because it is still unknown what the folia\nfiles will exactly look like.\n"
},
{
"from": "gpt",
"value": "\"\"\"Create KAF f... | python | chosen |
[
{
"from": "human",
"value": "Add tests for _util module\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2008-2016 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"Tests for the `_util` module.\"\"\"\n\nfrom datetime im... | python | chosen |
[
{
"from": "human",
"value": "Add initial snapshot block converter\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Module for snapshot block converter.\"\"\"\n\n\nclass SnapshotBlockConverte... | python | chosen |
[
{
"from": "human",
"value": "Add artist profile picture path\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-01-20 20:02\nfrom __future__ import unicode_literals\n\nimport artists.models\nfrom django.db import migrations, models\n\n\nclass Migration... | python | chosen |
[
{
"from": "human",
"value": "Add a small program to test CAN loobpack\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport utils\n\nimport can\nimport can_bridge\nimport serial_datagrams\n\ndef read_frame(fdesc):\n \"\"\"\n Reads a full CAN datagram from the CAN <-> serial bridg... | python | chosen |
[
{
"from": "human",
"value": "Make test app runnable again\n\nMake the test app work with `python manager.py runserver` again, since\nwe use this for basic testing/debugging.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nWSGI config for idf project.\n\nIt exposes the WSGI callable as a module-level va... | python | chosen |
[
{
"from": "human",
"value": "Add an example of using the HTTP test template.\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n#\n# :authors: Arturo Filastò\n# :licence: see LICENSE\n\nfrom ooni.templates import http\nclass Example(http.HTTPTest):\n inputs = ['http://google.com/', '... | python | chosen |
[
{
"from": "human",
"value": "Add a test script that compiles the FAUST examples.\n"
},
{
"from": "gpt",
"value": "import os\nimport glob\nimport argparse\nimport FAUSTPy\n\nparser = argparse.ArgumentParser()\nparser.add_argument('-p', '--path',\n dest=\"examples_path\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add as_pair helper function for parameter validation\n"
},
{
"from": "gpt",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module provides parameter validation tools.\n\"\"\"\n\nimport numpy as np\n\n\ndef as_pair(name, value,... | python | chosen |
[
{
"from": "system",
"value": "Make OpenSSL build on Darwin\n"
},
{
"from": "human",
"value": "from spack import *\n\nclass Openssl(Package):\n \"\"\"The OpenSSL Project is a collaborative effort to develop a\n robust, commercial-grade, full-featured, and Open Source\n toolkit impl... | python | chosen |
[
{
"from": "human",
"value": "Add simple DFS in python\n"
},
{
"from": "gpt",
"value": "class Node(object):\n def __init__(self, value, children=None):\n self.value = value\n if children is None:\n self.children = []\n else:\n self.children = children... | python | chosen |
[
{
"from": "human",
"value": "Add module for enumerating direction types and converting angles into them.\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n# Copyright 2020 Google LLC\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compli... | python | chosen |
[
{
"from": "system",
"value": "Use the CLoader when present to validate yaml\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nimport argparse\nimport sys\n\nimport yaml\n\n\ndef check_yaml(argv=None):\n parser = argparse.ArgumentParser()\n parser.add_argument('fil... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 107\n"
},
{
"from": "gpt",
"value": "class Solution:\n # @param s: A string s\n # @param dict: A dictionary of words dict\n def wordBreak(self, s, dict):\n # write your code here\n if (not s):\n retu... | python | chosen |
[
{
"from": "human",
"value": "Add base for JNI function Get*ArrayElements\n"
},
{
"from": "gpt",
"value": "from . import JNISimProcedure\nfrom ...engines.soot.values.arrayref import SimSootValue_ArrayRef\n\nclass GetArrayElements(JNISimProcedure):\n\n return_ty = 'reference'\n\n def run(sel... | python | chosen |
[
{
"from": "human",
"value": "Add migrations from previous model changes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('her... | python | chosen |
[
{
"from": "human",
"value": "Add migration for task notifications\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.29 on 2020-10-28 14:32\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migra... | python | chosen |
[
{
"from": "human",
"value": "Add a test for coding standards.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests coding standards compliance.\"\"\"\n# Copyright (c) 2016 Andrew Dawson\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated ... | python | chosen |
[
{
"from": "human",
"value": "Add a test that validates that the .po and .mo files match for all active languages\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest that the compiled .mo files match the translations in the\nuncompiled .po files.\n\nThis is required because we are checking in the .mo f... | python | chosen |
[
{
"from": "human",
"value": "Use fabric to start/end a swarm\n"
},
{
"from": "gpt",
"value": "from fabric.api import (\n local,\n settings,\n task\n)\nfrom fabric.state import env\n\n\nSWARM101_NETWORK = 'swarm101'\n\n\n@task\ndef localhost():\n env.run = local\n\n\n@task\ndef swarm_... | python | chosen |
[
{
"from": "system",
"value": "Create the output directory as necessary\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os.path\n\nimport ctk_cli\nimport keras.models as M\n\nfrom tubetk.vseg.cnn import deploy, utils\n\nscript_params = utils.script_params\n\ndef main(args):\n ... | python | chosen |
[
{
"from": "system",
"value": "Create directory, if necessary, before preprocessing files as well\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport errno\nimport os\n\nimport ctk_cli\nimport keras.models as M\n\nfrom tubetk.vseg.cnn import deploy, utils\n\nscript_params = utils.s... | python | chosen |
[
{
"from": "system",
"value": "Fix Landscape complaint \"Method has no argument\"\n"
},
{
"from": "human",
"value": "from django.contrib.staticfiles.testing import StaticLiveServerTestCase\n\n\nclass BehaviorDrivenTestCase(StaticLiveServerTestCase):\n \"\"\"\n Test case attached to the cont... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.