conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add debug util to listen on a tty and print input\n\nMakes it much easier to debug the arduino_serial stuff.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=utf8\n\n# http://stackoverflow.com/a/15095449/706819\n\nimport os\nimport pty\n\ndef print_se... | python | chosen |
[
{
"from": "human",
"value": "Add script to draw learning curve\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n\ndef learning_curve(csv_file):\n df = pd.read_csv(csv_file)\n df_train = df.query(\"type == ... | python | chosen |
[
{
"from": "human",
"value": "Create the class that maintain the term cache.\n"
},
{
"from": "gpt",
"value": "from django.conf import settings\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom datetime import datetime\nfrom models import Term\nfrom restclients.sws_client import SWSClie... | python | chosen |
[
{
"from": "human",
"value": "Add script to ensure the correct tile size of a file\n\nBy @tomka\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# This is a helper script to ensure an image has the correct tile size.\n# It uses pgmagick[1] to read and (if needed) correct the image. To use\n... | python | chosen |
[
{
"from": "human",
"value": "Add first working `get_archivable_members` function\n"
},
{
"from": "gpt",
"value": "from datetime import timedelta\n\nfrom sqlalchemy import func, nulls_last\nfrom sqlalchemy.engine import Row\nfrom sqlalchemy.future import select\nfrom sqlalchemy.sql.elements impor... | python | chosen |
[
{
"from": "human",
"value": "Determine whether linear or polynomial fit is best for seasonal change\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport pandas as pd\nfrom scipy import interpolate, poly1d\nimport matplotlib.pyplot as plt\n \n \ndef main():\n df = pd.read_csv('greenla... | python | chosen |
[
{
"from": "human",
"value": "Clean user role permissions: remove vote_issues in Role.permissions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-04-04 09:32\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migra... | python | chosen |
[
{
"from": "human",
"value": "Introduce a `BaseForm` to allow customization of field order\n\n"
},
{
"from": "gpt",
"value": "from collections import OrderedDict\n\nfrom flask_wtf import Form\n\n\nclass BaseForm(Form):\n def __iter__(self):\n field_order = getattr(self, '_order', [])\n\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for pack and config schema registrar.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regard... | python | chosen |
[
{
"from": "system",
"value": "Make ipythonprinting test more robust\n"
},
{
"from": "human",
"value": "\"\"\"Tests that the IPython printing module is properly loaded. \"\"\"\n\nfrom sympy.interactive.session import init_ipython_session\nfrom sympy.external import import_module\n\nipython = impo... | python | chosen |
[
{
"from": "human",
"value": "Add makefile build rule for building HTML files which show which lines are covered and which are not.\n"
},
{
"from": "gpt",
"value": "\nimport os\n\nos.chdir('tests/cmdline')\n\nlines = file('coverage.out', 'r').readlines()\n\n\nfiles = {}\n\n\nfor line in lines:\n\... | python | chosen |
[
{
"from": "human",
"value": "Add CLI to regenerate ontology\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport glob\nimport shutil\nimport logging\nfrom .ontology import BioOntology, CACHE_DIR\n\nlogger = logging.getLogger('indra.ontology.bio')\n\nif __name__ == '__main__':\n impo... | python | chosen |
[
{
"from": "system",
"value": "Add some info to Factory pattern\n"
},
{
"from": "human",
"value": "\"\"\"\nFactory Pattern\n\nDefinition:\n pass\n\nAlso Known As:\n pass\n\nProblem:\n pass\n\nWrong Solution:\n pass\n\nCorrect Solution:\n pass\n\nSources:\n Title: Head First Desi... | python | chosen |
[
{
"from": "human",
"value": "Add demo example for BMI\n"
},
{
"from": "gpt",
"value": "import os\nimport shutil\nfrom indra.sources import eidos\nfrom indra.assemblers.bmi_wrapper import BMIModel\nfrom indra.assemblers import PysbAssembler\n\n\ndef text_to_stmts(text):\n fname = text.replace(... | python | chosen |
[
{
"from": "human",
"value": "Add stub for a regular expression based blueprint.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nRegular-expression based blueprint for Kyoukai.\n\nThis produces regex-based routes when ``wrap_route`` is called, and is the default blueprint handler for the Kyoukai\nbluepr... | python | chosen |
[
{
"from": "human",
"value": "Test file to try camera tracking parameters\n"
},
{
"from": "gpt",
"value": "from SimpleCV import *\nimport time\n\ncam = Camera()\n\ntry:\n while True:\n\n t0 = time.time()\n \n img = cam.getImage() \n\n topCropH = 60\n img = ... | python | chosen |
[
{
"from": "human",
"value": "Add role_order column to roles table\n"
},
{
"from": "gpt",
"value": "\n\"\"\"Add roles order column\n\nRevision ID: 99925466d6e\nRevises: 401fb7f0184b\nCreate Date: 2015-08-05 10:55:43.992382\n\n\"\"\"\n\nfrom alembic import op\nimport sqlalchemy as sa\n\n# revision... | python | chosen |
[
{
"from": "human",
"value": "Add tests of some utilities and internals\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf8\nfrom __future__ import (absolute_import, print_function, division, unicode_literals)\n\n''' Simple test file for debugging and testing at the shell. To... | python | chosen |
[
{
"from": "human",
"value": "Add initial test to check response status code\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport billy\n\nclass TestSunlightAPI(unittest.TestCase):\n\n def test_can_get_resp_200(self):\n resp = billy.getresponse()\n self.assertEqual(resp.sta... | python | chosen |
[
{
"from": "human",
"value": "Implement a basic test for StrictEnvironment\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom cookiecutter.environment import StrictEnvironment\nfrom cookiecutter.exceptions import UnknownExtension\n\n\ndef test_env_should_raise_for_u... | python | chosen |
[
{
"from": "human",
"value": "Add WSGI app template to play with uWSGI server.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# content/doc/misc/_wsgi-app.py\n# =============================================================================\n# WSGI application template.\n# Usage:\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for queryLayers column\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import MetaData, Table, Column, types\n\nfrom c2cgeoportal import schema\n\n\ndef upgrade(migrate_engine):\n meta = MetaData(bind=migrate_engine)\n layer = Table('layer... | python | chosen |
[
{
"from": "human",
"value": "Add a test for SaveFile\n\nContributes to CURA-511\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nimport unittest\nimport os.path\nimport tempfile\n\nfrom multiprocessing import ... | python | chosen |
[
{
"from": "human",
"value": "Add a file to split text files by rows\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\nimport argparse\n\nargparser = argparse.ArgumentParser(description=\"Split text file rows to separate files\")\n\nargparser.add_argument(\"filena... | python | chosen |
[
{
"from": "human",
"value": "Add a video pipeline example.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport pygst\npygst.require(\"0.10\")\nimport gst\nimport gtk\n\n\nclass Pipeline(object):\n def __init__(self):\n self.pipeline = gst.Pipeline(\"pipe\")\n self.w... | python | chosen |
[
{
"from": "human",
"value": "Add index on poll question ruleset UUID\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.3 on 2019-08-14 07:55\n\nfrom django.db import migrations\n\n# language=SQL\nINDEX_SQL = \"\"\"\nCREATE INDEX polls_pollquestion_ruleset_uuid\nON polls_pollquestion (ru... | python | chosen |
[
{
"from": "human",
"value": "Add script to import a folder of named images and attach to people.\n"
},
{
"from": "gpt",
"value": "\"\"\" Loop through images in a directory and attempt to match them to a person.\"\"\"\n\nimport re\nimport os\n\nfrom django.core.exceptions import ObjectDoesNotExis... | python | chosen |
[
{
"from": "human",
"value": "Add ttw tests for sign in modal\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom gratipay.testing import BrowserHarness\n\n\nclass Tests(BrowserHarness):\n\n def test_sign_in_modal_is_hidde... | python | chosen |
[
{
"from": "human",
"value": "Add a couple of places examples\n"
},
{
"from": "gpt",
"value": "from predicthq import Client\n\n# Please copy paste your access token here\n# or read our Quickstart documentation if you don't have a token yet\n# https://developer.predicthq.com/guides/quickstart/\nAC... | python | chosen |
[
{
"from": "human",
"value": "lib: Add a script for generating blocks\n\nWe'll need this too.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n# Input: https://www.unicode.org/Public/UNIDATA/Blocks.txt\n\nimport io\nimport re\n\nclass Builder(object):\n def __init__(self):\n pass\... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for rover compass\n"
},
{
"from": "gpt",
"value": "\nfrom unittest import TestCase\nfrom rover import Rover\n\nclass TestRover(TestCase):\n\n def setUp(self):\n self.rover = Rover()\n\n def test_rover_compass(self):\n assert self.... | python | chosen |
[
{
"from": "system",
"value": "Test that we actually create a senseknocker bug.\n"
},
{
"from": "human",
"value": "# {{{ Imports\nfrom mysite.base.tests import make_twill_url, TwillTests\n# }}}\n\nclass Form(TwillTests):\n fixtures = ['person-paulproteus.json', 'user-paulproteus.json']\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Read input file into \"memory\"\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nSynacor challenge for OSCON 2012.\n\nArchitecture description in file arch-spec.\n\"\"\"\nimport struct\nimport sys\n\n\n# Memory with 15-bit address space storing 16-bit ... | python | chosen |
[
{
"from": "human",
"value": "Add solution and unit tests for problem 3\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProject Euler Problem 3\n=======================\n\nThe prime factors of 13195 are 5, 7, 13 and 29.\n\nWhat is the largest prime factor of the number 600851475143?\n\"\"\"\ndef highest... | python | chosen |
[
{
"from": "human",
"value": "Add problem 42, pandigital substrings divisible by first primes\n"
},
{
"from": "gpt",
"value": "from time import time\nfrom itertools import permutations\n\nDIGITS = '1234567890'\nDIVS = [2, 3, 5, 7, 11, 13, 17]\n\n\ndef check_divs(pandigital):\n for i in range(1... | python | chosen |
[
{
"from": "human",
"value": "Add script for jiesuan parameters\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# coding: utf-8\nimport sys\nimport urllib2\nimport json\nimport time\nfrom datetime import datetime\n\nCURSOR='o_cursor'\nRD='report_date'\nUD='update_date'\nCU='COMMODITYDELIVFEEU... | python | chosen |
[
{
"from": "human",
"value": "Add command to find saved reports with slug[skip ci]\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function\n\nfrom django.conf import settings\nfrom dimagi.utils.couch.cache import cache_core\nfrom corehq.apps.reports.models import R... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating slave expectations\n\nBUG=489880\nR=friedman@chromium.org\n\nReview URL: https://codereview.chromium.org/1178383002.\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@295683 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",
"... | python | chosen |
[
{
"from": "human",
"value": "sequential: Add test code for SequentialRecipe\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom aiozk.recipes.sequential import SequentialRecipe\nfrom aiozk.exc import TimeoutError, NodeExists\n\n\n@pytest.mark.asyncio\nasync def test_wait_on_not_exist_sibling(... | python | chosen |
[
{
"from": "human",
"value": "Add shodan script to get page headers to test plugins\n"
},
{
"from": "gpt",
"value": "import re\nimport sys\nimport os\nimport pprint\n\nimport click\n\ntry:\n import shodan\nexcept ImportError:\n print('Install shodan: pip install shodan')\n sys.exit(0)\n\... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 449. Serialize and Deserialize BST\n\n449. Serialize and Deserialize BST: https://leetcode.com/problems/serialize-and-deserialize-bst/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __in... | python | chosen |
[
{
"from": "human",
"value": "Add ethernet type distribution script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python2\n# Processes Ethernet data\n\nf = open(\"data/eth_data.txt\", \"r\")\n\n# skip header lines\n[f.readline() for i in range(3) ]\n\ndata = []\n\nfor line in f:\n\tdata.append(line... | python | chosen |
[
{
"from": "human",
"value": "Create a test for our authentication backend.\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom django.contrib.auth import get_user\nfrom django.http import HttpRequest\nfrom django.core import mail\n\nfrom components.accounts.factories import EditorFactory\n\np... | python | chosen |
[
{
"from": "system",
"value": "Add param test cases to func test target project\n"
},
{
"from": "human",
"value": "import unittest\n\nclass SomeTests(unittest.TestCase):\n\n def test_ok(self):\n pass\n\n def test_typeerr(self):\n raise TypeError(\"oops\")\n\n def test_faile... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for salt.utils.which\n\nThis is a Linux-only test, it will need some mock love to make it\nsuitable to test for windows paths.\n"
},
{
"from": "gpt",
"value": "# Import python libs\nimport os\n\n# Import Salt Testing libs\nfrom salttesting import TestCa... | python | chosen |
[
{
"from": "human",
"value": "Change past gla.a elections to remove subtype group\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.10 on 2020-02-18 08:36\n\nfrom django.db import migrations\n\n\ndef remove_gla_a_subtype(apps, schema_editor):\n Election = apps.get_model(\"elections\",... | python | chosen |
[
{
"from": "human",
"value": "Add a state for add rooms\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_Room(EventState):\n\t'''\n\tAdd an object to Wonderland.\n\tFor the... | python | chosen |
[
{
"from": "human",
"value": "Add resource_slug to revisions table\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\"\"\"\nAdd slug to revisions\n\nCreate Date: 2017-02-24 12:51:02.131671\n\"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add script for converting Penn Treebank to Stanford format\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport re\n\ndef format_tree(): #converts from Penn Treebank to Stanford output\n regex = re.compile(r\"\\(([A-Za-z_$]+)\")\n with ... | python | chosen |
[
{
"from": "human",
"value": "Add mgmt command for basic otm1 migration checks\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\n\nfrom django.conf import settings\nfrom django... | python | chosen |
[
{
"from": "human",
"value": "Add file for rule's count method\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\r\n\"\"\"\r\n:Author Patrik Valkovic\r\n:Created 23.06.2017 16:39\r\n:Licence GNUv3\r\nPart of grammpy\r\n\r\n\"\"\"\r\n\r\nfrom unittest import main, TestCase\r\nfrom grammpy imp... | python | chosen |
[
{
"from": "human",
"value": "Add function to download filter data & cache it on disk\n"
},
{
"from": "gpt",
"value": "import os, re\n\nfrom wsynphot.io.get_filter_data import (get_filter_index,\n get_transmission_data)\nfrom wsynphot.config import get_data_dir\n\nCACHE_DIR = os.path.join(get_... | python | chosen |
[
{
"from": "human",
"value": "Add missing migrations for upload_to for new_building app.\n\nChange upload_to for builder and residentalcomplexfeature.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2018-08-31 20:51\nfrom __future__ import unicode_literals\... | python | chosen |
[
{
"from": "human",
"value": "Add a script to fixup rst files if the pre-commit hook rejects them.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Make a reST file compliant to our pre-commit hook.\n# Currently just remove trailing whitespace.\n\nfrom __future__ import with_statement\... | python | chosen |
[
{
"from": "human",
"value": "Add starting file templates for PBS/Torque job submission, ORCA EPR calculation.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\ndef eprfile(charge, multiplicity, xyzfile):\n \"\"\"\n A default template for an EPR input file.\n \"\"\"\n return... | python | chosen |
[
{
"from": "human",
"value": "Add simulation get_plot_data test for a run\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests Simulation class read method\n\"\"\"\nimport os\nimport yaml\nimport numpy as np\nfrom teemof import Simulation\nfrom teemof.parameters import k_parameters\n\n\nk_ref_file = os... | python | chosen |
[
{
"from": "human",
"value": "Test push to the second repository.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport smtplib \nfrom email.mime.text import MIMEText \nmailto_list=\"123997654@qq.com\"\nmail_host=\"smtp.gmail.com\" \nmail_user=\"yhhong1943\" \nmail_pass=\"hyh159263.\"... | python | chosen |
[
{
"from": "human",
"value": "Add python test for simple no-op loop\n"
},
{
"from": "gpt",
"value": "import argparse\nimport timeit\n\ndef noop():\n return None\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"-c\", \"--count\", default=1000000)\nargs = parser.parse_args()\n\nstart... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test for documentation\n"
},
{
"from": "gpt",
"value": "'''\n@author: Dallas Fraser\n@author: 2019-03-13\n@organization: MLSB API\n@summary: Tests all the advanced fun APIs\n'''\nfrom api.routes import Routes\nfrom api.test.BaseTest import TestSetup, SUC... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Reopen images for validation if they are closed\"\n\nThis reverts commit 7d43b1cf6eda74c86209a4cae0d71557ce9bdbc0.\n"
},
{
"from": "human",
"value": "import os\n\nfrom PIL import Image\n\nfrom django.core.exceptions import ValidationError\nfrom django.utils... | python | chosen |
[
{
"from": "human",
"value": "Add basicenumerator appleseed.studio Python plugin sample\n"
},
{
"from": "gpt",
"value": "\n#\n# This source file is part of appleseed.\n# Visit http://appleseedhq.net/ for additional information and resources.\n#\n# This software is released under the MIT license.\... | python | chosen |
[
{
"from": "human",
"value": "Add homework solution for tmarsha1.\n"
},
{
"from": "gpt",
"value": "__author__ = 'tmarsha1'\r\n\r\n\"\"\" find largest palindrome for the product of 2 three digit numbers\r\n (100-999) or (100^2 - 999^2)\r\n Answer is 913 * 993 = 906609\r\n\"\"\"\r\n\r\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add repository backend for samba buildfarm."
},
{
"from": "gpt",
"value": "# Copyright (c) 2009, 2010 Testrepository Contributors\n# \n# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause\n# license at the users choice. A copy of both licenses ... | python | chosen |
[
{
"from": "human",
"value": "Add script to assist in Gdrive Credentials.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUsage: python get_gdrive_credentials.py PATH_TO_SECRET_FILE\n\nThe purpose of this script is to create google login credentials to be ... | python | chosen |
[
{
"from": "human",
"value": "Work on understanding a bit about structured arrays in NUmpy before moving on to pandas dataframes\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n# old way to do it, make 3 different arrays of data. The downside of this is that it doesnt necessarily \n# tell ... | python | chosen |
[
{
"from": "system",
"value": "Use python imaging library to encode PNG instead of pypng"
},
{
"from": "human",
"value": "from pypng.code import png\nfrom base64 import standard_b64encode, standard_b64decode\nfrom StringIO import StringIO\n\n\ndef encode(string):\n \"\"\" PNG-compress the stri... | python | chosen |
[
{
"from": "human",
"value": "Add model for output type\n"
},
{
"from": "gpt",
"value": "from zou.app import db\nfrom zou.app.models.serializer import SerializerMixin\nfrom zou.app.models.base import BaseMixin\n\n\nclass OutputType(db.Model, BaseMixin, SerializerMixin):\n name = db.Column(db.S... | python | chosen |
[
{
"from": "human",
"value": "Add example of CP-logic parameter learning\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom semcplogic.dataset import Dataset\nfrom semcplogic.cpmodel import TableResultInterpreter\nfrom semcplogic.cpcompiler import CPCompiler, Prob... | python | chosen |
[
{
"from": "human",
"value": "Add simple script for creating Okada deformations\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\nimport numpy\nimport matplotlib.pyplot as plt\n\nimport clawpack.geoclaw.okada2 as okada\nimport clawpack.geoclaw.topo as topo\nimport clawpack.g... | python | chosen |
[
{
"from": "human",
"value": "Create new test module to convert the first test\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_generate_files\n-------------------\n\nTest formerly known from a unittest residing in test_generate.py named\nTestGenerat... | python | chosen |
[
{
"from": "human",
"value": "Add tool for pulling data from PostgreSQL to Abba\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n'''\nA CLI tool for formulating an Abba url using data from PostgreSQL\n'''\n\nfrom __future__ import print_function\n\nimport argparse\nimport psycopg2\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add script to watch a metric for unexpectedly high or low values\n"
},
{
"from": "gpt",
"value": "import requests, datetime\n\n#todo: argparse\nacceptable = [7.5, 8.5] #good data interval\ninterval = 15 #minutes of samples to check (0.33 samples per minute)\nthreshol... | python | chosen |
[
{
"from": "human",
"value": "Add simple model_row template filter\n"
},
{
"from": "gpt",
"value": "from django import template\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\n\n\nregister = template.Library()\n\n\n@register.filter\ndef model_row(instance, fields):\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test for validating numpy compatibility choices\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\nfrom dynd import nd, ndt\n\nclass TestNumpyCompat(unittest.TestCase):\n \"\"\"\n Tests to validate interface intended to provide compatibility wi... | python | chosen |
[
{
"from": "human",
"value": "Add script to ensure virtual webcam is running.\n\nThis script will check that a webcam is running and start it if it's\nnot currently running.\nIt's tailored to the way our buildbots are currently configured.\n\nTEST=local execution on Windows, Mac and Linux.\nBUG=none\nR=phogl... | python | chosen |
[
{
"from": "human",
"value": "Add tests for init command\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom sentry.testutils import CliTestCase\nfrom sentry.runner.commands.init import init\n\n\nclass InitTest(CliTestCase):\n d... | python | chosen |
[
{
"from": "human",
"value": "Add web scrapping example to boilerpipe lib\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\n\nfrom boilerpipe.extract import Extractor\nfrom bs4 import BeautifulSoup\nfrom urllib2 import urlopen\n\nURL='http://sportv.globo.com/site/eventos/mundial-de-motove... | python | chosen |
[
{
"from": "human",
"value": "Add the missing app_traffic migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2016-10-15 15:24\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migrati... | python | chosen |
[
{
"from": "human",
"value": "Load items into the database\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport csv\n\nimport get_db_connection\n\n\ndef main():\n with open('items.csv', 'r', newline='') as csv_file:\n csv_reader = csv.DictReader(csv_file)\n with get_db_connect... | python | chosen |
[
{
"from": "human",
"value": "Add pickle migration script for .txt to .p\n"
},
{
"from": "gpt",
"value": "import os\n\n# Pickle files should be .p file extensions, not .txt. Add a migration script.\ndef rename_pickles():\n pickles = ['falsePositives.txt', 'whitelistedUsers.txt', 'blacklistedU... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for KoomBook SERVIR\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"KoomBook conf\"\"\"\n\nfrom .base import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\n# SECURITY WARNING: don't run with debug turned on in pr... | python | chosen |
[
{
"from": "human",
"value": "Test openCV image open end convert RGB -> HSV\n"
},
{
"from": "gpt",
"value": "import cv2\n\npath_dataset = \"h:/_diplomaData/LISA Traffic Sign Dataset/signDatabasePublicFramesOnly/\"\npath_file = path_dataset + \"vid6/frameAnnotations-MVI_0071.MOV_annotations/pedest... | python | chosen |
[
{
"from": "human",
"value": "Add a python example showing how to get at request data\n"
},
{
"from": "gpt",
"value": "from flask import request\n\ndef main():\n msg = \"%s %s:\\n---HEADERS---\\n%s\\n--BODY--\\n%s\\n-----\\n\" % (request.method, request.path, request.headers, request.get_data(... | python | chosen |
[
{
"from": "human",
"value": "Add first howto code snippet\n"
},
{
"from": "gpt",
"value": "# Title: Convert a date string column to a UNIX timestamp\nimport graphlab as gl\nfrom datetime import datetime\n# Requires you to 'pip install python-dateutil==1.5'\nfrom dateutil import parser\n\ndef str... | python | chosen |
[
{
"from": "human",
"value": "Add migration to correct q5 responses for registrations and drafts using Prereg Challenge schema.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSmall migration - Prereg challenge schema q5 mult choice responses have extra trailing space. This gets confusing when\nuser tr... | python | chosen |
[
{
"from": "system",
"value": "Fix the `User` not being loaded client side."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport logging\n\nfrom django.contrib.auth import get_user_model\n\nfrom tastypie.resources import ModelResource\nfrom tastypie import fields\n\nfrom ..base.api ... | python | chosen |
[
{
"from": "human",
"value": "Manage and generate a C list of plurals\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport json\nimport os.path\n\ndef main(argv):\n list = []\n if os.path.isfile(\"easy-plural-list.json\"):\n f = open(\"easy-plural-list.json\",\"r\",e... | python | chosen |
[
{
"from": "human",
"value": "Add simple unit tests for max, min and mean pooling\n"
},
{
"from": "gpt",
"value": "import pytest\nimport numpy\nfrom numpy.testing import assert_allclose\n\nfrom ...neural._classes.model import Model\nfrom ...neural.vecs2vec import MeanPooling, MaxPooling\nfrom ...... | python | chosen |
[
{
"from": "human",
"value": "Add migration to remove old rule models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2018-09-11 15:24\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\nfrom django.db import migrations\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Test case added for replacing BOM\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See license.txt\n\n\nfrom __future__ import unicode_literals\nimport unittest\nimport fr... | python | chosen |
[
{
"from": "human",
"value": "Add migration for freesound examples\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-06-21 13:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.core.exceptions import ObjectDoes... | python | chosen |
[
{
"from": "human",
"value": "Add translation merging python script"
},
{
"from": "gpt",
"value": "import sys\n\nimport yaml\n\n\ndef main(base_file, new_file, overwrite_language):\n old = yaml.load(file(base_file).read())\n new = yaml.load(file(new_file).read())\n\n assert len(overwrite... | python | chosen |
[
{
"from": "human",
"value": "Add script for a square"
},
{
"from": "gpt",
"value": "# Step 1: Make all the \"turtle\" commands available to us.\nimport turtle\n\n# Step 2: create a new turtle, we'll call him simon\nsimon = turtle.Turtle()\n\n# Lets draw a square!\nfor loop in range(4):\n simo... | python | chosen |
[
{
"from": "human",
"value": "Add util script for removal of flowpaths"
},
{
"from": "gpt",
"value": "\"\"\"Utility script to delete a flowpath from the database and on-disk\"\"\"\n\nimport psycopg2\nimport sys\nimport os\n\ndef do_delete(huc12, fpath, scenario):\n \"\"\"Delete a flowpath from... | python | chosen |
[
{
"from": "human",
"value": "CREATE module to parse gcode\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=UTF-8\n\"\"\"Module containing Gcode parsing functions\"\"\"\n\n__author__ = \"Dylan Armitage\"\n__email__ = \"d.armitage89@gmail.com\"\n\n\n####---- Imports ----####\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for reformatting accession id\n"
},
{
"from": "gpt",
"value": "import dendrogenous as dg\nimport dendrogenous.utils\n\nfrom Bio import SeqRecord\nfrom Bio.Seq import Seq\nfrom Bio.SeqRecord import SeqRecord\nfrom Bio.Alphabet import IUPAC\n\nfrom dendr... | python | chosen |
[
{
"from": "human",
"value": "Introduce a variable logging hook which will log the values of all variables during training via a session run hook.\n\nPiperOrigin-RevId: 276103839\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n# Copyright 2019 The Tensor2Robot Authors.\n#\n# Licensed under the ... | python | chosen |
[
{
"from": "human",
"value": "Add dummy canbus-battery service for testing.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom dbus.mainloop.glib import DBusGMainLoop\nimport gobject\nimport argparse\nimport logging\nimport sys\nimport os\n\n# our own packages\nsys.path.insert(1, os.p... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for new _validate_error() function\n"
},
{
"from": "gpt",
"value": "\"\"\"Unit tests for ckanserviceprovider/db.py.\"\"\"\nimport nose.tools\n\nimport ckanserviceprovider.db as db\n\n\ndef test_validate_error_with_none():\n \"\"\"_validate_error() s... | python | chosen |
[
{
"from": "human",
"value": "Add Citi Bike Station Data\n\npython file\n"
},
{
"from": "gpt",
"value": "\n#Get Citibike station location data\n\n#url format: https://feeds.citibikenyc.com/stations/stations.json\n\n\nimport json\nimport urllib\nimport codecs\nimport pandas as pd\nimport numpy as... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.