conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "test: Add coverage for revision artifacts endpoint\n" }, { "from": "gpt", "value": "from datetime import timedelta\n\nfrom zeus import factories\nfrom zeus.models import RepositoryAccess, RepositoryBackend, RepositoryProvider\nfrom zeus.utils import timezone\n\n\ndef...
python
chosen
[ { "from": "human", "value": "Add a migration for the boolean field changes\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('...
python
chosen
[ { "from": "human", "value": "Add script for uploading tree_data.\n" }, { "from": "gpt", "value": "import os, sys, subprocess, tempfile, gzip, cStringIO\nfrom boto.s3.connection import S3Connection\nfrom boto.s3.key import Key\n\nconn = S3Connection()\nbucket = conn.get_bucket(\"openinternet.widg...
python
chosen
[ { "from": "human", "value": "Add plugin to request data from JSON url endpoint\n" }, { "from": "gpt", "value": "from argparse import ArgumentParser\nfrom time import time\nfrom urllib.request import urlopen\n\nimport json\n\n\ndef parse_args():\n parser = ArgumentParser()\n parser.add_argu...
python
chosen
[ { "from": "human", "value": "Add simple REPL to test commands\n" }, { "from": "gpt", "value": "from nex.state import GlobalState\nfrom nex.reader import Reader, EndOfFile\nfrom nex.lexer import Lexer\nfrom nex.instructioner import Instructioner\nfrom nex.banisher import Banisher\nfrom nex.parsin...
python
chosen
[ { "from": "human", "value": "Add testing for Pells equation\n" }, { "from": "gpt", "value": "import pytest\n\nfrom typing import Tuple\n\nfrom .pells_equation import solve_pells_equation\nfrom ..sqrt import is_square\n\n\nPELLS_SOLUTIONS = [\n (\n 2,\n [\n 3,\n ...
python
chosen
[ { "from": "human", "value": "Add Sample Data Generating Client\n" }, { "from": "gpt", "value": "import hashlib\nimport RandomIO\n\n# config vars\naddress = \"1CutsncbjcCtZKeRfvQ7bnYFVj28zeU6fo\"\nbyte_size = 1024*1024*10\n\n\n# lib functions\ndef sha256(content):\n \"\"\"Finds the sha256 hash...
python
chosen
[ { "from": "human", "value": "Add script to list object names\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument('--year', type=int, default=2016)\n args = parser.parse_args()\n\n if arg...
python
chosen
[ { "from": "human", "value": "Add tests for web homepage\n" }, { "from": "gpt", "value": "import pytest\n\n\n@pytest.fixture\ndef test_flask_app():\n from gitbot import web_listener\n web_listener.app.config['TESTING'] = True\n return web_listener.app.test_client()\n\n\nexpected_root_htm...
python
chosen
[ { "from": "system", "value": "Add `args` and `kwargs` to cloud-tpu version of `coordination_service_type()` function\n\nPiperOrigin-RevId: 470776162\n" }, { "from": "human", "value": "# Copyright 2019 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2...
python
chosen
[ { "from": "human", "value": "Migrate wallposts to right ctype\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.17 on 2020-12-24 10:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef fix_wallpost_ctype(apps, schema_editor):...
python
chosen
[ { "from": "human", "value": "Add a script to revert the database from an earlier backup\n\nThis scripts assumes that the database dump was done with\npg_dump --clean. If it wasn't done with the --clean option\nyou would need to do:\n\n dropdb catmaid\n sudo -u postgres psql < docs/createuser.sql\n\n......
python
chosen
[ { "from": "human", "value": "Add a view mixin to pass the ``User`` instance to the view's form.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\n\nclass AuthorshipViewMixin(object):\n \"\"\"Add the request's ``User`` instanc...
python
chosen
[ { "from": "human", "value": "Implement a wrapper for the SimpleTemplateResponse and the TemplateResponse which use jinja2" }, { "from": "gpt", "value": "from coffin.template import loader\nfrom django.template import response as django_response\n\n\nclass SimpleTemplateResponse(django_response.S...
python
chosen
[ { "from": "human", "value": "Add script to populate the database periodically with geocoordinates of the International Space Station\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nimport socket\nimport logging\nimport json\nimport requests\nimport time\nimport datetime\n\nlogger = logging.g...
python
chosen
[ { "from": "human", "value": "Add SgTableFetcher - automatically infers keys/fields and values from object\n" }, { "from": "gpt", "value": "\"\"\"Fetches data from GitHub API, store and return the data in a SgTable.\"\"\"\n\nimport table\nimport inspect\n\n\nclass SgTableFetcher:\n \"\"\"Fetch...
python
chosen
[ { "from": "human", "value": "Add prototype BDE Metadata scanner in import/extract-yaml.pl\n" }, { "from": "gpt", "value": "from __future__ import print_function\nimport os\nimport sys\nimport yaml\n\n# Scan the local directory (or one provided as the first command line argument)\n# for directori...
python
chosen
[ { "from": "human", "value": "Add focus behavior example to examples.\n" }, { "from": "gpt", "value": "from kivy.app import App\nfrom kivy.uix.gridlayout import GridLayout\nfrom kivy.uix.boxlayout import BoxLayout\nfrom kivy.uix.button import Button\nfrom kivy.uix.behaviors import FocusBehavior\n...
python
chosen
[ { "from": "human", "value": "Add script to generate report on scraper tests\n" }, { "from": "gpt", "value": "import os\nimport json\n\nimport saulify.sitespec as sitespec\n\nSPEC_DIRECTORY = \"sitespecs\"\n\n\nif __name__ == \"__main__\":\n for fname in os.listdir(SPEC_DIRECTORY):\n fp...
python
chosen
[ { "from": "human", "value": "Add Chuanping Yu's solutions to Problem04" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\"This script is written by Chuanping Yu, on Jul 24, 2017,\nfor the Assignment#1 in IDEaS workshop\"\"\"\n\n#Problem 4\nS = 0\nA = 0\nB = 0\nfor a in range(100, 100...
python
chosen
[ { "from": "human", "value": "Add formatter for outputting iso8601 dates\n" }, { "from": "gpt", "value": "import logging\nimport datetime\n\nclass Iso8601Formatter(logging.Formatter):\n def formatTime(self, record, datefmt=None):\n record_time = datetime.datetime.utcfromtimestamp(record...
python
chosen
[ { "from": "human", "value": "Add the expand2 benchmark using Sage\n" }, { "from": "gpt", "value": "from timeit import default_timer as clock\nfrom sage.all import var\nvar(\"x y z w\")\ne = (x+y+z+w)**15\nf = e*(e+w)\nprint f\nt1 = clock()\ng = f.expand()\nt2 = clock()\nprint \"Total time:\", t2...
python
chosen
[ { "from": "human", "value": "Add test for unicode cache\n" }, { "from": "gpt", "value": "from __future__ import print_function, absolute_import, division\n\nimport sys\nimport os\nimport multiprocessing as mp\nimport traceback\n\nfrom numba import njit\nfrom .support import (\n TestCase,\n ...
python
chosen
[ { "from": "human", "value": "Add some tests for Brann Bronzebeard\n" }, { "from": "gpt", "value": "from utils import *\n\n\nBRANN_BRONZEBEARD = \"LOE_077\"\n\n\ndef _prepare_game():\n\tgame = prepare_game()\n\tbrann = game.player1.give(BRANN_BRONZEBEARD)\n\tbrann.play()\n\tgame.end_turn(); game....
python
chosen
[ { "from": "human", "value": "Test for spatial relations between regions.\n" }, { "from": "gpt", "value": "\n## Imports\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom pySpatialTools.Retrieve import GridSpatialDisc, CircRetriever\nfrom pySpatialTools.Spatial_Relations.region_spatial_re...
python
chosen
[ { "from": "human", "value": "Add some tests for comparison expressions: and, or, and order\nof operations.\n" }, { "from": "gpt", "value": "import pytest\n\nfrom stix2matcher.matcher import match\n\n\n_observations = [\n {\n \"type\": \"observed-data\",\n \"number_observed\": 1,...
python
chosen
[ { "from": "human", "value": "Add script to generate file index for Require.\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\n# Generates an index file used by require\n# to test if a file exists in the assets folder.\n# Usage: genRequireIndex.py <rootDirectory> <outputFile>\n# rootDi...
python
chosen
[ { "from": "human", "value": "Add Camera upload sorting script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nimport re\nfrom os import listdir, makedirs, link, walk, rename\nfrom os.path import isdir,isfile\n\n\ncam_directory = '/home/poclement/Dropbox/Camera Uploads'\nfile_list = listdir(c...
python
chosen
[ { "from": "human", "value": "Rename number module to not crash NumPy\n\nEnded up overriding a NumPy module called numbers.\n" }, { "from": "gpt", "value": "def pentagonal(n):\n \"\"\"Returns the n-th pentagonal number\"\"\"\n return n*(3*n-1)/2\n\ndef ispentagonal(P):\n \"\"\"Returns tr...
python
chosen
[ { "from": "human", "value": "Add py solution for 458. Poor Pigs\n\n458. Poor Pigs: https://leetcode.com/problems/poor-pigs/\n" }, { "from": "gpt", "value": "from itertools import count\nclass Solution(object):\n def poorPigs(self, buckets, minutesToDie, minutesToTest):\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add another, simpler, matplotlib example\n" }, { "from": "gpt", "value": "# from http://www.labri.fr/perso/nrougier/teaching/matplotlib/\n\nfrom pylab import*\n\nX = np.linspace(-np.pi, np.pi, 256,endpoint=True)\nC,S = np.cos(X), np.sin(X)\n\nplot(X,C)\nplot(X,S)\n\n...
python
chosen
[ { "from": "human", "value": "Add command to set shareable bit\n" }, { "from": "gpt", "value": "\"\"\"Set the shareable bit for a resource to True or False\n This is a workaround for the fact that published, unshareable i\n resources can't be added to collections.\n\"\"\"\n\nfrom django.core....
python
chosen
[ { "from": "human", "value": "Add basic test coverage for build_spec\n\nThis asserts the basic public surface area of the module\n\nChange-Id: I97f5f228ed55dd0d0b748a47bd88c72c55500102\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2014, John Dewey\n# ...
python
chosen
[ { "from": "human", "value": "Refactor from get-clusters.\nChanges for speed, clarity and use simplification.\n" }, { "from": "gpt", "value": "import MySQLdb as mdb\n\n\n\ninput_file = \"phylota_184_trees.tre\"\nout_dir = \"clusters/\"\ndb_host = \"localhost\"\ndb_user = \"root\"\ndb_password = \...
python
chosen
[ { "from": "human", "value": "Add tests for WinNetworkShare object.\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 mixbox.vendor.six import u\n\nfrom cybox.objects.win_network_sha...
python
chosen
[ { "from": "human", "value": "Add module where particles randomly disperse\n" }, { "from": "gpt", "value": "import math\nimport pygame\nimport random\n\n\npygame.init()\nPi = math.pi\n\n#-- SCREEN CHARACTERISTICS ------------------------->>>\nbackground_color = (255,255,255)\n(width, height) = (3...
python
chosen
[ { "from": "human", "value": "Save code for debugging transactions.\n" }, { "from": "gpt", "value": "\"\"\"\nExperimenting with Django transactions.\n\"\"\"\n\nimport random\n\n# Since this script is intended to be used from the terminal, setup the\n# environment first so that django and model im...
python
chosen
[ { "from": "human", "value": "Add simple script for running a single skill\n\nBased on the skill_developers_testrunner.py, takes the path to a skill\nas argument and runs any tests for that skill.\n" }, { "from": "gpt", "value": "# Copyright 2017 Mycroft AI Inc.\n#\n# Licensed under the Apache Li...
python
chosen
[ { "from": "human", "value": "Add the registration unit test\n" }, { "from": "gpt", "value": "from aiosip import auth\n\n\nAUTH = {\n 'auth_with_qop': 'Digest realm=\"asterisk\",'\n 'nonce=\"1535646722/5d9e709c8f2ccd74601946bfbd77b032\",'\n 'algorithm=m...
python
chosen
[ { "from": "human", "value": "Add GPU version of balance_matrix3.\n" }, { "from": "gpt", "value": "from __future__ import division\n\nimport numpy as np\n\nimport pycuda.gpuarray as gpuarray\nimport pycuda.autoinit\nimport scikits.cuda.linalg as culinalg\nculinalg.init()\n\ndef balance_matrix3_gp...
python
chosen
[ { "from": "human", "value": "Add the model for Records\n" }, { "from": "gpt", "value": "import datetime\n\nfrom pyramid.compat import (\n text_type,\n binary_type\n )\n\nfrom .meta import (\n Base,\n DBSession,\n )\n\nfrom sqlalchemy import (\n Co...
python
chosen
[ { "from": "human", "value": "Add script unit test for option\n\nresf #192\n" }, { "from": "gpt", "value": "# -*- coding: iso-8859-1 -*-\n# Maintainer: joaander\n\nfrom hoomd_script import *\nimport unittest\nimport os\n\n# unit tests for init.create_random\nclass init_create_random_tests (unitte...
python
chosen
[ { "from": "human", "value": "Create initial api doc generator\n" }, { "from": "gpt", "value": "from collections import OrderedDict\nimport hug.types\n\n\ndef generate(module, base_url=\"\"):\n documentation = OrderedDict()\n documenation['overview'] = module.__doc__\n for url, method_ha...
python
chosen
[ { "from": "human", "value": "Add a command to list participating nodes\n" }, { "from": "gpt", "value": "#\n# Copyright 2012 Cisco Systems, Inc.\n#\n# Author: Soren Hansen <sorhanse@cisco.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this ...
python
chosen
[ { "from": "human", "value": "Create throat perimeter submodule to use with extrude\n\nSigned-off-by: Tom Tranter <5f16e196b3c33003e3a85b835da4e658fd57e2ad@leeds.ac.uk>\n" }, { "from": "gpt", "value": "r\"\"\"\n===============================================================================\nSubmo...
python
chosen
[ { "from": "human", "value": "Add simple manual test for remote control\n" }, { "from": "gpt", "value": "import time\nimport msvcrt\nimport zmq\n\nfrom agent_pb2 import *\n\nzctx = zmq.Context()\nzsck_ctrl = zctx.socket(zmq.PUSH)\nzsck_status = zctx.socket(zmq.SUB)\nzsck_status.setsockopt(zmq.SUB...
python
chosen
[ { "from": "human", "value": "[math] Add fit_line_2d (private for now)\n" }, { "from": "gpt", "value": "from ._shape import DimFilter, instance, shape\nfrom ._tensors import Tensor\nfrom ._ops import mean\n\n\ndef fit_line_2d(x: Tensor, y: Tensor, point_dim: DimFilter = instance, weights: Tensor ...
python
chosen
[ { "from": "human", "value": "Add a pure Python OpenMP test to make sure everything works from pure Python mode.\n" }, { "from": "gpt", "value": "# mode: run\n# tag: openmp, pure3.6\n\nimport cython\nfrom cython.parallel import prange, parallel\n\n\ndef prange_regression(n: cython.int, data: list...
python
chosen
[ { "from": "human", "value": "Add script to run all tests\n" }, { "from": "gpt", "value": "# This script runs all of the suites from each unit test file.\n# Run this file from the parent directory with the following command:\n# python -m tests.run_all\nfrom tests import *\nimport unittest \n\n...
python
chosen
[ { "from": "human", "value": "Convert stdout redirection magic to a mixin.\n" }, { "from": "gpt", "value": "import os\n\n\nclass NullStdoutMixin(object):\n def __init__(self, *args, **kwargs):\n self._devnull = open(os.devnull, 'w')\n super(NullStdoutMixin, self).__init__(*args, ...
python
chosen
[ { "from": "human", "value": "Add test for classbased view filters\n" }, { "from": "gpt", "value": "import pytest\nfrom tests.apps.questions import models as question_models\n\nfrom adhocracy4.filters.filters import ClassBasedViewFilterSet\nfrom adhocracy4.filters.views import FilteredListView\n\...
python
chosen
[ { "from": "human", "value": "Add test for record_only mode\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Copyright 2011-2013 Colin Scott\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# Y...
python
chosen
[ { "from": "human", "value": "Define a function that print a lyrics and a function that repeat first operation 5 times.\n" }, { "from": "gpt", "value": "# Define a function that print a lyrics and a function that repeat first operation 5 times.\r\n\r\ndef print_lyrics():\r\n print \"I'm a lumb...
python
chosen
[ { "from": "human", "value": "Add basic binary card resource\n" }, { "from": "gpt", "value": "\"\"\"Module for generating Binary Cards resource.\"\"\"\n\nfrom PIL import Image\n\n\ndef resource_image(get_request, resource):\n \"\"\"Create a image for Binary Cards resource.\n\n Args:\n ...
python
chosen
[ { "from": "human", "value": "Add missed db migration for 50b7b53\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 ('people', '...
python
chosen
[ { "from": "human", "value": "Implement a strict subclass of jinja2 Environment\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom jinja2 import Environment, StrictUndefined\n\n\nclass StrictEnvironment(Environment):\n \"\"\"Jinja2 environment that raises an error when it hits a ...
python
chosen
[ { "from": "human", "value": "[scripts] Add a per-thread IPC tracing script. It currently handles scheduling / oversubscription but not DVFS\n" }, { "from": "gpt", "value": "\"\"\"\nipctrace.py\n\nWrite a trace of instantaneous IPC values for all cores.\nFirst argument is either a filename, or no...
python
chosen
[ { "from": "human", "value": "Add rudiments of an IRC library using IOStream\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf8 -*-\n\nfrom tornado import ioloop, gen, tcpclient\n\nloopinstance = ioloop.IOLoop.instance()\n\n\ndef split_irc_line(s):\n \"\"\"Breaks a mes...
python
chosen
[ { "from": "human", "value": "Add basic AMF support to skeinforge.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nimport zipfile\ntry:\n\tfrom xml.etree import cElementTree as ElementTree\nexcept:\n\tfrom xml.etree import ElementTree\n\nfrom fabmetheus_utilities.geomet...
python
chosen
[ { "from": "human", "value": "Add an example script for maxent.\n" }, { "from": "gpt", "value": "from __future__ import print_function\n\nimport dit\nimport numpy as np\n\n# The functions will import this for you...just make sure you have it.\nimport cvxopt\n\ndef print_output(d, maxent_dists):\n...
python
chosen
[ { "from": "human", "value": "Add missing migration after editing meta options\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-31 20:47\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Mi...
python
chosen
[ { "from": "human", "value": "Add py solution for 713. Subarray Product Less Than K\n\n713. Subarray Product Less Than K: https://leetcode.com/problems/subarray-product-less-than-k/\n" }, { "from": "gpt", "value": "class Solution(object):\n def numSubarrayProductLessThanK(self, nums, k):\n ...
python
chosen
[ { "from": "human", "value": "3: Add card match v3 python file\n" }, { "from": "gpt", "value": "import pyglet\n\n\ndef draw_card():\n pyglet.graphics.draw(4,\n pyglet.gl.GL_QUADS,\n ('v2i', (get_card_vertices()))\n )\n\n\n...
python
chosen
[ { "from": "human", "value": "Write function to read in vertices, edges and sides from file.\n" }, { "from": "gpt", "value": "#Create a function to get a mesh file 'f'\ndef getMesh(fname):\n\t\n\t#Open the file\n\tf = open(fname, \"r\")\n\t\n\t#Store the lines as a list\n\tf = list(f)\n\t\n\t#Str...
python
chosen
[ { "from": "human", "value": "Add tool for printing channel IDs\n" }, { "from": "gpt", "value": "from flow import Flow\n\nfrom config import BOTNAME, BOTPW, ORG_ID\n\ntry:\n flow = Flow(BOTNAME)\nexcept flow.FlowError as e:\n flow = Flow()\n flow.create_device(BOTNAME, BOTPW)\n print(...
python
chosen
[ { "from": "human", "value": "Add first tests for S09 report reading\n" }, { "from": "gpt", "value": "from expects import expect, equal\nfrom primestg.report import Report\nfrom ast import literal_eval\n\nwith description('Report S09 example'):\n with before.all:\n\n self.data_filename_...
python
chosen
[ { "from": "human", "value": "Initialize USGSResource object model to be similar to cuahsi\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import (absolute_import,\n division,\n print_function,\n unicod...
python
chosen
[ { "from": "human", "value": "Add wrapper for fudge to allow mock checks\n\nAdd wrapper to add mock checks on fudge, to prevent\nthe mock from getting out of sync with the real object.\n" }, { "from": "gpt", "value": "import fudge\nimport inspect\n\n\nclass MethodNotAvailableInMockedObjectExcepti...
python
chosen
[ { "from": "human", "value": "Add code for fetching bot id\n\n Python code for getting the id of your Slack bot" }, { "from": "gpt", "value": "import os\nfrom slackclient import SlackClient\n\n\"\"\"\nReturns the id of the movie slackbot\n\n\"\"\"\n\n\nSLACK_BOT_TOKEN = os.environ.get('SLACK_BOT_...
python
chosen
[ { "from": "human", "value": "Add script to rename files in a directory.\n" }, { "from": "gpt", "value": "import os\nimport string\n\ndef list_files(path):\n # returns a list of names (with extension, without full path) of all files \n # in folder path\n files = []\n for name in os.li...
python
chosen
[ { "from": "human", "value": "Add script to compose roles\n" }, { "from": "gpt", "value": "import glob\nimport os\nimport shutil\nimport subprocess\n\nimport yaml\n\n\ndef create_role(role):\n ret = subprocess.check_output(\n 'ansible-galaxy init {}'.format(role).split())\n if not re...
python
chosen
[ { "from": "human", "value": "Add separate script to run checks from jenkins\n" }, { "from": "gpt", "value": "import os\nfrom pre_push import run_checks\n\nfilepath = os.path.dirname(os.path.abspath(__file__))\nproject_root = os.path.join(filepath, \"..\")\n\nif __name__ == \"__main__\":\n run...
python
chosen
[ { "from": "human", "value": "Add s3 uploader class from awsSample repository.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport botocore\nimport boto3\nfrom datetime import datetime\n\n\nclass s3Uploader():\n \n def __init__(self, bucketName, objectName, filePath):\n ...
python
chosen
[ { "from": "human", "value": "Add unit test for chunk_metadata\n" }, { "from": "gpt", "value": "import time\n\nfrom mock import mock_open, patch\n\nfrom publish2cloud import chunk_metadata\n\n\ndef test_chunk_metadata():\n \"\"\"Test getting metadata from the chunk header of a list file.\"\"\"...
python
chosen
[ { "from": "human", "value": "Add a test for getting the homepage\n" }, { "from": "gpt", "value": "from .conftest import load\n\n\nclass TestStatic:\n\n def test_get_index(self, client):\n response = client.get(\"/\")\n assert response.status_code == 200\n assert 'href=\"/...
python
chosen
[ { "from": "human", "value": "test: Add basic integration tests using vimrunner\n" }, { "from": "gpt", "value": "import os\nimport tempfile\nimport vimrunner\n\nfrom tasklib.task import TaskWarrior, Task\n\nserver = vimrunner.Server()\n\nclass TestIntegration(object):\n\n def add_plugin(self, ...
python
chosen
[ { "from": "human", "value": "Add separate test file for javascript\n" }, { "from": "gpt", "value": "import glob\nimport json\nimport os\n\nimport pytest\n\nfrom helpers import solutions_dir\n\n\n# NOTE: If we make solution_files a fixture instead of a normal attr/function,\n# then we can't use i...
python
chosen
[ { "from": "human", "value": "Add script using new library that can list chapters and titles of a series.\n" }, { "from": "gpt", "value": "import argparse\nimport itertools\n\nfrom redux.helper.util import Util\nfrom redux.site.mangafox import MangaFox\nfrom redux.site.mangahere import MangaHere\...
python
chosen
[ { "from": "human", "value": "Add in camera widget, not complete yet\n" }, { "from": "gpt", "value": "\r\nimport cv_widget\r\n\r\nclass CameraWidget(cv_widget.CvWidget):\r\n \r\n def __init__(self, fixed_size):\r\n cv_widget.CvWidget.__init__(self, fixed_size)\r\n \r\n def set_...
python
chosen
[ { "from": "human", "value": "Add utility to create test tree\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nA utility to create a Girder hierarchy from metadata.json.\n\nUseful in testing the monkeybrains plugin to set up a hierarchy,\nthen set_metadata.py can be run to add the ...
python
chosen
[ { "from": "human", "value": "Tools: Add rtorrent plaintext doc generator.\n" }, { "from": "gpt", "value": "import sys\nsys.path.insert(0, '..')\n\nimport model.rtorrent as rtorrent\nimport model.torrent as torrent\nimport model.peer as peer\n\n\nfor d in (rtorrent, torrent, peer):\n for x, y ...
python
chosen
[ { "from": "human", "value": "Add file for test if is grammar generating\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-transforms\n\n\"\"\"\n\nfrom unittest import TestCase, main\nfrom grammpy im...
python
chosen
[ { "from": "human", "value": "Make the parser an installable Python package\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nfrom distutils.core import setup\n\nsetup(\n name='regulations-parser',\n url='https://github.com/cfpb/regulations-parser...
python
chosen
[ { "from": "human", "value": "Add default menu that can be enabled in Maya to launch exporter.\n" }, { "from": "gpt", "value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nimport maya.utils as utils\nimport pymel.core\n\n\ndef setup...
python
chosen
[ { "from": "human", "value": "Add numpy implementation of simple 2d conv, with TF verification\n" }, { "from": "gpt", "value": "from __future__ import print_function\nimport numpy as np\n\n# Tensorflow is used to verify the results of numpy computations - you can\n# remove its usage if you don't ...
python
chosen
[ { "from": "human", "value": "Python3: Read a YAML file or stream safely\n" }, { "from": "gpt", "value": "\"\"\"\n Read a YAML file or stream safely.\n\"\"\"\n\nfrom pathlib import Path\n\ndef read_yaml_safely(filelike):\n \"\"\" Read a YAML file or stream with no RCE backdoors open (using ...
python
chosen
[ { "from": "human", "value": "Test case for incorrect rendering of bullet noticed in a wydget test case.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''Test that font.Text horizontal alignment works.\n\nThree labels will be rendered aligned left, center and right.\n'''\n\n__docforma...
python
chosen
[ { "from": "human", "value": "Move prime views method in\n" }, { "from": "gpt", "value": "def prime_views(pool_size):\n \"\"\"\n Prime the views so that a very large import doesn't cause the index\n to get too far behind\n \"\"\"\n\n # These have to be included here or ./manage.py ...
python
chosen
[ { "from": "human", "value": "Implement running average action history\n" }, { "from": "gpt", "value": "import theano\n\nfrom sft import Size\nfrom sft.Actions import Actions\nfrom sft.agent.ah.ActionHistory import ActionHistory\n\nimport numpy as np\n\n\nclass RunningAvg(ActionHistory):\n\tdef _...
python
chosen
[ { "from": "human", "value": "Create Result class with file\n" }, { "from": "gpt", "value": "import os\nfrom datetime import datetime\n\n\nclass Result:\n def __init__(self, directory):\n date = datetime.fromtimestamp(time())\n name = '%d-%d-%d_%d-%d-%d' % (datetime.year,\n ...
python
chosen
[ { "from": "human", "value": "Add testdriver to simulate large numbers of simultaneous connections\n" }, { "from": "gpt", "value": "from ammo import AndroidConnector\nfrom ammo import AmmoMessages_pb2\n\nimport uuid\nimport sys\nimport time\nimport datetime\nimport math\nimport optparse\n\n\nfrom...
python
chosen
[ { "from": "human", "value": "Revert \"[REVERT][OSF-3622] Add migration file to automatically parse citations\"\"\n" }, { "from": "gpt", "value": "# This migration port `scripts/parse_citation_styles` to automatically parse citation styles.\n# Additionally, this set the corresponding `has_bibliog...
python
chosen
[ { "from": "human", "value": "Set up Code Fights array replace problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Add Border Problem\n\n\ndef arrayReplace(inputArray, elemToReplace, substitutionElem):\n pass\n\n\ndef main():\n pass\n\n\nif __name__ == '__main__'...
python
chosen
[ { "from": "human", "value": "Add ticket revocation service tests\n\nForgot to actually add them earlier.\n" }, { "from": "gpt", "value": "\"\"\"\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom byceps.services.seating import category_s...
python
chosen
[ { "from": "human", "value": "ENH: Add tool to check for deprecated escaped characters.\n\nPython 3.6 deprecates a number of escaped characters that were accepted\nbefore. For instance, '\\(' was previously accepted but must now be\nwritten as '\\\\(' or r'\\('.\n\n[ci skip]\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "human", "value": "Define the User class constructor\n" }, { "from": "gpt", "value": "class BucketList():\n def __init__(self, name, description):\n self.name = name\n self.description = description\n self.activities = []\n self.no_of_activities = len(sel...
python
chosen
[ { "from": "human", "value": "Add py solution for 404. Sum of Left Leaves\n\n404. Sum of Left Leaves: https://leetcode.com/problems/sum-of-left-leaves/\n" }, { "from": "gpt", "value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# self.va...
python
chosen
[ { "from": "human", "value": "Add a test to read an image index and write it back.\n" }, { "from": "gpt", "value": "\"\"\"Read an image index from the index file and write it back.\n\"\"\"\n\nimport os.path\nimport shutil\nimport filecmp\nimport pytest\nimport photo.index\nfrom conftest import tm...
python
chosen
[ { "from": "human", "value": "Add a hacky script for clearing a job's cookie jar\n\nCf. https://github.com/ArchiveTeam/wpull/issues/448\n\nBased on https://gist.github.com/JustAnotherArchivist/8f5ac42a9c03302f222af3a58a863468\n" }, { "from": "gpt", "value": "######################################...
python
chosen
[ { "from": "human", "value": "Add a script wrapping the splitted modules\n\nThis script just imports both modules such that old scripts are still\nrunning without issues.\n" }, { "from": "gpt", "value": "from BALLCore import *\ntry:\n\tfrom VIEW import *\nexcept:\n\tprint \"Warning: Could not fin...
python
chosen