conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add a script to generate JSON bigram frequencies for English\n" }, { "from": "gpt", "value": "import json\nimport lxml.html\nfrom lxml.cssselect import CSSSelector\nimport requests\nimport sys\n\n\ndef main():\n raw = requests.get(\"http://norvig.com/mayzner.html\...
python
chosen
[ { "from": "human", "value": "Add problem delete note in a linked list\n" }, { "from": "gpt", "value": "# https://leetcode.com/problems/delete-node-in-a-linked-list/\n\n# Definition for singly-linked list.\n# class ListNode(object):\n# def __init__(self, x):\n# self.val = x\n# ...
python
chosen
[ { "from": "human", "value": "Add a view that serves a single static file\n" }, { "from": "gpt", "value": "import os\n\nimport tornado.web\nimport tornado.ioloop\n\n\nclass SingleStatic(tornado.web.StaticFileHandler):\n def initialize(self, path):\n self.dirname, self.filename = os.path...
python
chosen
[ { "from": "human", "value": "Add script to normalize image using Ops\n" }, { "from": "gpt", "value": "# @Dataset data\n# @OpService ops\n# @OUTPUT Img normalized\n\n# Create normalized image to the [0, 1] range.\n#\n# Stefan Helfrich (University of Konstanz), 03/10/2016\n\nfrom net.imglib2.type....
python
chosen
[ { "from": "human", "value": "Add migration to add new Juniper SASS vars to sites\n\nfix bug\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\nimport json\nfrom django.db import migrations, models\n\n\ndef add_juniper_new_sass_vars(apps, schema_editor):\n \"\"\"\n This migration...
python
chosen
[ { "from": "human", "value": "Add example of force https\n" }, { "from": "gpt", "value": "\"\"\"An example of using a middleware to require HTTPS connections.\n requires https://github.com/falconry/falcon-require-https to be installed via\n pip install falcon-require-https\n\"\"\"\nimport h...
python
chosen
[ { "from": "human", "value": "Add WmataError class and start of Wmata class.\n\nStarts module code. Error class is added, and the main class, Wmata, is added,\nwith the default class variables and the init function added.\n" }, { "from": "gpt", "value": "import datetime\nimport urllib\nimport js...
python
chosen
[ { "from": "human", "value": "Add management script to generate hansard appearance scores.\n" }, { "from": "gpt", "value": "import datetime\n\nfrom django.core.management.base import NoArgsCommand\nfrom django.core.exceptions import ImproperlyConfigured\n\nclass Command(NoArgsCommand):\n help ...
python
chosen
[ { "from": "human", "value": "Add a migration to drop mandatory assessment methods from brief data\n\nRemoves work history and written proposal from all briefs, since\nthey're no longer a valid option for evaluationType and are added\nautomatically to all briefs.\n\nDowngrade will add the options to all brie...
python
chosen
[ { "from": "human", "value": "Add Client class to abstract from different datbase clients\n" }, { "from": "gpt", "value": "import importlib\nimport os\n\nclass DBClient:\n\n db_defaults = {'mongo': 'mongodb://localhost:27017/',\n 'redis': 'redis://localhost:6379',\n ...
python
chosen
[ { "from": "human", "value": "Add unit tests for the precomputed_io module\n" }, { "from": "gpt", "value": "# Copyright (c) 2018 CEA\n# Author: Yann Leprince <yann.leprince@cea.fr>\n#\n# This software is made available under the MIT licence, see LICENCE.txt.\n\nimport numpy as np\nimport pytest\n...
python
chosen
[ { "from": "human", "value": "Remove monthly_billing table from the database\n" }, { "from": "gpt", "value": "\"\"\"\n\nRevision ID: 0209_remove_monthly_billing\nRevises: 84c3b6eb16b3\nCreate Date: 2018-07-27 14:46:30.109811\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\nfrom sqlalch...
python
chosen
[ { "from": "human", "value": "Add a memory test script\n\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.7\n# -*- mode: python; coding: utf-8 -*-\n\nfrom __future__ import print_function, division, absolute_import\n\nfrom memory_profiler import profile\nimport numpy as np\nfrom astropy im...
python
chosen
[ { "from": "human", "value": "Add example for type-checking chain\n" }, { "from": "gpt", "value": "from thinc.api import chain, ReLu, MaxPool, Softmax, chain\n\n# This example should be run with mypy. This is an example of type-level checking \n# for network validity.\n#\n# We first define an inv...
python
chosen
[ { "from": "human", "value": "Add some tests for hil_client\n" }, { "from": "gpt", "value": "\"\"\"\nGeneral info about these tests\n\nThe tests assusme that the nodes are in the <from_project> which is set to be the\n\"slurm\" project, since that is what we are testing here.\n\nIf all tests pass...
python
chosen
[ { "from": "human", "value": "Add basic methods for accessing user data\n" }, { "from": "gpt", "value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Publish What You Fund\n#\n# ...
python
chosen
[ { "from": "human", "value": "Add demo on how to write unstructured point meshes in Vtk.\n" }, { "from": "gpt", "value": "import numpy as np\nfrom pyvisfile.vtk import ( \n UnstructuredGrid, DataArray,\n AppendedDataXMLGenerator,\n VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS)\n...
python
chosen
[ { "from": "human", "value": "Add script to calculate perplexity results\n\nAdded a script that calculates perplexity at intervals for different\nconfigurations of nTopics and save the results to csv\n" }, { "from": "gpt", "value": "import pandas as pd\nimport logging\n\nfrom CPTCorpus import CPT...
python
chosen
[ { "from": "human", "value": "Add input handling for ssh connections\n" }, { "from": "gpt", "value": "from threading import Thread\n\nclass Juliet_Input (Thread):\n def __init(self):\n Thread.__init(self)\n \n def run(self):\n while True:\n char = raw_input()\n ...
python
chosen
[ { "from": "human", "value": "Add dummy Keras inputs builder\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\"\"\"Generate fake NN files to test the lightweight classes\"\"\"\n\nimport argparse\nimport json\nimport h5py\nimport numpy as np\n\ndef _run():\n args = _get_args()\n _...
python
chosen
[ { "from": "human", "value": "Add interactive script to get papers from Mendeley API\n" }, { "from": "gpt", "value": "###\n# Copyright 2015-2020, Institute for Systems Biology\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 a base regressions package\n\nThis contains only various imports / definitions that will be useful\nin the child modules and should be able to be used via\n'from .. import *' without issues.\n" }, { "from": "gpt", "value": "# regressions\n\n\"\"\"A package which ...
python
chosen
[ { "from": "human", "value": "Add initial framerate webcam test structure\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport qrtools, gi, os\ngi.require_version('Gtk', '3.0')\ngi.require_version('Gst', '1.0')\nfrom gi.repository import Gtk, Gst\nfrom avocado import Test\nfrom utils ...
python
chosen
[ { "from": "human", "value": "Add a script to generate all known codes and their decoding\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport lsi_decode_loginfo as loginfo\n\ndef generate_values(data):\n title = data[0]\n mask = data[1]\n sub = data[2]\n\n for key in sub....
python
chosen
[ { "from": "human", "value": "Write script to convert PMF-based result to expected value\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\n\nimport numpy as np\nimport pandas as pd\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='Convert ...
python
chosen
[ { "from": "human", "value": "Add an example of a blocking tcp server\n\nThe example implements a basic telnet server.\n" }, { "from": "gpt", "value": "\"\"\"\nA Simple example for testing the SimpleServer Class. A simple telnet server.\nIt is for studying purposes only.\n\"\"\"\n\nfrom server im...
python
chosen
[ { "from": "human", "value": "Add code for pulling pitcher stats for specified date range\n" }, { "from": "gpt", "value": "import requests\nimport pandas as pd\nfrom bs4 import BeautifulSoup\n\ndef get_soup(start_dt, end_dt):\n\t# get most recent standings if date not specified\n\tif((start_dt is...
python
chosen
[ { "from": "human", "value": "Check to make sure the input file is sorted\n" }, { "from": "gpt", "value": "import sys\n\nprev_val = 0\nprev_val2 = 0\ncounter = 0\n\nfor line in sys.stdin:\n parts = line.split()\n curr_val = int(parts[0])\n curr_val2 = int(parts[1])\n\n val1 = int(part...
python
chosen
[ { "from": "human", "value": "Add election funding parsing script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport os\nimport sys\nimport csv\nfrom optparse import OptionParser\n\nfrom django.core.management import setup_environ\n\nmy_path = os.path.abspath(os.path.dirname(__file__))\...
python
chosen
[ { "from": "human", "value": "Add the IFTTT campaign success server plugin\n" }, { "from": "gpt", "value": "import collections\n\nimport king_phisher.plugins as plugin_opts\nimport king_phisher.server.plugins as plugins\nimport king_phisher.server.signals as signals\n\nimport requests\n\nclass Pl...
python
chosen
[ { "from": "human", "value": "Add problem 1 sum muliples of 3 or 5 python solution\n" }, { "from": "gpt", "value": "#\n'''\nProject Euler - Problem 1 - Multiples of 3 and 5\nhttps://projecteuler.net/problem=1\n\nIf we list all the natural numbers below 10 that are multiples of 3 or 5, we\nget 3, ...
python
chosen
[ { "from": "human", "value": "Add migration for comment notification type\n" }, { "from": "gpt", "value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: miha@reciprocity...
python
chosen
[ { "from": "human", "value": "ADD migration scripts for uom prices\n" }, { "from": "gpt", "value": "# -*- encoding: utf-8 -*-\nfrom openerp import SUPERUSER_ID\nfrom openerp.modules.registry import RegistryManager\n\n\ndef set_value(cr, model, table, field, value, condition):\n print 'Set valu...
python
chosen
[ { "from": "human", "value": "Adjust phases to make campaign non-editable\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\nfrom bluebottle.utils.model_dispatcher import get_model...
python
chosen
[ { "from": "human", "value": "Add migration for request notification types\n" }, { "from": "gpt", "value": "\n\"\"\"Add request notification types\n\nRevision ID: 50c374901d42\nRevises: 4e989ef86619\nCreate Date: 2016-03-04 12:45:23.024224\n\n\"\"\"\n\nimport sqlalchemy as sa\nfrom alembic import...
python
chosen
[ { "from": "human", "value": "Add functions for storing/getting blogs and posts\n" }, { "from": "gpt", "value": "\"\"\"\npyblogit.database_handler\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis module handles the connection and manipulation of the local database.\n\"\"\"\nimport sqlite3\n\n\ndef get_cursor(b...
python
chosen
[ { "from": "human", "value": "Implement a genre string parser\n" }, { "from": "gpt", "value": "import re\nfrom django.utils.encoding import smart_str\n\nclass GenreParser:\n @staticmethod\n def parse(genre):\n genre = smart_str(genre).lower()\n if re.search(r\"\\b(jazz|blues)\...
python
chosen
[ { "from": "human", "value": "Move win32 audio experiment to trunk.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\r\n# $Id:$\r\n\r\n# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU.\r\n# Caveats:\r\n# - Requires a filename (not from memory or stream yet). Looks l...
python
chosen
[ { "from": "human", "value": "Add skeleton for new python scripts.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n\"\"\"Usage:\n <SCRIPT_NAME> [--log-level=<log-level>]\n\n-h --help\n Show this message.\n-v --version\n Show version.\n--log-level=<log-level>\n Set logging level ...
python
chosen
[ { "from": "human", "value": "Add tests for mixin order\n\nTest that mixin order on models does not hide any eager queries.\n" }, { "from": "gpt", "value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 ...
python
chosen
[ { "from": "human", "value": "Add test for committee subscriptions page\n" }, { "from": "gpt", "value": "import datetime\nfrom tests import PMGLiveServerTestCase\nfrom tests.fixtures import dbfixture, HouseData, CommitteeData\n\nTHIS_YEAR = datetime.datetime.today().year\n\n\nclass TestCommitteeS...
python
chosen
[ { "from": "human", "value": "Add back a filesystem backend for testing and development\n" }, { "from": "gpt", "value": "import os\nimport json\n\nfrom scrapi.processing.base import BaseProcessor\n\n\nclass StorageProcessor(BaseProcessor):\n NAME = 'storage'\n\n def process_raw(self, raw):\...
python
chosen
[ { "from": "human", "value": "Add script to get public registrations for staff members\n\n[skip ci]\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Get public registrations for staff members.\n\n python -m scripts.staff_public_regs\n\"\"\"\nfrom collections import defaultdict\n...
python
chosen
[ { "from": "system", "value": "Add warnings to inspector DOM count unittest baselines.\n\nThe unit test failure indicates a serious Document leak, where all\nWebCore::Document loaded in Chrome is leaking.\nThis CL adds warning comments to the baseline to avoid regressions.\n\nBUG=392121\nNOTRY=true\n\nReview...
python
chosen
[ { "from": "human", "value": "Add unit test for base Handler.\n" }, { "from": "gpt", "value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nfrom mock import Mock\n\nfrom bark.log import Log\nfrom bark.handler.base import Handler\nfro...
python
chosen
[ { "from": "human", "value": "Add py solution for 645. Set Mismatch\n\n645. Set Mismatch: https://leetcode.com/problems/set-mismatch/\n" }, { "from": "gpt", "value": "class Solution(object):\n def findErrorNums(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: List[i...
python
chosen
[ { "from": "human", "value": "Add tests for config generation\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Copyright 2018 New Vector Ltd\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# Yo...
python
chosen
[ { "from": "human", "value": "Add a new sub example regarding custom ACL modification" }, { "from": "gpt", "value": "# Copyright 2016 Netfishers\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 ...
python
chosen
[ { "from": "human", "value": "Add dictionary mapping abbreviations to station names\n" }, { "from": "gpt", "value": "station_map = {\n '12th': '12th St. Oakland City Center',\n '16th': '16th St. Mission (SF)',\n '19th': '19th St. Oakland',\n '24th': '24th St. Mission (SF)',\n 'ashb...
python
chosen
[ { "from": "human", "value": "Add error formatting tests for httperror\n" }, { "from": "gpt", "value": "import unittest\n\nfrom fleece import httperror\n\n\nclass HTTPErrorTests(unittest.TestCase):\n \"\"\"Tests for :class:`fleece.httperror.HTTPError`.\"\"\"\n\n def test_error_msg_format(se...
python
chosen
[ { "from": "human", "value": "Add basic infrastructure for rest API\n" }, { "from": "gpt", "value": "#!../env/bin/python\nfrom flask import Flask, jsonify\n\napp = Flask(__name__)\n\n@app.route('/hoot/api/v1.0/', methods=['GET'])\ndef index():\n return jsonify({'hello': 'Hello World!'})\n\n\ni...
python
chosen
[ { "from": "human", "value": "Add first file\nOnly read a .docx until now\n" }, { "from": "gpt", "value": "from docx import Document\n\nif __name__ == \"__main__\":\n if sys.args[0] == 0:\n print(\"Must specify file!\")\n return\n #open the docx (and docx only)\n document =...
python
chosen
[ { "from": "human", "value": "Add DB migration for netdev bindings\n" }, { "from": "gpt", "value": "\"\"\"link bindings to access entities\n\nRevision ID: f2d2359b923a\nRevises: b32a4bf96447\nCreate Date: 2018-01-09 16:59:13.885801\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision =...
python
chosen
[ { "from": "human", "value": "[Core] Create a quick script to train a COBE brain from a folder of formatted IRC logs\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\nimport argparse\nimport os\nfrom cobe.brain import Brain\n\nif __name__ == \"__main__\":\n\n bots = [\"...
python
chosen
[ { "from": "human", "value": "Add test for extension loading and unloading\n" }, { "from": "gpt", "value": "import os.path\n\nimport nose.tools as nt\n\nimport IPython.testing.tools as tt\nfrom IPython.utils.syspathcontext import prepended_to_syspath\nfrom IPython.utils.tempdir import TemporaryDi...
python
chosen
[ { "from": "human", "value": "Add snip code for http.cookies\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Sep 14 20:49:34 2016\n\n@author: troon\n\"\"\"\n\nimport BaseHTTPServer, SimpleHTTPServer\nfrom http.cookies import SimpleCookie as cookie\n\nclass Applica...
python
chosen
[ { "from": "human", "value": "Add tests for some util functions.\n\n\ngit-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@1082063 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Licensed to the Apache Software Foundation (ASF) under one or more§\n...
python
chosen
[ { "from": "human", "value": "Add test. This continues to need pytz and tzlocal.\n" }, { "from": "gpt", "value": "import datetime\n\nimport pytz\nimport tzlocal\n\nfrom caldav.elements.cdav import _to_utc_date_string\n\nSOMEWHERE_REMOTE = pytz.timezone('Brazil/DeNoronha') # UTC-2 and no DST\n\n\...
python
chosen
[ { "from": "human", "value": "Add migration for multiple repos per team.\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 ('tea...
python
chosen
[ { "from": "human", "value": "Add migration for replace location with country and city\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-08-04 14:47\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport django_countries.fi...
python
chosen
[ { "from": "human", "value": "Add management command for importing Holvi Invoices and Orders\n\nInvoices may have multiple payments, abstracttransaction is generated\nfor each payment line.\n\nOrders are paid in one go (they're from the webshop), one transaction\nis generated from an Order.\n" }, { "...
python
chosen
[ { "from": "human", "value": "Write an abstraction for storing locality state in ES\n" }, { "from": "gpt", "value": "'''To make GeoModel code more testable, we abstract interaction with\nElasticSearch away via a \"journal interface\". This is just a function that,\ncalled with an ES index and a ...
python
chosen
[ { "from": "human", "value": "Write Pytac script to write all readback pvs to file\n" }, { "from": "gpt", "value": "import pytac.load_csv\nimport pytac.epics\n\n\ndef write_data_to_file(file_name, data):\n fin = open(file_name, 'w')\n for row in data:\n fin.write('{0}\\n'.format(row)...
python
chosen
[ { "from": "human", "value": "Add simple demo of piglow - lighting arms\n" }, { "from": "gpt", "value": "from piglow import PiGlow\nimport time\n\ndef brighten_arm( arm ):\n\n for i in range( 1, 10 ):\n piglow.arm( arm, i )\n time.sleep( 0.11 )\n\n time.sleep( 0.5 )\n piglo...
python
chosen
[ { "from": "human", "value": "Add management command to update corpus logic hashes\n" }, { "from": "gpt", "value": "import logging\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom plyara import YaraParser\nfrom rules.models import YaraRule\n\n# Configure Logging\nlogging...
python
chosen
[ { "from": "human", "value": "Add PyUnit for deep feature extraction of a LeNet model with mxnet.\n" }, { "from": "gpt", "value": "from __future__ import print_function\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nimport h2o\nfrom tests import pyunit_utils\nfrom h2o.es...
python
chosen
[ { "from": "human", "value": "Add exercice The Paranoid Android\n" }, { "from": "gpt", "value": "class Elevator(object):\n def __init__(self, floor, pos):\n super(Elevator, self).__init__()\n self.floor = floor\n self.pos = pos\n self.direction = None\n\n def __s...
python
chosen
[ { "from": "human", "value": "Test case for task.info.json files\n\nEnsures all tasks have .info.json file and have a valid structure.\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport glob\nimport json\nimport unittest\nsys.path.append(os.path.dirname(os.path.dirname(__file__)))\nim...
python
chosen
[ { "from": "human", "value": "Implement simple gaussian process regression.\n" }, { "from": "gpt", "value": "import csv\nimport sys\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport sklearn\nimport sklearn.gaussian_process.kernels\n\n\nkernel = (sklearn.gaussian_process.kernels.Const...
python
chosen
[ { "from": "human", "value": "Add tests for project model\n" }, { "from": "gpt", "value": "from server.models import Project\nfrom server.tests.helpers import fixtures, FlaskTestCase\n\n\nclass TestProject(FlaskTestCase):\n @fixtures('single_project.json')\n def test_get_single_owner(self):...
python
chosen
[ { "from": "human", "value": "Add sample on veh handle setup in remote process\n" }, { "from": "gpt", "value": "import windows\nimport windows.test\n\nfrom windows.generated_def.winstructs import *\n\n#c = windows.test.pop_calc_64()\n\n\nc = windows.test.pop_calc_64(dwCreationFlags=CREATE_SUSPEND...
python
chosen
[ { "from": "human", "value": "Add Python script for questions linting\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n\nimport os\nimport sys\nimport json\nimport collections\nimport unicodedata\n\n\nTEXT_FIELD = \"t\"\nOPTIONS_FIELD = \"o\"\nKIND_FIELD = \"k\"\nCORRECT_FIELD = \"c\"\n...
python
chosen
[ { "from": "human", "value": "Add tests directory to sourceterm package and start test module.\n" }, { "from": "gpt", "value": "'''\nCreated on 25 Aug 2010\n\n@author: ith\n'''\nimport unittest\n\n\nclass Test(unittest.TestCase):\n\n\n def testName(self):\n pass\n\n\nif __name__ == \"__...
python
chosen
[ { "from": "system", "value": "Update blogroll and social links.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- #\nfrom __future__ import unicode_literals\n\nAUTHOR = u'IPython development team and Enthought, Inc.'\nSITENAME = u'DistArray'\nSITEURL = ''\n\nPATH ...
python
chosen
[ { "from": "human", "value": "Add basic functionality to query the (horrible) website.\n" }, { "from": "gpt", "value": "from datetime import date\nimport bs4\nimport itertools as it\nimport re\nimport requests\n\n\ndef grouper(iterable, n, fillvalue=None):\n args = [iter(iterable)] * n\n re...
python
chosen
[ { "from": "human", "value": "Add tests for quick sort\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom quick_sort import quick_sort\n\n\ndef test_sorted():\n my_list = list(range(100))\n quick_sort(my_list)\n assert my_list == list(range(100))\n\n\ndef test_reverse():\n ...
python
chosen
[ { "from": "human", "value": "Add archive.File class, which allows downloading from archive.org\n" }, { "from": "gpt", "value": "import os, sys\ninc_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nsys.path.insert(0, inc_path)\n\nimport archive\n\ndef test_item():\n item = a...
python
chosen
[ { "from": "human", "value": "Add test for box migration script\n" }, { "from": "gpt", "value": "from nose.tools import *\n\nfrom scripts.box.migrate_to_external_account import do_migration, get_targets\n\nfrom framework.auth import Auth\n\nfrom tests.base import OsfTestCase\nfrom tests.factories...
python
chosen
[ { "from": "human", "value": "Add tests of CSVFile and StdOut recorders\n" }, { "from": "gpt", "value": "import pytest\nfrom plumbium.processresult import record, pipeline, call\nfrom plumbium.recorders import CSVFile, StdOut\nfrom collections import OrderedDict\n\n\n@pytest.fixture\ndef simple_p...
python
chosen
[ { "from": "human", "value": "Set up first test level, started to create constraints\n" }, { "from": "gpt", "value": "from constraint import *\n\n# Empty space is 0\n# Brick is a 1\n# Block is a 2\n# West facing player - 3\n# East facing player - 4\n# Door - 5\nlevel = [[1,1,1,1,1,1,1,1,1,1],\n ...
python
chosen
[ { "from": "human", "value": "Add simple perf measuring tool\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n\nimport sys\nimport subprocess\n\n\"\"\"\nUsage:\n ./ref.py ./main -B 1000000 -t 3 -T 31\n\"\"\"\n\nsystem = subprocess.check_output\n\ngithash = system(\"git rev-parse HEAD\"...
python
chosen
[ { "from": "human", "value": "Add unit test for generate_admin_metadata helper function\n" }, { "from": "gpt", "value": "\"\"\"Test the generate_admin_metadata helper function.\"\"\"\n\ndef test_generate_admin_metadata():\n import dtoolcore\n from dtoolcore import generate_admin_metadata\n ...
python
chosen
[ { "from": "human", "value": "Integrate switch 10 and introduce couplings.\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n#\n# start pytrain\n#\nimport os\nimport sys\n\nMYDIR = os.path.dirname(sys.argv[0])\n\nos.system(MYDIR+\"/run.sh\")\nif len(sys.argv)==1:\n sys.argv.append(\"10.0.0....
python
chosen
[ { "from": "human", "value": "Move working view.cwl script to doc folder\n\nArvados-DCO-1.1-Signed-off-by: Benjamin Carr <ben@curii.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport fnmatch\nimport requests\nimport time\nimport os\nimport glob\n\n# You can alternatively define...
python
chosen
[ { "from": "human", "value": "Remove redundant subscription fields from user model.\n" }, { "from": "gpt", "value": "\"\"\"remove redundant user subscription fields\n\nRevision ID: 3fc4c97dc6bd\nRevises: 3d723944025f\nCreate Date: 2015-01-27 18:11:15.822193\n\n\"\"\"\n\n# revision identifiers, us...
python
chosen
[ { "from": "human", "value": "Add one liner to add ability to print a normal distribution with mean zero and varience one\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3 \n\n#Copyright 2015 BRendan Perrine\n\nimport random \n\nrandom.seed()\n\nprint (random.gauss(0,1), \"Is a normal distr...
python
chosen
[ { "from": "system", "value": "Add missing django_libs test requirement\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\nimport calendarium\n\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n ex...
python
chosen
[ { "from": "human", "value": "Add python script to check big-O notation\n" }, { "from": "gpt", "value": "import timeit\nimport random\n\nfor i in range (10000, 100000, 20000):\n t = timeit.Timer(\"random.randrange(%d) in x\"%i, \"from __main__ import random, x\")\n\n x = list(range(i))\n list_...
python
chosen
[ { "from": "human", "value": "Add script to extract code/data size after make examples.\n\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# encoding: utf-8\n\nfrom __future__ import with_statement\nimport argparse, re, sys\n\ndef filter(args):\n bytes_extractor = re.compile(r\"([0-9]+) byt...
python
chosen
[ { "from": "human", "value": "Add script for comparing test vectors.\n\nNote: does not yet include the `plot_pulse_files_compare` method because that\nneeds some cleanup.\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport glob\nimport h5py\n\nfrom QGL import *\nimport QGL\n\nBASE_AWG_...
python
chosen
[ { "from": "human", "value": "Add about page functional test\n\nTest the about page navigation and expected content\n" }, { "from": "gpt", "value": "from .base import FunctionalTest\n\n\nclass AboutPageTest(FunctionalTest):\n\n def test_about_page_navigation(self):\n self.browser.get(se...
python
chosen
[ { "from": "human", "value": "tests: Add tests for the constructor\n" }, { "from": "gpt", "value": "import pytest # type: ignore\nfrom hypothesis import given\nfrom utils import floats, vectors, vector_likes\n\nfrom ppb_vector import Vector2\n\n\nclass V(Vector2): pass\n\n\n@pytest.mark.parametr...
python
chosen
[ { "from": "human", "value": "Add a fake source code so you can embed it in the example\n" }, { "from": "gpt", "value": "# Get the hash \n# 01/07/2017\n# Melissa Hoffman\n\n# Get the current repo\n\nimport os\nimport subprocess \n\ntestdir='/Users/melissahoffman1/'\nrepo = testdir\n\n# Check if t...
python
chosen
[ { "from": "human", "value": "refactor(lms): Update migrations to use lms.yml in the help text\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.16 on 2020-09-19 09:55\n\nfrom django.db import migrations, models\nimport openedx.core.lib.hash_utils\n\n\nclass Migration(migrations.Migratio...
python
chosen
[ { "from": "human", "value": "Add script to assist in packaging.\n" }, { "from": "gpt", "value": "\"\"\"This tool sets up a distribution of the software by automating\nseveral tasks that need to be done.\n\nThe directory should be in pristine condition when this is run (i.e.,\ndevoid of files tha...
python
chosen
[ { "from": "human", "value": "Add existing python file for performing a very crude analysis on a set of lsl files (as taken from an untarred OAR, for example)\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport re\nimport sys\n\n\"\"\" Taken from http://stackoverflow.com/questions/266905...
python
chosen
[ { "from": "human", "value": "examples/bench: Add a new benchmark - readline server\n" }, { "from": "gpt", "value": "import argparse\nimport asyncio\nimport gc\nimport uvloop\nimport os.path\nimport socket as socket_module\n\nfrom socket import *\n\n\nPRINT = 0\n\n\nasync def echo_client_streams(...
python
chosen
[ { "from": "human", "value": "Test for pytest.ini as session-scoped fixture\n" }, { "from": "gpt", "value": "\"\"\"\nConfig instructions and test fixtures\n\"\"\"\n\nimport pytest\nimport os\nimport sys\n\n\n# # these are just some fun dividiers to make the output pretty\n# # completely unnecessa...
python
chosen
[ { "from": "human", "value": "Solve Code Fights count visitors problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Count Visitors Problem\n\n\nclass Counter(object):\n def __init__(self, value):\n self.value = value\n\n def inc(self):\n self.value +...
python
chosen
[ { "from": "human", "value": "Solve Code Fights fibonacci list problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Fibonacci List Problem\n\nfrom functools import reduce\n\n\ndef fibonacciList(n):\n return [[0] * x for x in reduce(lambda x, n: x + [sum(x[-2:])],\n ...
python
chosen