conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add multi-value parameter SynthDef str() test.\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\nfrom abjad.tools import systemtools\nfrom supriya import synthdeftools\nfrom supriya import ugentools\n\n\nclass TestCase(systemtools.TestCase):\n\n def test... | python | chosen |
[
{
"from": "human",
"value": "Add script to count duplicated data\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pandas as pd\n\nall_df = None\n\nfor filename in [\"dentistes.refined.csv\",\n \"infirmiers.refined.csv\",\n \"medecins_exploitables... | python | chosen |
[
{
"from": "human",
"value": "Add tests for transactional emails\n"
},
{
"from": "gpt",
"value": "import mock\n\nfrom gratipay.models.participant import Participant\nfrom gratipay.models.account_elsewhere import AccountElsewhere\nfrom gratipay.testing import Harness\nfrom gratipay.testing.emails ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to go through all social credentials available and post the weather. This script will need to be cron'ed.\n"
},
{
"from": "gpt",
"value": "from django.contrib.contenttypes.models import ContentType\nfrom django.conf import settings\nfrom socialregistrati... | python | chosen |
[
{
"from": "human",
"value": "Add command to get discussion_link for a course\n\nThis will be used to detect courses that are linking to Stack Exchange\nsites so we can handle them specially when generating data dumps.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseC... | python | chosen |
[
{
"from": "human",
"value": "Add stub for summary downloader\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nclass SummaryDownloader():\n\n # base url for official schedule json page\n SCHEDULE_URL_BASE = \"http://statsapi.web.nhl.com/api/v1/schedule\"\... | python | chosen |
[
{
"from": "human",
"value": "Store info about zone runs\n"
},
{
"from": "gpt",
"value": "# Copyright 2011 Google Inc.\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 Licens... | python | chosen |
[
{
"from": "human",
"value": "Add shopping categories to the database\n"
},
{
"from": "gpt",
"value": "\"\"\"Add shopping categories\n\nRevision ID: 430dc4ed6dd6\nRevises: 3a1dddd0c0f8\nCreate Date: 2014-12-24 09:55:10.993854\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '430d... | python | chosen |
[
{
"from": "human",
"value": "Add control_sections to relationships migration\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 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: anze@recipro... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate thumbnaisl with data info fomr eXIF metadata\n"
},
{
"from": "gpt",
"value": "'''Make a jpg images with thumbnails and date information for all files in directory\n\nTo-Do: Currently it will always make 5 * 3 thumbnails - need to calc this numb... | python | chosen |
[
{
"from": "human",
"value": "Add solution for 59 Spiral Matrix II\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def generateMatrix(self, n):\n \"\"\"\n :type matrix: List[List[int]]\n :rtype: List[int]\n \"\"\"\n if n <= 0:\n return [... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate text file from the debates data (xml)\n\nUpon request by Inger Leemans. Adjusted the debates2csv script to save\nall text in the xml file(s) to txt file(s).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -.*- coding: utf-8 -.*-\n\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add cmd to check on the status of voucher cases\n"
},
{
"from": "gpt",
"value": "import csv\n\nfrom django.core.management.base import BaseCommand\n\nfrom corehq.apps.users.models import CommCareUser\nfrom corehq.form_processor.interfaces.dbaccessors import CaseAcces... | python | chosen |
[
{
"from": "human",
"value": "Add python script that plots the results of a fire propagation\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2017, CNRS-LAAS\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided th... | python | chosen |
[
{
"from": "human",
"value": "Migrate build -> job in dockci job config meta\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFix artifacts after rename from build models to job models\n\"\"\"\nimport py.error\nimport py.path\nimport yaml\n\nfrom yaml import safe_load as yaml_load\n\n\njobs_path = py.pat... | python | chosen |
[
{
"from": "human",
"value": "Add few tests for injections\n"
},
{
"from": "gpt",
"value": "\"\"\"Dependency injector container unit tests.\"\"\"\n\nimport unittest2 as unittest\n\nfrom dependency_injector import injections\nfrom dependency_injector import providers\n\n\nclass PositionalInjection... | python | chosen |
[
{
"from": "human",
"value": "Add test to capture than honcho can invoke under runpy.\n"
},
{
"from": "gpt",
"value": "import sys\nimport subprocess\nimport re\n\n\ndef test_runpy_invoke():\n \"\"\"\n Ensure honcho can also be invoked using runpy (python -m)\n \"\"\"\n cmd = [sys.exec... | python | chosen |
[
{
"from": "human",
"value": "Write the tests for the Validation class.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the validation module\"\"\"\n\nfrom pytest import mark\nfrom json import loads\n\nfrom gobble.collection import Collection\nfrom gobble.config import EXAMPLES_DIR\nfrom gobble.valid... | python | chosen |
[
{
"from": "human",
"value": "Add some test for channels module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom unittest import TestCase\n\nimport channels\n\n\nclass ChannelsModuleTestCase(TestCase):\n def test_load_module(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Read in the directory of CSVs\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTeam Challenge: Predicting Turn Types\nAuthors: Tong, Will, and Ryan\n\"\"\"\nimport os\nimport sys\nimport csv\nimport argparse\n\ndef read_csv(path):\n output = []\n with open(path, 'rb') ... | python | chosen |
[
{
"from": "human",
"value": "Add commande-line interface for grokapi\n\nUsing an ArgumentParser\n\nCloses #4\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom queries import Grok\n\n\ndef print_monthly_views(site, pages, year, month):\n grok = Grok(site)\n for page in pages:... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to list all large objects in the repo\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport git\nimport sys\n\ndef main(args):\n if len(args) != 1:\n sys.stderr.write(\"Need path to the repo\\n\")\n sys.exit(1)\n\n repo = gi... | python | chosen |
[
{
"from": "human",
"value": "Add case-insensitive index for username\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\nclass Migration(migrations.Migration):\n \"\"\" Create a unique case-insensitive index on the username column \"\"\"\n\n dependencies = [\n ('a... | python | chosen |
[
{
"from": "human",
"value": "Add extrusion test for points and lines\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Create several entities by extrusion, check that the expected\nsub-entities are returned and the resulting mesh is correct.\n\"\"\"\nimport pygmsh\nimport numpy as... | python | chosen |
[
{
"from": "human",
"value": "Add test for verbatim plugin\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#-*- encoding: utf-8 -*-\n\nimport os, sys, tempfile, unittest\nimport lxml.etree as etree\n\nECMDS_INSTALL_DIR = os.path.normpath(os.path.join(\n os.path.dirname(os.path.realpat... | python | chosen |
[
{
"from": "human",
"value": "Add a generator for the Code enum\n"
},
{
"from": "gpt",
"value": "import parser\n\ndef gen_header():\n print \"// This file was generated automatically.\"\n print \"// See the gen/ folder at the project root.\"\n print\n print \"use std::fmt;\"\n prin... | python | chosen |
[
{
"from": "human",
"value": "Add a sample mock host implementation in Python\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n\nimport sys\nimport struct\nimport json\n\ndef send(msg):\n sys.stdout.write(struct.pack(\"=I\", len(msg)))\n sys.stdout.write(msg)\n sys.stdout.flush(... | python | chosen |
[
{
"from": "human",
"value": "Add some byte conversion utilities\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2015 Nicolas JOUANIN\n#\n# See the file license.txt for copying permission.\n\n\ndef bytes_to_hex_str(data):\n return '0x' + ''.join(format(b, '02x') for b in data)\n\ndef hex_to_i... | python | chosen |
[
{
"from": "human",
"value": "Add example for plotting data\n"
},
{
"from": "gpt",
"value": "import hexgrid\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\npoints = hexgrid.create_spiral(hexgrid.HexPoints(0, 0, 0), 4)\n\npoints.data['id'] = np.arange(len(points))\npoints.data['random'] ... | python | chosen |
[
{
"from": "human",
"value": "Add a module with tools for using docker from doit"
},
{
"from": "gpt",
"value": "import subprocess\nimport sys\n\n\ndef task_docker_ready():\n \"\"\"Check that docker can be executed inside the container.\"\"\"\n\n def _docker_ready():\n try:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 16\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom math import pow\n\nx = int(pow(2, 1000))\n\na = str(x)\nres = 0\nfor i in range(len(a)):\n res += int(a[i])\n\nprint(res)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 33, after long time...\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom fractions import gcd\n\nnum = 1\nden = 1\n\nfor c in range(1, 10):\n for b in range(1, c):\n for a in range(1, b):\n x = a * 10 + c\n ... | python | chosen |
[
{
"from": "human",
"value": "Add score ranking problem and solution\n"
},
{
"from": "gpt",
"value": "\"\"\"\nRank Vectors\n\nGiven an array (or list) of scores, return the array of ranks for each value in the array. The largest value has rank 1, the second largest value has rank 2, and so on. Ti... | python | chosen |
[
{
"from": "human",
"value": "Create VendOutletForm to use for validating data received from Vend API\n"
},
{
"from": "gpt",
"value": "from django import forms\n\nfrom django_vend.core.forms import VendDateTimeField\nfrom .models import VendOutlet\n\n\nclass VendOutletForm(forms.ModelForm):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Solve Next Greater Element I\n"
},
{
"from": "gpt",
"value": "# You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.\n\n#... | python | chosen |
[
{
"from": "human",
"value": "Use RethinkDB as Celery backend\n"
},
{
"from": "gpt",
"value": "#CELERY_RESULT_BACKEND = 'mltsp.ext.rethinkdb_backend:RethinkBackend'\n\nCELERY_RESULT_BACKEND = \"amqp\"\n\n#CELERY_RETHINKDB_BACKEND_SETTINGS = {\n # 'host': '127.0.0.1',\n # 'port': 28015,\n ... | python | chosen |
[
{
"from": "human",
"value": "Set of functions used in the tests.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy import ma\nfrom numpy.random import random\n\n\ndef inputsizes_f2D(f):\n l = 3\n\n # 1D input\n #x = np.arange(10)\n #y = x\n #z = random(x.shape)\n ... | python | chosen |
[
{
"from": "human",
"value": "Update meeting minutes model (committees)\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 ('hist... | python | chosen |
[
{
"from": "human",
"value": "Add new module for ChatterBot\n"
},
{
"from": "gpt",
"value": "from modules.module_base import ModuleBase\nfrom bot import Bot\nfrom chatterbot import ChatBot\n\n\nclass ModuleChatterBot(ModuleBase):\n\n def __init__(self, bot):\n ModuleBase.__init__(self, ... | python | chosen |
[
{
"from": "human",
"value": "Speed up generation of term pages.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\nimport os\nimport sys\nimport unittest\n\nfor path in (os.getcwd(), \"software/util\", \"software/SchemaTerms\"):\n sys.path.insert(1, path) #Picku... | python | chosen |
[
{
"from": "human",
"value": "Add missing tests to plugin ambari\n\nThe tests for plugins ambari is not completed.\nAdd:\n\ttest_get_ambari_proc_list()\n\ttest_get_clients()\n\ttest_instances_have_process()\n\nChange-Id: Id835131c9715b24adf523a252849143ede711fdf\n"
},
{
"from": "gpt",
"value": "#... | python | chosen |
[
{
"from": "human",
"value": "Tests: Test if passwords are visible through API\n"
},
{
"from": "gpt",
"value": "from amivapi.tests import util\n\n\nclass TestHiddenPasswords(util.WebTestNoAuth):\n\n def test_passwords_hidden(self):\n user = self.new_user()\n\n response = self.api... | python | chosen |
[
{
"from": "human",
"value": "Add a class for management of thermal throttling\n\nThe new class allows detection of whether the device is now, or has been, thermally throttled, hence allowing rejection of performance results affected by thermal throttling.\n\nBUG=158575\n\n\nReview URL: https://chromiumcoder... | python | chosen |
[
{
"from": "human",
"value": "Add script apologize mortizations not sent\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#-*- coding: utf8 -*-\n\nimport psycopg2\nimport config\nimport dbutils\nimport codecs\nimport sys\nfrom consolemsg import step, error, fail, warn\nfrom namespace impor... | python | chosen |
[
{
"from": "human",
"value": "Add test to r_SOI computation\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nfrom astropy import units as u\nfrom astropy.tests.helper import assert_quantity_allclose\n\nfrom poliastro.bodies import Sun, Mercury, Venus, Earth, Moon, Mars\nfrom poliastro.bodies i... | python | chosen |
[
{
"from": "human",
"value": "Add simple test-cases for upnp.core.action.Argument.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Licensed under the MIT license\n# http://opensource.org/licenses/mit-license.php\n\n# Copyright 2014, Hartmut Goebel <h.goebel@goebel-consult.de>\n\n\"\... | python | chosen |
[
{
"from": "human",
"value": "Add that **** strange feedback migration again. 2nd time that has happened.\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 ... | python | chosen |
[
{
"from": "human",
"value": "Delete submissions with no (ie. blank) uid\n\nSigned-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2016-11-03 20:30\nfrom __future__ import unicode_li... | python | chosen |
[
{
"from": "human",
"value": "Test for template race condition only\n"
},
{
"from": "gpt",
"value": "import threading\nfrom wolis.test_case import WolisTestCase\nfrom wolis import utils\n\nthread_count = 5\nrequests_per_thread = 20\n\nstop = False\nfailed = False\n\ndef test_fn(s, case, url):\n ... | python | chosen |
[
{
"from": "human",
"value": "[dev] Add binary for development server\n"
},
{
"from": "gpt",
"value": "from flask_socketio import SocketIO\nfrom zou.app import app\n\nsocketio = SocketIO(app)\n\nif __name__ == \"__main__\":\n socketio.run(app, debug=True)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for d4db9f29f\n\n- Commit d4db9f29f changed the attribute Source.ENTRYTYPE to be of a given choice,\n but the migration for this change was missing and is added by this commit.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generat... | python | chosen |
[
{
"from": "human",
"value": "Test successful load of C extension\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport unittest\n\nclass Py2DMTestCase(unittest.TestCase):\n # The module will throw a warning if the C implementation cannot be\n # loaded. Make sure this warning is... | python | chosen |
[
{
"from": "human",
"value": "Add default Python example app\n"
},
{
"from": "gpt",
"value": "# test.py\r\ndef application(env, start_response):\r\n start_response('200 OK', [('Content-Type', 'text/html')])\r\n #return [b\"Hello World\"] # python3\r\n return [\"Hello World\"] # python2\r... | python | chosen |
[
{
"from": "human",
"value": "Add simple CSV encoder and Export action\n"
},
{
"from": "gpt",
"value": "\nfrom django.utils.encoding import force_text\n\nclass CSV(object):\n '''\n A generator friendly, unicode aware CSV encoder class built for speed.\n '''\n # What to put between fie... | python | chosen |
[
{
"from": "human",
"value": "Add command to cleanup commtrack forms\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom couchforms.models import XFormInstance\nfrom dimagi.utils.couch.database import iter_docs\nfrom corehq.apps.commtrack.models import Suppl... | python | chosen |
[
{
"from": "human",
"value": "Add small script to generate learning set.\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef _consecutive_index_generator(length, offset=0):\n \"\"\"Generate pair of ids of consecutive images. Offset is the distance between the images\n \"\"\"\n o... | python | chosen |
[
{
"from": "system",
"value": "Use TO header for creating mailbox name.\n\n--HG--\nbranch : exim4_pipe\n"
},
{
"from": "human",
"value": "import email\nimport logging\nimport rfc822\nimport sys\n\nfrom django.core.management.base import BaseCommand\n\nfrom django_mailbox.models import Mailbox\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add Day 11 python file\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python3\n\n\npuzzle_input = 'vzbxkghb'\n\n\ndef validate_password(password):\n pass\n\n\ndef test_validate_password():\n assert not validate_password('hijklmmn')\n assert not validate_p... | python | chosen |
[
{
"from": "human",
"value": "Add minimial testing of __main__ module\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_main.py.\n\nBasic testing of hug's `__main__` module\n\nCopyright (C) 2016 Timothy Edmund Crosley\n\nPermission is hereby granted, free of charge, to any person obtaining a copy... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 665. Non-decreasing Array\n\n665. Non-decreasing Array: https://leetcode.com/problems/non-decreasing-array/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def checkPossibility(self, nums):\n \"\"\"\n :type nums: List[i... | python | chosen |
[
{
"from": "human",
"value": "python: Add test for unpacking buffer object.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding: utf-8\n\nfrom nose import main\nfrom nose.tools import *\nfrom msgpack import packb, unpackb\n\ndef test_unpack_buffer():\n from array import array\n ... | python | chosen |
[
{
"from": "human",
"value": "Add new script for welcome messaging\n"
},
{
"from": "gpt",
"value": "\"\"\"\n instabot example\n\n Workflow:\n Welcome message for new followers.\n\"\"\"\n\nimport argparse\nimport os\nimport sys\n\nfrom tqdm import tqdm\n\nsys.path.append(os.path.join(... | python | chosen |
[
{
"from": "human",
"value": "Add fetch recipe for Skia's Buildbot repository.\n\nTested with the following command lines:\n\n$ cd\n$ mkdir skia_test\n$ cd skia_test\n$ fetch skia_buildbot\n$ cd skia_buildbot\n # confirm the repo is what one would expect.\n\nBUG=None\nTEST=see above\nR=agable@chromium.org\n\... | python | chosen |
[
{
"from": "human",
"value": "Add failing funcitonal test for tags\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the dataset tag functionality.\"\"\"\n\nimport pytest\n\nfrom . import tmp_dir_fixture\n\n\ndef test_tags_functional(tmp_dir_fixture):\n\n from dtoolcore import DataSetCreator, DataSe... | python | chosen |
[
{
"from": "human",
"value": "Test qrcode and PIL libraries\n"
},
{
"from": "gpt",
"value": "from PIL import Image\nfrom PIL import ImageFont\nfrom PIL import ImageDraw \nimport qrcode\nqr = qrcode.QRCode(\n version=1,\n error_correction=qrcode.constants.ERROR_CORRECT_L,\n box_size=20,\n... | python | chosen |
[
{
"from": "human",
"value": "Add min and max heap sort\n"
},
{
"from": "gpt",
"value": "__author__ = 'harsh'\n\nLT = 0\nGT = 1\n\n\ndef compare_ele(comp_type, ele1, ele2):\n if comp_type == LT:\n return ele1 < ele2\n elif comp_type == GT:\n return ele1 > ele2\n raise Excep... | python | chosen |
[
{
"from": "human",
"value": "Test new static condensation pc on full mixed-hybrid system\n"
},
{
"from": "gpt",
"value": "from firedrake import *\n\nn = 4\nmesh = UnitSquareMesh(n, n)\nn = FacetNormal(mesh)\nRTd = FunctionSpace(mesh, BrokenElement(FiniteElement(\"RT\", triangle, 1)))\nDG = Funct... | python | chosen |
[
{
"from": "human",
"value": "Add context managers for patching global matrixstore in tests"
},
{
"from": "gpt",
"value": "from contextlib import contextmanager\n\nfrom matrixstore.tests.matrixstore_factory import (\n matrixstore_from_data_factory,\n patch_global_matrixstore,\n)\n\n\n@conte... | python | chosen |
[
{
"from": "human",
"value": "Add WSGI entrypoint for OpenShift\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom form import app as application\n\nif 'OPENSHIFT_DATA_DIR' in os.environ:\n datadir = os.environ['OPENSHIFT_DATA_DIR']\n application.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:... | python | chosen |
[
{
"from": "human",
"value": "Add a script to parse the logs and tabulate the amount of time per dataset\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport datetime\nimport re\nimport sys\nimport time\n\ntimestamp_pattern = r'(?P<timestamp>\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},... | python | chosen |
[
{
"from": "human",
"value": "Add tests for sorted stack\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\nimport unittest\n\nfrom logging_utils._compat import mock\nfrom logging_utils.context.stack.sorted import SortedContextStack\n\n\nclass SimpleContextStackTest(unittest.TestCase):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add tests for binary search tree\n"
},
{
"from": "gpt",
"value": "from bst import BinarySearchTree\n\n\nnodes = [5, 4, 8, 3, 43, 22, 7, 74, 2]\n\n\ndef test_insert_nodes():\n \"\"\"size of tree equal to number of values inserted\"\"\"\n b = BinarySearchTree()\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for new related_name and CASCADE constraints\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2016-10-23 14:41\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import m... | python | chosen |
[
{
"from": "human",
"value": "Add base handler for test resources.\n"
},
{
"from": "gpt",
"value": "# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version... | python | chosen |
[
{
"from": "human",
"value": "test: Add tests for mpi4py.rc function\n"
},
{
"from": "gpt",
"value": "from mpi4py import rc\nimport mpiunittest as unittest\n\nclass TestRC(unittest.TestCase):\n\n def testRC1(self):\n rc(initialize = rc.initialize)\n rc(threaded = rc.threade... | python | chosen |
[
{
"from": "human",
"value": "Add example script for making a multi-variable dot plot\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDot plot with several variables\n===============================\n\n_thumb: .3, .3\n\"\"\"\nimport seaborn as sns\nsns.set(style=\"whitegrid\")\n\n# Load the dataset\ncra... | python | chosen |
[
{
"from": "human",
"value": "Test the dataset from the Fowlkes paper "
},
{
"from": "gpt",
"value": "\"\"\"\nTry to replicate the toy dateset in the paper by Fowlkes et al., \"Spectral Grouping \nUsing the Nystrom Method\" and compute the spectrum. \n\"\"\"\n\n\nimport numpy \nimport scipy.spars... | python | chosen |
[
{
"from": "human",
"value": "Add script for enumerating Randomascii presets\n\nThe startup10.wpaProfile file which ships with UIforETW sets up a\ndefault view which I think is a better introduction to ETW profiling.\nIt needs updating occasionally, and sometimes some of the presets can\nget lost. This scrip... | python | chosen |
[
{
"from": "human",
"value": "Create helper module with slugify function\n"
},
{
"from": "gpt",
"value": "import re\n\n_punct_re = re.compile(r'[\\t !\"#$%&\\'()*\\-/<=>?@\\[\\\\\\]^_`{|},.]+')\n\n\ndef slugify(text, delim=u'-'):\n \"\"\"Generates an ASCII-only slug.\"\"\"\n result = []\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for MDPDialogBuilder\n"
},
{
"from": "gpt",
"value": "import os\n\nimport numpy as np\n\nfrom ..policy import MDPDialogBuilder\n\n\nclass TestMDPDialogBuilder(object):\n\n def setup(self):\n tests_dir = os.path.abspath(os.path.dirname(__file... | python | chosen |
[
{
"from": "human",
"value": "Add API tests for node action\n\nAdd API tests for triggering node action\n\nblueprint tempest-plugin-interface\n\nChange-Id: Iaafdd3190dba9cd5173d676b2010ad3c6f9215a5\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\")... | python | chosen |
[
{
"from": "system",
"value": "Convert map iterator to list (for Python3 support)\n"
},
{
"from": "human",
"value": "\"\"\"EditorConfig version tools\n\nProvides ``join_version`` and ``split_version`` classes for converting\n__version__ strings to VERSION tuples and vice versa.\n\n\"\"\"\n\nimpor... | python | chosen |
[
{
"from": "human",
"value": "lib/geo: Add basic tests for `geographic_distance()`\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom skylines.lib.geo import geographic_distance\nfrom skylines.model.geo import Location\n\n\n@pytest.mark.parametrize(\n \"loc1,loc2... | python | chosen |
[
{
"from": "human",
"value": "Add a function for thread-safe directory creation.\n\nThis is to be used in an upcoming commit.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n# Copyright 2015, NICTA\n#\n# This software may be distributed and modified according... | python | chosen |
[
{
"from": "human",
"value": "Add preliminary tests for profile support and configuration directory\nsupport\n\nNew tests need to be written to see how CommandOptionParser sets up\nits CLI interface and where it'll look for configuration files when\nsetting default_profile and configuration_directory at inst... | python | chosen |
[
{
"from": "human",
"value": "Add script to add old ONS codes to a database containing only the new GSS ones.\n"
},
{
"from": "gpt",
"value": "# This script is for a one off import of all the old ONS codes to a MapIt\n# containing only the new ones from a modern Boundary-Line.\n\nimport csv\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Test for Node()/Host() pty leakage\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nRegression test for pty leak in Node()\n\"\"\"\n\nimport unittest\n\nfrom mininet.net import Mininet\nfrom mininet.clean import cleanup\nfrom mininet.topo import Sin... | python | chosen |
[
{
"from": "human",
"value": "Add a simple GUI input\n"
},
{
"from": "gpt",
"value": "\"\"\"\nPROGRAM SOLIDS\n--------------\n\nComputes the displacement solution for a finite element assembly\nof 2D solids under point loads using as input easy-to-create\ntext files containing element, nodal, mat... | python | chosen |
[
{
"from": "human",
"value": "Add a social_auth wrapper backend around the Google App Engine User API.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nGoogle App Engine support using User API\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom django.contrib.auth import authenticate\n\nfrom social_a... | python | chosen |
[
{
"from": "human",
"value": "Add defective server implementation that randomly loses message characters.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n# vim:fenc=utf-8\n\n\"\"\" Defective XML Server in which every message character has LOSS_PROB chance\n to... | python | chosen |
[
{
"from": "human",
"value": "Add test for freevar in cuda macros\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import\nimport numpy\nfrom numba import cuda\nfrom numba.cuda.testing import unittest\n\n\nclass TestFreeVar(unittest.TestCase):\n def test_freevar... | python | chosen |
[
{
"from": "human",
"value": "Add MockRpc test utility class\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom django.conf import settings\n\nfrom mock import Mock, patch\n\n\nclass MockRpc(object):\n def setUp(self):\n self.response = self.set_response()\n self.request = None... | python | chosen |
[
{
"from": "human",
"value": "Add script to calculate basic corpus statistics\n\n- # of folia files (total and per parliamentary year)\n- text files (total and per perspective)\n"
},
{
"from": "gpt",
"value": "import logging\nimport argparse\nimport glob\n\nfrom cptm.utils.experiment import load_... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Revert \"Homework 3 (Login test developed)\"\"\n\nThis reverts commit 4175bef3bae18fed12eb5ed1cac4d405af2f9613.\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom selenium import webdriver\n\n\n@pytest.fixture\ndef wd(request):\n wd = webdriver.Chrome()... | python | chosen |
[
{
"from": "human",
"value": "Add icekit hero mixins to listing page.\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 ('icekit... | python | chosen |
[
{
"from": "human",
"value": "Add an example of script to upload a Software, using V3.0.0 new Software architecture\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# * Copyright (c) 2009-2020. Authors: see NOTICE file.\n# *\n# * Licensed under the Apache License, Version 2.0 (the \"Li... | python | chosen |
[
{
"from": "human",
"value": "Add tests for service_type API's new policy rules\n\nRelated-blueprint: bp/secure-rbac-roles\nChange-Id: I0cbe260fc786d00b014c804ae74d99c8f9685e88\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2021 Red Hat Inc.\n#\n# Licensed under the Apache License, Version 2.0 ... | python | chosen |
[
{
"from": "human",
"value": "Automate Transfers: Sample pre-transfer to move files to folders\n\nWhile a couple transfer types can accept files as well as folders, other\npre-transfer scripts (eg adding a default processing config) require a\nfolder.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/e... | python | chosen |
[
{
"from": "human",
"value": "Add static method for distance similarity\n"
},
{
"from": "gpt",
"value": "\nclass ClusterDistance(object):\n @staticmethod\n def get_cosine_similarity(tfidf1, tfidf2, length1, length2):\n vector_products = 0\n for ti1 in tfidf1:\n for ... | python | chosen |
[
{
"from": "human",
"value": "Add script to measure usage of immigrant / illegal immigrant\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport ipdb\n#import time\n#import csv\nimport sys\nimport pysolr\nimport dateutil.parser\n\ndef get_word_counts( solr, query, date_str, count=1000 ) :\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.