conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to make cbr archive out of jpegs\n\nThe cbr commic archive format is just jpegs compressed with rar.\nThis script will automate the process of creating one from a folder of\njpegs.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom __future__ imp... | python | chosen |
[
{
"from": "human",
"value": "feat: Add script to transform csv files in dict structure\n\nReads a csv file to transform in dict structure and then print it\nin a frienly format\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nTransform csv files in dict structures and print in a pr... | python | chosen |
[
{
"from": "system",
"value": "Revert \"retrieve currently playing info (commented out)\"\n\nThis reverts commit 2c07f2110c844ce86af2fc0b818db196379d9310.\n"
},
{
"from": "human",
"value": "from flask import Flask, render_template\nfrom settings import *\n\nimport jsonrpclib\n\napp = Flask(__name... | python | chosen |
[
{
"from": "human",
"value": "Add test case for authors mapping\n"
},
{
"from": "gpt",
"value": "from os.path import dirname, join\nimport subprocess\nimport unittest\n\nfrom cvsgit.command.clone import Clone\nfrom cvsgit.git import Git\nfrom cvsgit.utils import Tempdir\nfrom cvsgit.main import U... | python | chosen |
[
{
"from": "human",
"value": "Add integration test for plotting utilities\n"
},
{
"from": "gpt",
"value": "\"\"\"Integration tests for plotting tools.\"\"\"\nfrom emdp import examples\nfrom emdp.gridworld import GridWorldPlotter\nfrom emdp import actions\nimport random\nimport matplotlib\nmatplot... | python | chosen |
[
{
"from": "human",
"value": "Add a test written by darikg. Not actually executed, please confirm it.\n"
},
{
"from": "gpt",
"value": "from pgcli.packages.tabulate import tabulate\nfrom textwrap import dedent\n\n\ndef test_dont_strip_leading_whitespace():\n data = [[' abc']]\n headers = ... | python | chosen |
[
{
"from": "human",
"value": "Send sms to phones via twilio api\n\nfirst install twilio using cmd pip install twilio after this step run the above script to send sms , update sid and token wrt your accounts"
},
{
"from": "gpt",
"value": "from twilio.rest import TwilioRestClient\n\n# Find these va... | python | chosen |
[
{
"from": "human",
"value": "Add Structure class using pandas DataFrame\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom pandas import DataFrame\nfrom javelin.unitcell import UnitCell\n\n\nclass Structure(object):\n def __init__(self):\n self.unitcell = UnitCell()\n sel... | python | chosen |
[
{
"from": "human",
"value": "Add a python script to list all items\n\nSaves the item name, item path, and image path into \"items.json\"\n"
},
{
"from": "gpt",
"value": "import os\nimport json\nimport re\n\n###############################################\n# Run this from the root of the assets f... | python | chosen |
[
{
"from": "system",
"value": "Add utility function for executing test runs\n"
},
{
"from": "human",
"value": "import os\n\nSUPPORT = os.path.abspath(os.path.join(os.path.dirname(__file__), 'support'))\n\ndef support_file(*path_parts):\n return os.path.join(SUPPORT, *path_parts)\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Write in gpio on raspberry\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as GPIO\nfrom time import sleep\n\nGPIO.setmode(GPIO.BCM)\n\nGPIO.setup(9, GPIO.OUT)\nGPIO.setup(11, GPIO.OUT)\n\nwhile 1:\n GPIO.output(9, True)\n sleep(0.25)\n GPIO.output(9, False)\n s... | python | chosen |
[
{
"from": "human",
"value": "Add a session based source\n\nThis will pull the auth information from the current session.\n"
},
{
"from": "gpt",
"value": "from zope.interface import implementer\n\nfrom .interfaces (\n IAuthSourceService,\n )\n\n@implementer(IAuthSourceService)\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add a handy CLI test client\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport json, argparse\nimport httplib, subprocess, os\n\ndef execute(args):\n IP = args.agent.split(':')[0]\n if len(args.agent.split(':')) == 2:\n port = args.agent.sp... | python | chosen |
[
{
"from": "human",
"value": "Add USB VCP test script.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\nimport sys, serial, struct\nport = '/dev/ttyACM0'\nsp = serial.Serial(port, baudrate=115200, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,\n xonxoff=False, rtscts=F... | python | chosen |
[
{
"from": "human",
"value": "Add test case for EPCanvas.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\" Test case for Energy Profle Canvas.\n\"\"\"\n\nimport unittest\n\nfrom catplot.ep_components.ep_canvas import EPCanvas\n\n\nclass EPCanvasTest(unitte... | python | chosen |
[
{
"from": "human",
"value": "Add module capable of creating a window when ran\n"
},
{
"from": "gpt",
"value": "import pygame\n\n\npygame.init()\n\n#-- SCREEN CHARACTERISTICS ------------------------->>>\nbackground_color = (255,255,255)\n(width, height) = (300, 200)\n\n#-- RENDER SCREEN --------... | python | chosen |
[
{
"from": "human",
"value": "Add some random benchmark module\n\nThis module existed for some time in my local working dir. TBH, I forgot\nabout its precise purpose, but it doesn't really hurt to add it right\nnow, so whatever…\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_imp... | python | chosen |
[
{
"from": "human",
"value": "Add first sensor reader (SDS011) client script\n"
},
{
"from": "gpt",
"value": "import sys\nfrom sds011 import Sds011Reader\nfrom mqttsender import client\n\nif len(sys.argv) > 1:\n port = sys.argv[1]\nelse:\n port = '/dev/ttyUSB0'\n\nsds011 = Sds011Reader(port... | python | chosen |
[
{
"from": "human",
"value": "Create xml of all jpg/png from list of files & directories.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python3\n\nimport sys\nimport argparse\nimport xml_utils as u\nimport datetime\nimport pdb\nimport os\nfrom argparse import RawTextHelpFormatter\nfrom collections... | python | chosen |
[
{
"from": "human",
"value": "Debug test, ported from the old debug test\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n\nimport pycurl\nimport unittest\n\nfrom . import app\nfrom . import runwsgi\n\nsetup_module, teardown_module = runwsgi.app... | python | chosen |
[
{
"from": "human",
"value": "Put in sanity-check for project scores.\n"
},
{
"from": "gpt",
"value": "from toolshed.importer import create_project\nfrom toolshed.updater import update_projects_score\n\n\ndef test_oauth_rankings():\n flask_dance = create_project(pypi_url=\"https://pypi.python.... | python | chosen |
[
{
"from": "human",
"value": "Add tests for utils module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n colorful\n ~~~~~~~~\n\n Terminal string styling done right, in Python.\n\n :copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>\n :license: MIT, see LICE... | python | chosen |
[
{
"from": "human",
"value": "Add generic settings-related GUI util module\n"
},
{
"from": "gpt",
"value": "# gui.py\r\n# Generic GUI crap\r\nfrom gi.repository import Gtk\r\n\r\nclass CheckEntry(Gtk.Box):\r\n def __init__(self, labeltxt, togglef = None):\r\n Gtk.Box.__init__(self, spac... | python | chosen |
[
{
"from": "human",
"value": "Add test for the depends() function.\n"
},
{
"from": "gpt",
"value": "\"\"\"Using depends() to mark dependencies at runtime.\n\"\"\"\n\nimport pytest\n\n\ndef test_skip_depend_runtime(ctestdir):\n \"\"\"One test is skipped, other dependent tests are skipped as wel... | python | chosen |
[
{
"from": "human",
"value": "Bring coverage for the converters module up to 100%.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom beaker.converters import asbool, aslist\n\n\nclass AsBool(unittest.TestCase):\n def test_truth_str(self):\n for v in ('true', 'yes', 'on', 'y', 't'... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for our main public API so we can start to re-impliment the parser\n"
},
{
"from": "gpt",
"value": "from xml.etree import ElementTree\n\nfrom junit2htmlreport import parser as j2h\n\n\ndef test_public_api():\n container = j2h.Junit(xmlstring=\"\"\"<... | python | chosen |
[
{
"from": "human",
"value": "Add a simulator for measuring perfect deduplication\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport gzip\nimport itertools\nimport timer\nimport sys\nimport utils\n\n\n# A set of files already in the storage\nseen = set()\n\n# The total number of uplo... | python | chosen |
[
{
"from": "human",
"value": "Add a command to list all primary image filenames for people\n\nThis is useful to make a list of files to copy to your development copy\nto make sure you don't have broken images on people pages, or pages that\nlist people.\n"
},
{
"from": "gpt",
"value": "from djang... | python | chosen |
[
{
"from": "human",
"value": "Add journal script (needs next version of ftw pinned), remove conftest.py\n"
},
{
"from": "gpt",
"value": "from ftw import ruleset, logchecker, testrunner\nimport pytest\nimport sys\nimport re\nimport os\nimport ConfigParser\n\ndef test_crs(ruleset, test, logchecker_... | python | chosen |
[
{
"from": "human",
"value": "Add tests for user frontend forms\n\nIssue #479\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.http import HttpResponse\nfrom django.test import Client,... | python | chosen |
[
{
"from": "human",
"value": "Add new unit tests for reading alternate file map.\n"
},
{
"from": "gpt",
"value": "import os\nimport re\nimport sys\nimport pytest\nfrom mock import Mock, mock_open, patch\napp_path = os.path.dirname(os.path.abspath(__file__))\nsys.path.insert(0, app_path + '/../')\... | python | chosen |
[
{
"from": "human",
"value": "Add file for running fits with OpenMPI\n"
},
{
"from": "gpt",
"value": "\"\"\"\nScript to run all redshift fits in parallel with OpenMPI\n\nUsage: \n\n mpiexec -n 10 python -m mpi4py.futures $GRIZLICODE/grizli/pipeline/run_MPI.py\n \nwhere \"-n 8\" indicates ru... | python | chosen |
[
{
"from": "human",
"value": "Add functionality of importing hackerone reports add-hackeroneparcer-359\n"
},
{
"from": "gpt",
"value": "import json\nimport hashlib\nfrom urllib.parse import urlparse\nfrom dojo.models import Endpoint, Finding\n\n__author__ = 'Kirill Gotsman'\n\n\nclass HackerOneJS... | python | chosen |
[
{
"from": "human",
"value": "Add resnet training scheme (draft)\n"
},
{
"from": "gpt",
"value": "\n'''Trains a simple convnet on the MNIST dataset.\n\nGets to 99.25% test accuracy after 12 epochs\n(there is still a lot of margin for parameter tuning).\n16 seconds per epoch on a GRID K520 GPU.\n'... | python | chosen |
[
{
"from": "human",
"value": "Copy over test from the PR into its own module\n"
},
{
"from": "gpt",
"value": "def test_generate_copy_without_render_extensions(self):\n generate.generate_files(\n context={\n 'cookiecutter': {\n \"repo_name\": \"test_copy_without... | python | chosen |
[
{
"from": "human",
"value": "Add some extra tests for placement\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom gi.repository import Gtk\n\nfrom gaphas.item import Element\nfrom gaphas.tool.placement import PlacementState, on_drag_begin, placement_tool\n\n\n@pytest.fixture\ndef tool_factory... | python | chosen |
[
{
"from": "human",
"value": "Create script that print analysis_files (rep per rep)\n"
},
{
"from": "gpt",
"value": "import synthetic_data_experiments as sde\n\nimport logging\n\nif __name__ == \"__main__\":\n args = sde.get_integrous_arguments_values()\n \n \n \n for repeat_idx in... | python | chosen |
[
{
"from": "human",
"value": "[DEV] Add a script to dump DB in bib file\n"
},
{
"from": "gpt",
"value": "# !/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"Dump SQL database into bibtex file.\"\"\"\n\nimport sys\nimport bibtexparser\nfrom bibtexparser.bparser import BibTexParser\nfrom bibt... | python | chosen |
[
{
"from": "human",
"value": "Add Fibonacci script to Python\n"
},
{
"from": "gpt",
"value": "phi = (1 + 5**0.5) / 2\n\ndef F(n):\n return int(round((phi**n - (1-phi)**n) / 5**0.5))\ndef fib(n):\n a = 0\n fibs = []\n if n > 0:\n while a < n:\n a = a + 1\n ... | python | chosen |
[
{
"from": "human",
"value": "Test to crack the xor obfuscation crackme\n"
},
{
"from": "gpt",
"value": "\nimport smt2lib\nfrom triton import *\n\n# PoC. Doesn't work yet\n# $ triton ./examples/crackme_xor_obfu.py ./samples/crackmes/crackme_xor_obfu a\n\n_GREEN = \"\\033[92m\"\n_ENDC = \"\\033[0... | python | chosen |
[
{
"from": "system",
"value": "Create the Home Page > Create the Home Page View\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\n\n# Create your views here.\n"
},
{
"from": "gpt",
"value": "from django.views.generic.base import TemplateView\n\nclass HomePage(Tem... | python | chosen |
[
{
"from": "human",
"value": "Create PaperPass class. It contains outputjson method.\n"
},
{
"from": "gpt",
"value": "import json\n\nclass PaperPass:\n\n # class var\n outline = {}\n\n def __init__(self, outline):\n self.outline = outline\n\n def outputjson(self, filename):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking installed CUDA version.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nSimple script for checking installed CUDA version.\n\"\"\"\n\nimport ctypes\n\ntry:\n _libcudart = ctypes.cdll.LoadLibrary('libcudart.so')\nexcept:\n ... | python | chosen |
[
{
"from": "human",
"value": "Build a connection model system which will help with generating new Fiascos based on a playset and a set of characters.\n"
},
{
"from": "gpt",
"value": "from . import model\n\nclass Connection(object):\n def __init__(self, left, right, relationship, detail):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate plate barcodes for the Zebra printer\n"
},
{
"from": "gpt",
"value": "import argparse\n\ndef makeBarcode(label):\n print(\"^XA\") #start of label\n print(\"^DFFORMAT^FS\") #download and store format, name of format, end of field data (FS ... | python | chosen |
[
{
"from": "human",
"value": "Add helper for log retrieval\n"
},
{
"from": "gpt",
"value": "\"\"\" provide functions for history handling.\n\tnote that history stuff is only possible\n\tif maki is not running remote.\n\"\"\"\nimport os\nfrom ..com import sushi\nfrom ..typecheck import types\n\nFI... | python | chosen |
[
{
"from": "human",
"value": "Test that childless pages get built, even if paginated\n"
},
{
"from": "gpt",
"value": "\"\"\"Test for issue `#410`_.\n\nThis tests for at least one of the bugs reported in `#410`_, namely\n that paginated pages were not being built if they had no children.\n\n.. _#4... | python | chosen |
[
{
"from": "human",
"value": "Add utility for looking up grades for files in a directory.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport os\nimport sys\nfrom movie_util import filenames_to_search_strings, print_movies\nfrom filmtipset_util import get_grades\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add creation tests for Terminal\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 Terminal\n\n\nclass TempC... | python | chosen |
[
{
"from": "human",
"value": "Add example script for python -m recipy usage\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUsage: python -m recipy example_script3.py OUTPUT.npy\n\"\"\"\n\nfrom __future__ import print_function\nimport sys\n\nimport numpy\n\nif len(sys.argv) < 2:\n print(__doc__, file... | python | chosen |
[
{
"from": "human",
"value": "Create module for points interpolation using B-spline of 2nd degree.\n"
},
{
"from": "gpt",
"value": "''' Module provides functions for points interpolation using b-splines of 2nd order '''\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\n\ndef b_spline... | python | chosen |
[
{
"from": "human",
"value": "Add a Python script which downloads only the latest Linux snapshots (derived from other scripts here)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os, tarfile, hashlib, re, shutil, sys\nfrom snapshot import *\n\nf = open(snapshotfile)\ndate = None... | python | chosen |
[
{
"from": "human",
"value": "Add a REST API for GO\n"
},
{
"from": "gpt",
"value": "# https://www.ebi.ac.uk/QuickGO/WebServices.html\n\nimport os\nimport csv\n\nimport restapi\n\nclass GORESTAPI(restapi.RESTAPI):\n\n def __init__(self, download_folder=\"go_files\"):\n self._download_fo... | python | chosen |
[
{
"from": "human",
"value": "Implement non-deterministic turing machine in Python\n"
},
{
"from": "gpt",
"value": "# Non-Deterministic Turing Machine Simulator\n\nclass Queue():\n def __init__(self):\n self.queue = []\n\n def enqueue(self, state, head, string, iter_count):\n ... | python | chosen |
[
{
"from": "system",
"value": "Set `output_routes` to True by default"
},
{
"from": "human",
"value": "import logging\nimport json\nfrom tornado.options import define, options\n\n\n_CONFIG_FILENAME = \"cutthroat.conf\"\n\n\ndef define_options():\n \"\"\"Define defaults for most custom options\... | python | chosen |
[
{
"from": "human",
"value": "Add init file to container/experimental directory to recognize as a python module.\n\nPiperOrigin-RevId: 447585056\n"
},
{
"from": "gpt",
"value": "# Copyright 2022 The Kubeflow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \... | python | chosen |
[
{
"from": "human",
"value": "Add unittests for the commonsdownloader module\n\nAdd a unittest module to test the methods in the commonsdownloader module.\nAdd test for method clean_up_filename()\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: latin-1 -*-\n\n\"\"\"Unit tests... | python | chosen |
[
{
"from": "human",
"value": "Test the pipeline code for the RNA-seq pipeline\n"
},
{
"from": "gpt",
"value": "\"\"\"\n.. Copyright 2017 EMBL-European Bioinformatics Institute\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in complianc... | python | chosen |
[
{
"from": "human",
"value": "Add basic script to get roza durations for assigned parameters.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom rajab_roza import RajabRoza\n\nlat = 51.0 + 32.0/60.0\nlng = -22.0/60.0\nstart_year = 1435\nend_year = 1436\nfilename = \"1435-1436.yml\"\n\... | python | chosen |
[
{
"from": "human",
"value": "Add script that profiles basic test run\n"
},
{
"from": "gpt",
"value": "from pyresttest import resttest\nfrom pyresttest.benchmarks import Benchmark\nfrom pyresttest.binding import Context\nfrom pyresttest.contenthandling import ContentHandler\nfrom pyresttest.gener... | python | chosen |
[
{
"from": "human",
"value": "WORK WORK WOKR ROWK KROW\n"
},
{
"from": "gpt",
"value": "import curses\n# -*- coding: utf-8 -*-\n\ndogdance1=[\n' ▄','▄', '▄', #3\n'▄▄▄▄', '▄', '▄', #6\n'▄\\n', ' ', ' ',\n' ', '▄', '▄\\n',#12\n' ', ' ' , '▄',#15\n' ', '▄', ' ',#18\n'▄▄', '▄▄\\n', ' ',... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for complicated comparisons\n"
},
{
"from": "gpt",
"value": "from itertools import combinations\nfrom unittest import TestCase\n\nfrom ordering import Ordering\n\n\nclass TestComparisons(TestCase):\n def setUp(self) -> None:\n self.ordering = ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 29\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\npower_list = set()\n\nfor a in range(2, 101):\n for b in range(2, 101):\n power_list.add(a ** b)\n\nprint(len(power_list))\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Concatenate rootmaps in a smart way\n\n- Avoid duplicates in the fwd declaration section\n- Reduce keys sections if the library is the same\n\nMerging rootmaps speeds up ROOT startup, especially on file systems\nlike afs or cvmfs.\n"
},
{
"from": "gpt",
"value": "#! ... | python | chosen |
[
{
"from": "human",
"value": "Add new illustrative test: monkeypatching stdout\n"
},
{
"from": "gpt",
"value": "import sys\nimport io\n\nimport hacks\n\n\ndef test_stdout_monkeypatching():\n \n # Let's first patch stdout manually:\n real_stdout = sys.stdout\n fake_stdout = io.StringIO... | python | chosen |
[
{
"from": "human",
"value": "Create basic user agent spoofer with Mechanize\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env\nimport mechanize\n\n\ndef test_agent(url, user_agent):\n browser = mechanize.Browser()\n browser.addheaders = user_agent\n page = browser.open(url)\n source_co... | python | chosen |
[
{
"from": "human",
"value": "Test script stub for testing the adjacency reader\n"
},
{
"from": "gpt",
"value": "\"\"\"\n.. Copyright 2017 EMBL-European Bioinformatics Institute\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in complia... | python | chosen |
[
{
"from": "human",
"value": "Add a utility script with a function to remove Textbook from current textbook chapter tasks.\n"
},
{
"from": "gpt",
"value": "\"\"\"Helper script that contains many utilities.\n\"\"\"\n\n\n__authors__ = [\n '\"Madhusudan.C.S\" <madhusudancs@gmail.com>',\n ]\n\n\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add test script for existing samples\n"
},
{
"from": "gpt",
"value": "#!\\usr\\bin\\env python\n\n\"\"\"A test script to parse the existing samples and convert them to JSON.\n\nNot all of the examples currently work.\n\nExample usage:\n python convert_samples.py /... | python | chosen |
[
{
"from": "human",
"value": "Add structure for query harness\n"
},
{
"from": "gpt",
"value": "import argparse\nimport datetime\nfrom os import getcwd\nfrom os.path import isdir, exists\nfrom project import corpus, knn_corpus, lda_corpus, word2vec_corpus\n\nalgorithms = {\"lda\": lda_corpus.LDACo... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for check_bmi.\n"
},
{
"from": "gpt",
"value": "from bmi_tester.api import check_bmi\n\n\ndef test_bmi_check(tmpdir):\n with tmpdir.as_cwd():\n with open(\"input.yaml\", \"w\") as fp:\n pass\n assert (\n check_bmi... | python | chosen |
[
{
"from": "system",
"value": "Rename variable, prefix private function\n"
},
{
"from": "human",
"value": "\"\"\"\nbyceps.blueprints.ticketing.views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom f... | python | chosen |
[
{
"from": "human",
"value": "Add a template to readily generate PDF report from properties and dimensions\n"
},
{
"from": "gpt",
"value": "import os\nfrom . import reporting\n\n\ndef create_section(title, desc, props, subsects, figures_list):\n assert isinstance(title, str)\n assert isinst... | python | chosen |
[
{
"from": "human",
"value": "Add solution to complementing a strand of DNA\n"
},
{
"from": "gpt",
"value": "\"\"\"\nIn DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'.\n\nThe reverse complement of a DNA string s is the string sc formed by reversing the symbols ... | python | chosen |
[
{
"from": "human",
"value": "Add program populating matrix with numbers starting with 1 in the matrix center and then spiralling out\n"
},
{
"from": "gpt",
"value": "size = 7\nm = [[0] * size for _ in range(size)]\nstart = size // 2\ntotal = size * size\ncurrent = 1\n\ni = j = start\ndirection =... | python | chosen |
[
{
"from": "human",
"value": "Test Robot interactions with wait_start\n"
},
{
"from": "gpt",
"value": "import time\nimport unittest\nfrom unittest import mock\n\nfrom robot import game_specific\nfrom robot.board import Board\nfrom robot.robot import Robot\nfrom tests.mock_robotd import MockRobotD... | python | chosen |
[
{
"from": "human",
"value": "Migrate to a custom User class (4)\n\nstep4: create an empty migration script\npython manage.py makemigrations --empty note\n\nThen edit the script and add a function that will copy the users from\nthe old users table to the new one.\n"
},
{
"from": "gpt",
"value": "... | python | chosen |
[
{
"from": "human",
"value": "Add print XSL files script\n"
},
{
"from": "gpt",
"value": "import logging\nimport os\n\nfrom settings import CONVERSIONS, XSL_PATH\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef print_xsl_files():\n\tfor parts in CONVERSIONS:\n\t\tfile_path = os.path.join(XSL_PA... | python | chosen |
[
{
"from": "human",
"value": "Implement a Pop class to unapply patches\n"
},
{
"from": "gpt",
"value": "# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:\n\n# python-quilt - A Python implementation of the quilt patch system\n#\n# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>\n#\n# Thi... | python | chosen |
[
{
"from": "human",
"value": "Add simple script to display positive detections\n"
},
{
"from": "gpt",
"value": "# Ported From: http://docs.opencv.org/3.1.0/d7/d8b/tutorial_py_face_detection.html\nimport os\nimport cv2\n\ncascade = cv2.CascadeClassifier('/home/matt/Projects/opencv-junk/classifier/... | python | chosen |
[
{
"from": "human",
"value": "Increase max length of author and genre fields\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.2.7 on 2021-10-28 18:58\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('museum_site', '0... | python | chosen |
[
{
"from": "human",
"value": "Write default config with paver.\n"
},
{
"from": "gpt",
"value": "from paver.easy import *\n\n\nconfig = \"\"\"# replace pass with values you would like to overwrite from DefaultConfig in\n# default_config.py. Values you do not explicitly overwrite will be inherited\... | python | chosen |
[
{
"from": "human",
"value": "Add test case for frames.\n"
},
{
"from": "gpt",
"value": "from . import TheInternetTestCase\nfrom helium.api import click, Text\n\nclass FramesTest(TheInternetTestCase):\n\tdef get_page(self):\n\t\treturn \"http://the-internet.herokuapp.com/frames\"\n\tdef test_nest... | python | chosen |
[
{
"from": "human",
"value": "tests: Add tests for TaskWikiChooseProject command\n"
},
{
"from": "gpt",
"value": "from tests.base import IntegrationTest\nfrom time import sleep\n\n\nclass TestChooseProject(IntegrationTest):\n\n viminput = \"\"\"\n * [ ] test task 1 #{uuid}\n * [ ] test ... | python | chosen |
[
{
"from": "human",
"value": "Convert README from Markdown to rst.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# register.py\n#\n# purpose: Automagically creates a Rst README.txt\n# author: Filipe P. A. Fernandes\n# e-mail: ocefpaf@gmail\n# web: http://ocefpaf.github.io... | python | chosen |
[
{
"from": "human",
"value": "Add very basic turing tests\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase, expectedFailure\n\n\nclass TuringTests(TestCase):\n\n def setUp(self):\n from chatterbot import ChatBot\n\n self.chatbot = ChatBot('Agent Jr.')\n\n @expect... | python | chosen |
[
{
"from": "system",
"value": "Allow tests to be run on 1.4\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\nfrom os.path import dirname, abspath\n\nfrom django.conf import settings\n\n\nif len(sys.argv) > 1 and 'postgres' in sys.argv:\n sys.argv.remove('postgres')\n db... | python | chosen |
[
{
"from": "human",
"value": "[python] Call functions in C library, mutable buffer\n"
},
{
"from": "gpt",
"value": "from ctypes import CDLL, sizeof, create_string_buffer\n\ndef test_hello_world(workspace):\n workspace.src('greeting.c', r\"\"\"\n #include <stdio.h>\n\n void greet(char *so... | python | chosen |
[
{
"from": "human",
"value": "Add my two pass solution\n"
},
{
"from": "gpt",
"value": "class ListNode:\n def __init__(self, x):\n self.val = x\n self.next = None\n\nclass Solution:\n def removeNthFromEnd(self, head, n):\n \"\"\"\n :type head: ListNode\n :... | python | chosen |
[
{
"from": "system",
"value": "Fix error in example script"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport pywapi\n\nweather_com_result = pywapi.get_weather_from_weather_com('10001')\nyahoo_result = pywapi.get_weather_from_yahoo('10001')\nnoaa_result = pywapi.get_weather_from_noa... | python | chosen |
[
{
"from": "human",
"value": "Create program that fethes code from leetcode.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n\nimport json\nimport requests\nimport argparse\nfrom typing import Tuple\nfrom os.path import exists\n\n\nBASE_URL = 'https://leetcode.com/problems/'\nGRAPHQL_API_U... | python | chosen |
[
{
"from": "system",
"value": "Add credentials module to core list\n"
},
{
"from": "human",
"value": "from .plcorebase import PlCoreBase\nfrom .planetstack import PlanetStack\nfrom .project import Project\nfrom .singletonmodel import SingletonModel\nfrom .service import Service\nfrom .service imp... | python | chosen |
[
{
"from": "human",
"value": "Create constant module with DATA_DIRECTORY\n"
},
{
"from": "gpt",
"value": "\"\"\"\nConstants for mots-vides\n\"\"\"\nimport os\n\nDATA_DIRECTORY = os.path.join(\n os.path.dirname(\n os.path.abspath(__file__)),\n 'datas/'\n)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add more unit test cases\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nimport unittest\ntry:\n from unittest import mock\nexcept ImportError:\n import mock\n\nfrom requests.structures import CaseInsensitive... | python | chosen |
[
{
"from": "human",
"value": "Add the basic main program for the Pycon\n"
},
{
"from": "gpt",
"value": "import time\nimport Edison.i2c as I2C\nimport Edison.gpio as GPIO\nimport Edison.spi as SPI\nimport ads1015\nimport sharp2y0a21\nimport screen\nimport ILI9341 as TFT\nimport watchout_screen\nim... | python | chosen |
[
{
"from": "human",
"value": "Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well\n"
},
{
"from": "gpt",
"value": "from PIL import Image, ImageDraw\n\nimport random\n\nW = 500\nim = Image.new('RGB', (W, W))\nNCOLORS = 19\nNLINES = 15\n\ndef... | python | chosen |
[
{
"from": "human",
"value": "Test fetching tweets from twitter works.\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport unittest\n\nsys.path.insert(0, os.path.abspath('./situation'))\nsys.path.insert(0, os.path.abspath('./'))\n\nfrom situation import settings, tweeter, tweepy\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add some unicode tests for Menu()\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom dynmen import Menu, MenuResult\nfrom functools import partial\nimport unittest\n\n\nclass TestFirstItem(unittest.TestCase):\n @classmethod\n def setUpClass(cls):\n ... | python | chosen |
[
{
"from": "human",
"value": "Update meta data for core models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2017-04-23 08:41\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for backup mechanism\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom robotide.controller.chiefcontroller import Backup\n\n\nclass BackupTestCase(unittest.TestCase):\n\n def setUp(self):\n self._backupper = _MyBackup()\n\n def test_backup... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.