conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add module for Source Engine game logic entities\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nHelper classes for creating maps in any Source Engine game.\n\n\"\"\"\n\nfrom vmf.vmf import Entity\nfrom vmf.types import Origin\n\nclass LogicAuto(Entity):\n\n \"\"\"Sets... | python | chosen |
[
{
"from": "human",
"value": "Add remove vlan compliance test\n"
},
{
"from": "gpt",
"value": "# Copyright 2019 Internap.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the Lic... | python | chosen |
[
{
"from": "human",
"value": "Add utility function for get latest Build\n\n"
},
{
"from": "gpt",
"value": "from typing import Optional\n\nfrom manager.models import Package, Build\n\n\ndef get_latest_build(package: Package) -> Optional[Build]:\n try:\n return Build.objects.filter(packag... | python | chosen |
[
{
"from": "human",
"value": "Create a placeholder for pyauto test scripts.\n\nIncluding a hello world script.\n\nReview URL: http://codereview.chromium.org/668004\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@40579 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",
"value": "#... | python | chosen |
[
{
"from": "human",
"value": "Load the source from a highlighted URL into a new window"
},
{
"from": "gpt",
"value": "import sublime\nimport sublime_plugin\nimport urllib\n\nclass GetWebpageSourceCommand(sublime_plugin.TextCommand):\n def run(self, edit):\n url = self.view.substr(self.view.se... | python | chosen |
[
{
"from": "human",
"value": "Add basic WinEvent object tests.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015, The MITRE Corporation. All rights reserved.\n# See LICENSE.txt for complete terms.\n\nimport unittest\n\nfrom cybox.objects.win_event_object import WinEvent\nfrom cybox.test.objec... | python | chosen |
[
{
"from": "human",
"value": "Work towards integration NDTable <-> Minivect\n"
},
{
"from": "gpt",
"value": "import sys\nimport time\n\nimport numpy as np\n\nfrom minivect import miniast\nfrom minivect import specializers\nfrom minivect import minitypes\nfrom minivect.ctypes_conversion import get... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the `dirty_unzip` rule\n"
},
{
"from": "gpt",
"value": "import os\nimport pytest\nimport zipfile\nfrom thefuck.rules.dirty_unzip import match, get_new_command, side_effect\nfrom tests.utils import Command\n\n\n@pytest.fixture\ndef zip_error(tmpdir):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add an helper class to write pexpect-based test cases\nOver time, we should improve this class and port all pexpect based testing over to using this\n\n\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@227875 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "g... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 167. Two Sum II - Input array is sorted\n\n167. Two Sum II - Input array is sorted: https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def twoSum(self, numbers, target):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add in first py.test tests.\n\nSigned-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@gmail.com>\n"
},
{
"from": "gpt",
"value": "import pytest\nimport subprocess\nimport os\nimport sys\n\nprefix = '.'\nfor i in range(0,3):\n if os.path.exists(o... | python | chosen |
[
{
"from": "human",
"value": "Add test for zoom backend\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom .oauth import OAuth2Test\n\n\nclass ZoomOAuth2Test(OAuth2Test):\n backend_path = 'social_core.backends.zoom.ZoomOAuth2'\n user_data_url = 'https://api.zoom.us/v2/users/me'\n expec... | python | chosen |
[
{
"from": "human",
"value": "Copy of main.py from fergal, reworked\n"
},
{
"from": "gpt",
"value": "\n\"\"\"\nThis is a template top level script.\n\nPlease don't edit this file. Instead, copy it to\nyouname_main.py, then run and edit that file.\n\n\"\"\"\n\nimport dave.pipeline.pipeline as dpp\... | python | chosen |
[
{
"from": "human",
"value": "Test suite for Wikipedia triggers\n\n* This marks the start of the test cases for\n Wikipedia IFTTT triggers.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n Wikipedia channel for IFTTT\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Copyright 2015 Ori Livne... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract useful lsf job information\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nfrom subprocess import Popen, PIPE\n\n# --------------------------------------------------------------------------------------------------\n\ndef get_job_run_time... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for the model of CoC record\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.0.2 on 2020-02-23 11:12\n\nfrom django.conf import settings\nimport django.core.validators\nfrom django.db import migrations, models\nimport django.db.models.delet... | python | chosen |
[
{
"from": "human",
"value": "Add pretend ram module to try out the progress bar\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import division\nimport random\n\n\nclass Py3status:\n \"\"\"\n \"\"\"\n format = \"{bar}\"\n thresholds = [(0, \"good\"), (40, ... | python | chosen |
[
{
"from": "human",
"value": "Add some basic tests for flow_exports\n"
},
{
"from": "gpt",
"value": "import netlib.tutils\nfrom libmproxy import flow_export\nfrom . import tutils\n\nreq_get = netlib.tutils.treq(\n method='GET',\n headers=None,\n content=None,\n)\n\nreq_post = netlib.tuti... | python | chosen |
[
{
"from": "human",
"value": "Add a fabric file to test the generated output\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*\n\n\"\"\"\nSimple fabric file to test oinspect output\n\"\"\"\n\nfrom __future__ import print_function\n\nimport webbrowser\n\nimport oinspect.sphinxify as oi\n\nde... | python | chosen |
[
{
"from": "human",
"value": "Add tests for task types for shot route\n"
},
{
"from": "gpt",
"value": "from test.base import ApiDBTestCase\n\n\nclass ShotTaskTypesTestCase(ApiDBTestCase):\n\n def setUp(self):\n super(ShotTaskTypesTestCase, self).setUp()\n self.generate_fixture_pr... | python | chosen |
[
{
"from": "human",
"value": "Migrate in domain model changes "
},
{
"from": "gpt",
"value": "from sqlalchemy import *\nfrom migrate import *\n\nmeta = MetaData()\n\ndef upgrade(migrate_engine):\n meta.bind = migrate_engine\n dataset = Table('dataset', meta, autoload=True)\n\n serp_title... | python | chosen |
[
{
"from": "human",
"value": "Add day 5 part 1.\n"
},
{
"from": "gpt",
"value": "\"\"\"Module to find the passowrd on a bunny door.\"\"\"\n\n\nimport hashlib\n\n\ndef main():\n \"\"\"Run the main function.\"\"\"\n id = 'cxdnnyjw'\n password = []\n begin = '00000'\n index = 0\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for deepcopy\n"
},
{
"from": "gpt",
"value": "from tests.models import (\n Cat,\n Location,\n)\nimport copy\n\nfrom rest_framework.test import APITestCase\n\n\nclass DeepcopyTestCase(APITestCase):\n def test_cat(self):\n home = Locatio... | python | chosen |
[
{
"from": "human",
"value": "Add test file for update.py\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport logging\n\nbasedir = os.path.realpath('..')\nif basedir not in sys.path:\n sys.path.append(basedir)\n\nimport update as up... | python | chosen |
[
{
"from": "human",
"value": "Add performance test for epsilon convolution\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n'''\nConvolution\n'''\n\nfrom __future__ import print_function\n\nimport numpy as np\nimport cProfile\nimport random\nimport matplotlib.pyplot as plt\n\ndef eps(s, t_m... | python | chosen |
[
{
"from": "human",
"value": "Add management command to import geolocation data\n"
},
{
"from": "gpt",
"value": "# Copyright 2017 Raphaël Hertzog\n#\n# This file is subject to the license terms in the LICENSE file found in\n# the top-level directory of this distribution.\n\nimport argparse\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add the static info gatherer\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\ntry:\n import configparser\nexcept ImportError:\n import ConfigParser as configparser\n\nimport json\nimport os\nimport platform\n\nimport stoneridge\n\nclass StoneRidgeInfoG... | python | chosen |
[
{
"from": "human",
"value": "Add work for Exercise 25.\n"
},
{
"from": "gpt",
"value": "def break_words(stuff):\n \"\"\"This function will brea up words for us.\"\"\"\n words = stuff.split(' ')\n return words\n\ndef sort_words(words):\n \"\"\"Sorts the words.\"\"\"\n return sorted... | python | chosen |
[
{
"from": "human",
"value": "Add management command for running the task for validating all data catalogs.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import NoArgsCommand\nfrom thezombies.tasks.main import validate_data_catalogs\n\n\nclass Command(NoArgsCommand):\n \"\"... | python | chosen |
[
{
"from": "human",
"value": "Add tests for retrieving/updating reverse fks\n"
},
{
"from": "gpt",
"value": "from copy import deepcopy\nfrom django.db import models\nfrom django.test import TestCase\nfrom rest_framework import serializers\n\n\n# ForeignKey\n\nclass ForeignKeyTarget(models.Model):... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for verbose_name alter\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('p... | python | chosen |
[
{
"from": "human",
"value": "Add original script version, still not fit for general use\n"
},
{
"from": "gpt",
"value": "from bs4 import BeautifulSoup\nimport urllib.request\nimport MySQLdb\n\ndb = MySQLdb.connect(user=\"\", passwd=\"\", db=\"\")\nc = db.cursor()\nc.execute(\"SELECT id, name FRO... | python | chosen |
[
{
"from": "human",
"value": "Put the contents of a pyui file onto the clipboard\n\nFor pasting up to GitHub, etc."
},
{
"from": "gpt",
"value": "import clipboard\nfilename = 'put_your_filename_here.pyui' # edit this line before running\nwith open(filename) as in_file:\n clipboard.set(in_file... | python | chosen |
[
{
"from": "human",
"value": "Add utilities to convert from python2 to python3.\n\nThis commit only has one utility that allows to convert sorted()\nfunction with custom elements comparison from parameter cmp (python2)\nto parameter key (python3).\n"
},
{
"from": "gpt",
"value": "def cmp_to_key(m... | python | chosen |
[
{
"from": "human",
"value": "Add script to try and push stripe payment of unpaid invoices\n"
},
{
"from": "gpt",
"value": "from django.core.management import BaseCommand\nfrom spiff.payment.models import Invoice\nimport stripe\n\nclass Command(BaseCommand):\n help = 'Attempts to process an invo... | python | chosen |
[
{
"from": "system",
"value": "Use specific notifications when possible.\n"
},
{
"from": "human",
"value": "from defcon import Glyph, Image, registerRepresentationFactory\nfrom defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory\nfrom defconAppKit.representationFac... | python | chosen |
[
{
"from": "human",
"value": "Add script to update images in the js code\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport urllib\n\ndef img2base64(img):\n return open(img, \"rb\").read().encode(\"base64\").replace('\\n', '')\n\ndisabled_base64 = img2base64(\"assets/no-js.png\")... | python | chosen |
[
{
"from": "human",
"value": "Add file for nontermianl adding when grammar is create\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\"\"\"\n\nfrom unittest import TestCase, main\nfrom grammpy i... | python | chosen |
[
{
"from": "human",
"value": "Add files for rule's invalid syntax validation\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\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Ru... | python | chosen |
[
{
"from": "human",
"value": "Add helper script for getting plaso timeline in to timesketch\n"
},
{
"from": "gpt",
"value": "# Copyright 2014 Google Inc. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance ... | python | chosen |
[
{
"from": "human",
"value": "Add super-simple deduplication filter that uses a dictionary\n"
},
{
"from": "gpt",
"value": "# Pull URL\n# Strip query string\n# Query exists\n# IFN save to sqlite\n# IFN push to queue\n# IFY do nothing\n\nseen = {}\n\nif __name__ == '__main__':\n from helpers im... | python | chosen |
[
{
"from": "human",
"value": "Add Pandoc filter to convert SVG illustrations to PDF\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nPandoc filter to convert svg files to pdf as suggested at:\nhttps://github.com/jgm/pandoc/issues/265#issuecomment-27317316\n\"\"\"\n\n__author__ = \"... | python | chosen |
[
{
"from": "human",
"value": "Add a multiprocessor for particle learning.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a c... | python | chosen |
[
{
"from": "human",
"value": "Add beginnings of a Python driver. Currently just prints out input file.\n"
},
{
"from": "gpt",
"value": "import ctypes\nimport sys\n\ndef parse_warc(filename):\n pass\n\ndef parse_file(filename):\n with open(filename) as infile:\n text = infile.read()\n pri... | python | chosen |
[
{
"from": "human",
"value": "Split images into bf and bc bears. Defaults to images.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python3\n\nimport sys\nimport argparse\nimport xml_utils as u\nimport datetime\nfrom argparse import RawTextHelpFormatter\nfrom collections import defaultdict\n\n##--... | python | chosen |
[
{
"from": "human",
"value": "Add a management command that imports bug data from YAML files\n"
},
{
"from": "gpt",
"value": "# This file is part of OpenHatch.\n# Copyright (C) 2012 OpenHatch, Inc.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of... | python | chosen |
[
{
"from": "human",
"value": "Add a script that uses the JSON metadata to create ordered symlinks.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Copyright (C) 2013 Tobias Gruetzmacher\n\"\"\"\nThis script takes the JSON file created by 'dosage -o json' and uses the\nmetadata to build ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new Levenshtein alignment\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom .._align import align\n\n\n@pytest.mark.parametrize('string1,string2,cost', [\n (b'hello', b'hell', 1),\n (b'rat', b'cat', 1),\n (b'rat', b'rat', 0),\n (b'rat', b... | python | chosen |
[
{
"from": "human",
"value": "Add a little to models\n\nAdd a little to models\n(Should I upload migrations?)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2016-01-06 15:07\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, model... | python | chosen |
[
{
"from": "human",
"value": "Add organisation values for the Enterprise Europe Network.\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0101_een_logo\nRevises: 0100_notification_created_by\nCreate Date: 2017-06-26 11:43:30.374723\n\n\"\"\"\n\nfrom alembic import op\n\nrevisi... | python | chosen |
[
{
"from": "human",
"value": "Add date updated to Owner\n"
},
{
"from": "gpt",
"value": "\"\"\"Added date updated to Owner\n\nRevision ID: 20087beff9ea\nRevises: 2dc72d16c188\nCreate Date: 2014-03-09 01:43:00.648013\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '20087beff9ea'\... | python | chosen |
[
{
"from": "human",
"value": "Add imgadm beacons for SmartOS\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nBeacon that fires events on image import/delete.\n\n.. code-block:: yaml\n\n ## minimal\n # - check for new images every 1 second (salt default)\n # - does not send... | python | chosen |
[
{
"from": "human",
"value": "Create helper script providing multiprocessing support.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport argparse\nimport subprocess as sub\n\n\n### Parse command line arguments\nparser = argparse.ArgumentParser(description=\"M/M/1 ... | python | chosen |
[
{
"from": "human",
"value": "Add migration that had conflict from merge with master\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.18 on 2019-01-09 19:35\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migratio... | python | chosen |
[
{
"from": "human",
"value": "Use indexed text with sqlite\n"
},
{
"from": "gpt",
"value": "import csv\nimport sqlite3\n\nconn = sqlite3.connect('processed-lines.db')\nc = conn.cursor()\n# c.execute('CREATE TABLE processed (cadastral_designation text, bag_pand_id text, match_type text, parcel_uri... | python | chosen |
[
{
"from": "human",
"value": "Add a missing migration for Course.solution_visibility description\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n depende... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add some tests for polynomial printing.\n"
},
{
"from": "gpt",
"value": "import numpy.polynomial as poly\nfrom numpy.testing import TestCase, run_module_suite, assert_\n\nclass test_str(TestCase):\n def test_polynomial_str(self):\n res = str(poly.Polyn... | python | chosen |
[
{
"from": "human",
"value": "Create script to pad and trim fastq reads to one length\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n__author__= 'Allison MacLeay'\n\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add script to download data from MDCS\n"
},
{
"from": "gpt",
"value": "\"\"\"Fetch images from MDCS.\n\"\"\"\n\nimport json\nimport requests\nimport xmltodict\n\n\ndef download_mdcs_data():\n user = \"dwheeler\"\n password = \"12345\"\n mdcs_url = \"http://1... | python | chosen |
[
{
"from": "human",
"value": "Add tests for getting all toilets\n"
},
{
"from": "gpt",
"value": "import json\nimport requests\nfrom requests_testadapter import TestAdapter\nimport unittest\n\nimport migrate_toilet_codes\n\n\nclass TestCreateSession(unittest.TestCase):\n def test_create_session... | python | chosen |
[
{
"from": "human",
"value": "Introduce a live camera viewer with Qt.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*- \n\n\n#\n# Qt interface to display AVT cameras\n#\n\n\n#\n# External dependencies\n#\nfrom PyQt4 import QtGui, QtCore\n\n\n#\n# Window to display a... | python | chosen |
[
{
"from": "human",
"value": "Create templatetag for put a settings var into context\n"
},
{
"from": "gpt",
"value": "from django import template\nfrom django.conf import settings\n\nregister = template.Library()\n\n\n@register.assignment_tag()\ndef setting(var_name):\n \"\"\"\n Get a v... | python | chosen |
[
{
"from": "human",
"value": "Add migration for datetime change.\n\nThis should have been done when we changed this in the model, but it\nwasn't.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.d... | python | chosen |
[
{
"from": "human",
"value": "Add client sample for test\n- Connect to server\n- Receive data from server\n- Strip the data and print\n"
},
{
"from": "gpt",
"value": "from socket import *\n\nhost = '127.0.0.1'\nport = 1234\nbufsize = 1024\naddr = (host, port)\n\nclient = socket(AF_INET, SOCK_STRE... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for _validate_key_file_permissions in ec2 module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Import Python libs\nfrom __future__ import absolute_import\nimport os\nimport tempfile\n\n# Import Salt Libs\nfrom salt.cloud.clouds import ec... | python | chosen |
[
{
"from": "human",
"value": "Add usb bridge test(CDC & HID)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\n\n# This script aim to make a loopback test on cdc or hid.\n# The statics is used for comparison, it is not accurate.\n\nfrom serial import Serial\nfrom optparse import OptionPa... | python | chosen |
[
{
"from": "human",
"value": "Add a first small file watcher that counts words\n\n- Requires installing python watchdog framework\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport time\nimport logging\nfrom watchdog.observers import Observer\nfrom watchdog.events import FileSystemEve... | python | chosen |
[
{
"from": "human",
"value": "Add New Test Which Monitors Output\n\nThis test monitors STDERR to detect progress of the progressbar\n"
},
{
"from": "gpt",
"value": "pytest_plugins = \"pytester\"\n\n\ndef test_simple_example(testdir):\n \"\"\" Run the simple example code in a python subprocess ... | python | chosen |
[
{
"from": "human",
"value": "Add a thread helper module\n"
},
{
"from": "gpt",
"value": "from threading import Thread, Lock\n\nlist_lock = Lock()\n\ndef run_in_thread(app):\n def wrapper(fn):\n def run(*args, **kwargs):\n app.logger.info('Starting thread: {}'.format(fn.__name__))\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a simple markov chain to compare output with RNN\n"
},
{
"from": "gpt",
"value": "# Simple Markov chain model for character-based text generation.\n#\n# Only tested with Python 3.6+\n#\n# Eli Bendersky (http://eli.thegreenplace.net)\n# This code is in the public ... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for index route\n\nCurrently the index route gloms every other route.\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nclass TestIndex(TestCase):\n \"\"\"Verify the index page is served properly\"\"\"\n\n def test_root(self)... | python | chosen |
[
{
"from": "human",
"value": "Add first-party JavaScript build rule library\n"
},
{
"from": "gpt",
"value": "\"\"\"Helpers for writing rules for first-party JavaScript packages.\"\"\"\n\n__all__ = [\n 'define_package',\n 'find_package',\n]\n\nimport dataclasses\nimport logging\n\nimport for... | python | chosen |
[
{
"from": "human",
"value": "Add migration to delete existing cache values"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-09-08 10:23\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom corehq.blobs import get_blob_db... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for the Document class\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom clippings.parser import Document\n\n\nclass DocumentTest(unittest.TestCase):\n\n def test_create_document(self):\n title = 'Haunted'\n authors = ['Chuck Pa... | python | chosen |
[
{
"from": "human",
"value": "Add basic unit test about /variables endpoint\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\nimport json\n\nfrom nose.tools import assert_equal, assert_greater, assert_in, assert_is_instance\nfrom webob import Request\n\nfrom . import common\n\n\ndef s... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for 500 error with slow responses\n\nwhen using redis as the rate limit storage and the response\nis slower than the rate limit window, 500 errors occur as the\nkey is not available post request for constructing the rate limit\nheaders.\n"
},
{
"from": "gp... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for new service util\n"
},
{
"from": "gpt",
"value": "# Import Python Libs\nimport os\n\n# Import Salt Libs\nimport salt.utils.platform\n\n# Import Salt Testing Libs\nfrom tests.support.mock import patch, MagicMock\nfrom tests.support.unit import TestC... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for Emmaus Ideasbox in France\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Ideaxbox for Emmaus, France\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_NAME = u\"Emmaus\"\nIDEASCU... | python | chosen |
[
{
"from": "human",
"value": "Add script for creating numeric passwordlists using permutation & combination.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport itertools\nimport sys\n\n\ndef combination(elements,items):\n for combination in itertools.product(xrange(elements), repeat=... | python | chosen |
[
{
"from": "human",
"value": "Add a very simple performance testing tool."
},
{
"from": "gpt",
"value": "\"\"\"\nSimple peformance tests.\n\"\"\"\n\nimport sys\nimport time\n\nimport couchdb\n\n\ndef main():\n\n print 'sys.version : %r' % (sys.version,)\n print 'sys.platform : %r' % (sys.pl... | python | chosen |
[
{
"from": "human",
"value": "Add class balance checking code\n"
},
{
"from": "gpt",
"value": "# Lint as: python3\n\"\"\"This script checks the balance of classes in the FDC dataset.\n\nClasses are split based on LOW_CALORIE_THRESHOLD and\nHIGH_CALORIE_THRESHOLD in the amaranth module.\n\"\"\"\n\... | python | chosen |
[
{
"from": "human",
"value": "Test if C changes with more examples. "
},
{
"from": "gpt",
"value": "\"\"\"\nObserve if C varies when we use more examples \n\"\"\"\nimport logging \nimport numpy \nimport sys \nimport multiprocessing \nfrom apgl.util.PathDefaults import PathDefaults \nfrom apgl.pre... | python | chosen |
[
{
"from": "human",
"value": "Add VSYNC GPIO output example.\n"
},
{
"from": "gpt",
"value": "# VSYNC GPIO output example.\n#\n# This example shows how to toggle the IR LED pin on VSYNC interrupt.\n\nimport sensor, image, time\nfrom pyb import Pin\n\nsensor.reset() # Reset an... | python | chosen |
[
{
"from": "human",
"value": "Add python tests for cosine squared angles\n"
},
{
"from": "gpt",
"value": "# -*- coding: iso-8859-1 -*-\n# Maintainer: joaander\n\nfrom hoomd import *\nfrom hoomd import md\ncontext.initialize()\nimport unittest\nimport os\nimport numpy\n\n# tests md.angle.cosinesq\... | python | chosen |
[
{
"from": "human",
"value": "Add scrapper of Bureau of Labor Statistis Employment status\n"
},
{
"from": "gpt",
"value": "#user/local/bin/python\n#uses python3\nimport urllib.request\nfrom bs4 import BeautifulSoup\n\nurl = \"http://www.bls.gov/cps/cpsaat01.htm\" #access the search term through w... | python | chosen |
[
{
"from": "human",
"value": "Add script to check the performance\n"
},
{
"from": "gpt",
"value": "import csv\nfrom os import listdir\nfrom pygraphc.evaluation.ExternalEvaluation import ExternalEvaluation\n\n# read result and ground truth\nresult_dir = '/home/hudan/Git/pygraphc/result/improved_ma... | python | chosen |
[
{
"from": "human",
"value": "Add solution for counting DNA nucleotides\n"
},
{
"from": "gpt",
"value": "from collections import Counter\n\nif __name__ == '__main__':\n\n with open('data/rosalind_dna.txt', mode='r') as f:\n sequence = f.read()\n\n counts = Counter(sequence)\n\n pr... | python | chosen |
[
{
"from": "human",
"value": "Add migration for `communities` app.\n\nIt was created independently of changes to `events` app; probably because of some old code changes in `communities` app.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2016-03-18 21:40\nf... | python | chosen |
[
{
"from": "human",
"value": "Add a script to graph problem reports over time by transport mode\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# A script to draw graphs showing the number of reports by transport\n# type each month. This script expects to find a file called\n# 'problems.cs... | python | chosen |
[
{
"from": "human",
"value": "Add uwsgi conf file for star and shadow\n"
},
{
"from": "gpt",
"value": "# mysite_uwsgi.ini file\n# http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html\n[uwsgi]\n\n# Django-related settings\n# the base directory (full path)\nchdir = /... | python | chosen |
[
{
"from": "human",
"value": "Add dodgy NetCDF creation example\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nfrom datacube.api.model import DatasetType, Satellite, Ls57Arg25Bands, Fc25Bands, Pq25Bands\nfrom datacube.api.query import list_tiles_as_list\nfrom datacube.api... | python | chosen |
[
{
"from": "human",
"value": "Add premise of Bench Manager\n"
},
{
"from": "gpt",
"value": "from contextlib import contextmanager\n\nfrom ktbs_bench.utils.decorators import bench as util_bench\n\n\nclass BenchManager:\n def __init__(self):\n self._contexts = []\n self._bench_func... | python | chosen |
[
{
"from": "human",
"value": "Add sdb driver for etcd\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\netcd Database Module\n\n:maintainer: SaltStack\n:maturity: New\n:depends: python-etcd\n:platform: all\n\nThis module allows access to the etcd database using an ... | python | chosen |
[
{
"from": "human",
"value": "Add test for shell command\n"
},
{
"from": "gpt",
"value": "\"\"\"\ntests.test_shell_command\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTests demo component.\n\"\"\"\nimport os\nimport tempfile\nimport unittest\n\nfrom homeassistant import core\nfrom homeassistant.components impor... | python | chosen |
[
{
"from": "human",
"value": "Test for newly refactored literal rule\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom mygrations.core.parse.rule_literal import rule_literal\n\nclass test_parse_regexp( unittest.TestCase ):\n\n def get_rule( self, name, literal ):\n\n return rule_... | python | chosen |
[
{
"from": "human",
"value": "Add NoCommandAction to only continue execution when a non-command text event is received\n"
},
{
"from": "gpt",
"value": "from bot.action.core.action import IntermediateAction\nfrom bot.action.core.command import CommandAction\n\n\nclass NoCommandAction(IntermediateA... | python | chosen |
[
{
"from": "human",
"value": "Add first example test of using h2o python API to gradle build regression suite.\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.insert(1, '../../h2o-py/src/main/py')\n\nfrom h2o import H2OConnection\nfrom h2o import H2OFrame\nfrom h2o import H2OGBM\nfrom tabul... | python | chosen |
[
{
"from": "human",
"value": "Add exercise horse racing duals\n"
},
{
"from": "gpt",
"value": "N = int(raw_input())\nlst = []\n# Read the list\nfor i in xrange(N):\n lst.append(int(raw_input()))\n\n# Sort the list, ascending order\na = sorted(lst)\n# Find the min difference\nprint min(y-x for ... | python | chosen |
[
{
"from": "human",
"value": "Test database.common for full coverage of database\n"
},
{
"from": "gpt",
"value": "import mock\nfrom linkr import db\nimport database.common\nfrom test.backend.test_case import LinkrTestCase\n\n\nclass TestCommon(LinkrTestCase):\n def test_create_tables(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add methods for loading data sets\n"
},
{
"from": "gpt",
"value": "import os\nimport numpy as np\n\nimport sgf_wrapper\n\ndef load_sgf_positions(*dataset_names):\n for dataset in dataset_names:\n dataset_dir = os.path.join(os.getcwd(), 'data', dataset)\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.