conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add tests for Dismissibles view\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.urls import reverse\n\nfrom wagtail.test.utils import WagtailTestUtils\nfrom wagtail.users.models import UserProfile\n\n\nclass TestDismissiblesView(TestCas...
python
chosen
[ { "from": "human", "value": "Create Random Forest vectorizer and classifier pickles\n" }, { "from": "gpt", "value": "from sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.externals import joblib\n\nprint \"Grabbing data...\...
python
chosen
[ { "from": "human", "value": "Add the basis for some functional tests\n" }, { "from": "gpt", "value": "from locators import SimpleLocator\n\ndef test_latest_source():\n loc = SimpleLocator()\n proj = 'pip'\n latest = max(loc.versions(proj))\n # We want the first item in the following ...
python
chosen
[ { "from": "human", "value": "Add a basic test template for high level CUDS containers\n" }, { "from": "gpt", "value": "import abc\nfrom functools import partial\n\nfrom simphony.testing.utils import (\n create_data_container, compare_data_containers)\nfrom simphony.core.data_container import ...
python
chosen
[ { "from": "human", "value": "Add a very basis test (just test if messages are output in the right order by all nodes\n\n\n20070605063752-93b9a-171c986a65ac8fcdb791ea4ab34f870f087478dc.gz\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom twisted.internet import reactor\nfrom mesh imp...
python
chosen
[ { "from": "human", "value": "Create dodgy vis of reads sequenced" }, { "from": "gpt", "value": "from matplotlib import pyplot as plt\n\ns=[\"AATTCGCGCTTACGCTAGGCTAGCTAGGCTCGATTCGAGGCTCGGGATCGATCGGTACGAGGTACGTACTGACTGACT\",\n \"ACTGGGCTATGCGGGATATATATATCGCGACTGACATGCATGCTAGGCGCGCTATAATCGGCGCATAT...
python
chosen
[ { "from": "human", "value": "Add api-reference generation script for TFMD.\n\nOutput listing: https://paste.googleplex.com/4777420088410112\n\nPiperOrigin-RevId: 431509556\n" }, { "from": "gpt", "value": "# Copyright 2022 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apac...
python
chosen
[ { "from": "human", "value": "Set2: Add hasing on string input game\n" }, { "from": "gpt", "value": "# This is a hack to make sure Python 2.x and 3.x behave the same\n# You can ignore this bit\ntry:\n input = raw_input\nexcept NameError:\n pass\n\n# Real program starts here\ndef hash(string...
python
chosen
[ { "from": "human", "value": "Add test for Profile PATCH method\n" }, { "from": "gpt", "value": "import requests\nimport json\nimport time\nfrom collections import OrderedDict\nfrom test_framework.test_framework import OpenBazaarTestFramework, TestFailure\n\n\nclass PatchProfileTest(OpenBazaarTes...
python
chosen
[ { "from": "human", "value": "Implement common group setup for CLI\n" }, { "from": "gpt", "value": "\"\"\"Command line interface to the package.\"\"\"\n\nimport curses\nfrom logging import ERROR, INFO\n\nimport click\n\nfrom . import _, log\nfrom .curse import Game\nfrom .util import default_data...
python
chosen
[ { "from": "human", "value": "Add utilities to integrate with Sentry\n" }, { "from": "gpt", "value": "\"\"\"\nbyceps.util.sentry\n~~~~~~~~~~~~~~~~~~\n\nSentry_ integration\n\n.. _Sentry: https://sentry.io/\n\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for deta...
python
chosen
[ { "from": "human", "value": "Add py solution for 398. Random Pick Index\n\n398. Random Pick Index: https://leetcode.com/problems/random-pick-index/\n" }, { "from": "gpt", "value": "from random import random\nclass Solution(object):\n\n def __init__(self, nums):\n \"\"\"\n :type ...
python
chosen
[ { "from": "human", "value": "Add py solution for 598. Range Addition II\n\n598. Range Addition II: https://leetcode.com/problems/range-addition-ii/\n" }, { "from": "gpt", "value": "from operator import itemgetter\nclass Solution(object):\n def maxCount(self, m, n, ops):\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add start of top blocks\n" }, { "from": "gpt", "value": "from collections import namedtuple\nimport random\n\nW = 800\nH = 600\nRED = 200, 0, 0\nBLUE = 0, 0, 200\nGREEN = 0, 200, 0\n\nball = Rect((W/2, H/2), (30, 30))\nDirection = namedtuple('Direction', 'x y')\nball...
python
chosen
[ { "from": "human", "value": "Add a standalone DDL print/reflection tool.\n" }, { "from": "gpt", "value": "\"\"\"\nutexas/tools/generate_ddl.py\n\nPrint or apply the research data schema.\n\n@author: Bryan Silverthorn <bcs@cargo-cult.org>\n\"\"\"\n\nif __name__ == \"__main__\":\n from utexas.t...
python
chosen
[ { "from": "human", "value": "Make an easy thing to enqueue repos.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\n\"\"\"\nenqueues respos from stdin or from command line arguments\n\"\"\"\n\nimport argparse\nimport re\nimport sys\nfrom typing import Iterator\n...
python
chosen
[ { "from": "system", "value": "Include package files when installing from PyPI\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='django-simple-history',\n version='1.2.2.post1',\n description='Store model history and view/revert changes fr...
python
chosen
[ { "from": "human", "value": "Test script with Python Functions\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n# some experiments with functions\n\ndef my_values(value1):\n\tprint (\"Value of value1 in function my_values: %s\" % value1)\n\tprint (\"Value of value2 in function my_values: %s\...
python
chosen
[ { "from": "human", "value": "Make ticker symbols lower case\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"\nRetrieves current list of ticker symbols that are in portfolio.\nAll symbols are in lower-case.\n\"\"\"\n\n#TODO: Get portfolio list from a text file.\n#TODO: Handle comm...
python
chosen
[ { "from": "human", "value": "Add unit test for merge sort implementation.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport unittest\n\nfrom helper.read_data_file import read_int_array\nfrom sorting.merge_sort import sort\n\n\nBASE_DIR = os.path...
python
chosen
[ { "from": "human", "value": "Add the data model of Shopcart\n" }, { "from": "gpt", "value": "class Shopcart(object):\n\n \"\"\"\n This is model for the shop carts\n Assumptions:\n - In memory persistence\n - The fields of a shopcart include:\n - user id\n ...
python
chosen
[ { "from": "human", "value": "Add minimal standalone code to test Cheb weights negativity\n" }, { "from": "gpt", "value": "import numpy as np\nfrom scipy.interpolate import lagrange\n\ndef chebNodes(N):\n \"Returns N Chebyshev nodes in (-1,1).\"\n return np.array([np.cos(\n np.pi * (...
python
chosen
[ { "from": "human", "value": "Add script to find removables from PubChem\n" }, { "from": "gpt", "value": "\"\"\"This script helps identify entries in PubChem.tsv that systematically\nlead to incorrect groundings and should therefore be removed.\"\"\"\n\nimport os\nimport re\nfrom indra.databases ...
python
chosen
[ { "from": "human", "value": "Add Event filter and Node\n" }, { "from": "gpt", "value": "import graphene\nfrom graphene_django import DjangoObjectType\nfrom django_filters import OrderingFilter, FilterSet\n\nfrom app.timetables.models import Event\nfrom .timetable_crud import TimetableNode\n\n\nc...
python
chosen
[ { "from": "human", "value": "Add first implementation of pytorch backend\n\nSigned-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>\n" }, { "from": "gpt", "value": "\"\"\"\nModule containing functions to differentiate functions using pytorch.\n\"\"\"\ntry:\n import tor...
python
chosen
[ { "from": "human", "value": "Add template tag for experiment group membership\n" }, { "from": "gpt", "value": "from django import template\n\nfrom ..base import EXPERIMENTS\n\nregister = template.Library()\n\n@register.filter\ndef experiment(user, experiment, group='experiment'):\n return EXP...
python
chosen
[ { "from": "human", "value": "Add helper script for hand_follow\n" }, { "from": "gpt", "value": "import poppy_inverse_kinematics.creature as model_creature\nimport numpy as np\nimport poppy_inverse_kinematics.meta_creature as meta_creature\nimport time\n\n# parameters\nactivate_follow = True\nint...
python
chosen
[ { "from": "human", "value": "Add a test for global minimize wrapper.\n" }, { "from": "gpt", "value": "import downhill\nimport numpy as np\nimport theano\n\n\nclass TestMinimize:\n def test_minimize(self):\n x = theano.shared(-3 + np.zeros((2, ), 'f'), name='x')\n data = downhill...
python
chosen
[ { "from": "human", "value": "Add example script that prints a histogram of inclinations\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nPrints a histogram of inclinations to show what proportion are high-angle.\n\nusage: compass_high_angle_hist.py DATFILE...\n\"\"\"\n\nimport sys...
python
chosen
[ { "from": "human", "value": ":memo: Add migration file for samples app\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2017-05-26 20:18\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n...
python
chosen
[ { "from": "human", "value": "Create an init file with meta information\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n__author__ = 'Raphael Pierzina'\n__email__ = 'raphael@hackebrot.de'\n__version__ = '0.1.0'\n\nfrom .parser import parse_string\n\n__all__ = ['parse_string']\n" } ]
python
chosen
[ { "from": "human", "value": "Add test for commitlog archiving\n" }, { "from": "gpt", "value": "from dtest import Tester, debug\nfrom pytools import since, replace_in_file\nimport tempfile, shutil, glob, os, time\nimport distutils.dir_util\n\n\nclass CommitLogArchivingTest(Tester):\n def __ini...
python
chosen
[ { "from": "human", "value": "Add a command to verify users\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom api.models import Account\nimport fileinput\nimport sys\n\nclass Command(BaseCommand):\n can_import_settings = True\n\n def ha...
python
chosen
[ { "from": "human", "value": "Add WSGI script for API server\n\nInclude a WSGI script for the API server so it can be used with Apache\nor Nginx deployment.\n\nChange-Id: I16166f78b5975dad0480a7ee4ccde47f234f5802\nImplements: blueprint mistral-api-wsgi-script\n" }, { "from": "gpt", "value": "# Co...
python
chosen
[ { "from": "human", "value": "Add script for munging redirects\n" }, { "from": "gpt", "value": "\"\"\"\nA simple script to filter the output of the redirects spreadsheet we made into\na CSV suitable for loading into the redirects app with\n\n python manage.py import_redirects_csv ...\n\nUsage:...
python
chosen
[ { "from": "system", "value": "Index only latest by default.\n" }, { "from": "human", "value": "import logging\n\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\n\nfrom projects import tasks\nfrom projects.models import ImportedFile\nfrom builds.models imp...
python
chosen
[ { "from": "human", "value": "Add script to generate AT bank registry\n" }, { "from": "gpt", "value": "import json\nimport csv\nimport requests\n\nURL = \"https://www.oenb.at/docroot/downloads_observ/sepa-zv-vz_gesamt.csv\"\n\n\ndef process():\n registry = []\n with requests.get(URL, stream...
python
chosen
[ { "from": "human", "value": "Add a test for the validate-collated script\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# ###\n# Copyright (c) 2016, Rice University\n# This software is subject to the provisions of the GNU Affero General\n# Public License version 3 (AGPLv3).\n# See LIC...
python
chosen
[ { "from": "human", "value": "Add a test runner for simExample.\n" }, { "from": "gpt", "value": "from os.path import dirname, realpath, sep, pardir\nimport sys\nsys.path.append(dirname(realpath(__file__)) + sep + pardir + sep +\n \"examples\")\nimport simExample\n\ndef test_sim():\n si...
python
chosen
[ { "from": "human", "value": "Move api tests to test dir\n" }, { "from": "gpt", "value": "import os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"api.api.settings\")\n\nimport django\nfrom django.test import TestCase\nfrom rest_framework.test import APIRequestFactory\n\nfrom api.webview.vi...
python
chosen
[ { "from": "human", "value": "Add profile reader plug-in type\n\nThis type of plug-in will load a file as an instance container of the user profile type.\n\nContributes to issue CURA-1278.\n" }, { "from": "gpt", "value": "# Copyright (c) 2016 Ultimaker B.V.\n# Cura is released under the terms of ...
python
chosen
[ { "from": "human", "value": "Add reading and plotting of .ans files\n" }, { "from": "gpt", "value": "import subprocess\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport re\nimport math\nfrom scipy.interpolate import griddata\n\nclass FEMMans:\n def __init_...
python
chosen
[ { "from": "human", "value": "Save As - add TimeoutAlert example\n" }, { "from": "gpt", "value": "import gtk\nfrom sugar.graphics.alert import TimeoutAlert\n\nwindow = gtk.Window()\n\nbox = gtk.VBox()\nwindow.add(box)\n\ndef _timeout_alert_response_cb(alert, response_id):\n if response_id is g...
python
chosen
[ { "from": "human", "value": "Add basic unit tests for Win7 specific platform\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in com...
python
chosen
[ { "from": "human", "value": "Fix path where findAndReplaceWorkspacePath doesn't\n\nWhen data has moved to a different workspace AND feature dataset the\nregular\n`findAndReplaceWorkspacePath` does not work. This script rectifies that.\n" }, { "from": "gpt", "value": "'''\nTool: Change Datasou...
python
chosen
[ { "from": "human", "value": "Add example for basic auth\n" }, { "from": "gpt", "value": "import aiohttp\nimport asyncio\n\n\n@asyncio.coroutine\ndef go(session):\n print('Query http://httpbin.org/basic-auth/andrew/password')\n resp = yield from session.get(\n 'http://httpbin.org/bas...
python
chosen
[ { "from": "system", "value": "Create the Subscriber Form - Part II > Update the Form\n" }, { "from": "human", "value": "from django import forms\nfrom django.contrib.auth.forms import UserCreationForm\n\nclass SubscriberForm(UserCreationForm):\n email = forms.EmailField(\n required=Tru...
python
chosen
[ { "from": "human", "value": "Add abstract class for step management\n" }, { "from": "gpt", "value": "\n# -*- coding: utf-8 -*-\n\n# std import\nfrom enum import Enum\nfrom abc import ABCMeta, abstractmethod\n\nclass StepStat(Enum):\n nostat = 1\n load = 2\n no_ready = 3\n ready = 4\n...
python
chosen
[ { "from": "human", "value": "Print to the screen how many bpm devices are disabled\n" }, { "from": "gpt", "value": "import pytac.load_csv\nimport pytac.epics\n\n\ndef main():\n lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem())\n bpms = lattice.get_elements('BPM')\n\n ...
python
chosen
[ { "from": "human", "value": "Add test case around field type validation\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom polygraph.exceptions import PolygraphSchemaError\nfrom polygraph.types.field import (\n field,\n validate_field_types,\n validate_method_annotat...
python
chosen
[ { "from": "human", "value": "Add edit distance algorithm in python\n" }, { "from": "gpt", "value": "# Helpful tutorial: https://www.youtube.com/watch?v=We3YDTzNXEk\n# Useful link: https://en.wikipedia.org/wiki/Edit_distance\ndef get_edit_distance(s1, s2):\n\n l1 = len(s1) + 1\n l2 = len(s2...
python
chosen
[ { "from": "human", "value": "doc: Add docs for structure of JSON for HTML\n" }, { "from": "gpt", "value": "\"\"\"Documentation of the JSON representing HTML.\"\"\"\n\n# an html element\nELEMENT = {\n \"type\": \"element\",\n \"name\": \"\", # name of HTML tag\n \"attrs\": {}, # d...
python
chosen
[ { "from": "system", "value": "Remove duplicate trove classifier for Python\n\nAlphabetize list to help catch potential future duplication.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\nfrom setuptools import setup\n\n\ndef read(fname):\n with open(os.path.join(os.pa...
python
chosen
[ { "from": "system", "value": "Add Python 3.5 trove classifier\n" }, { "from": "human", "value": "from setuptools import setup\n\n\ndef fread(fn):\n return open(fn, 'rb').read().decode('utf-8')\n\nsetup(\n name='tox-travis',\n description='Seamless integration of Tox into Travis CI',\n ...
python
chosen
[ { "from": "human", "value": "Add some example model - simple network on MNIST.\n\nA basic example from Keras - https://github.com/fchollet/keras/tree/master/examples\n" }, { "from": "gpt", "value": "'''Trains a simple deep NN on the MNIST dataset.\n\nGets to 98.40% test accuracy after 20 epochs\...
python
chosen
[ { "from": "human", "value": "Add unit tests for as_pair\n" }, { "from": "gpt", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nTests for the parameters module.\n\"\"\"\n\nimport numpy as np\nfrom numpy.testing import assert_equal\nimport pytest\n\nfrom .._param...
python
chosen
[ { "from": "human", "value": "Create test cases for the cryptotracker plugin\n" }, { "from": "gpt", "value": "import unittest\nfrom colorama import Fore\nfrom tests import PluginTest\nfrom mock import patch\nfrom plugins import cryptotracker\n\n\nclass TestCryptotracker(PluginTest):\n \"\"\"\n...
python
chosen
[ { "from": "human", "value": "Add an RENotFound exception class to be raised when we cannot locate a required resource on RE\n" }, { "from": "gpt", "value": "import json\n\n\nclass RENotFound(RuntimeError):\n \"\"\"A resource was not found on the relation engine.\"\"\"\n\n def __init__(self...
python
chosen
[ { "from": "human", "value": "Add test suite for hiro.utils\n" }, { "from": "gpt", "value": "import datetime\nimport unittest\n\nimport hiro\nfrom hiro.errors import InvalidTypeError\nfrom hiro.utils import timedelta_to_seconds, time_in_seconds, chained\n\n\nclass TestTimeDeltaToSeconds(unittest....
python
chosen
[ { "from": "human", "value": "Add arg parsing for parallel tmhmm script\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n#-*- coding: utf-8 -*-\n\"\"\"\nScript to process tmhmm in parallel\n\"\"\"\n\nfrom Bio import SeqIO\n\nimport argparse\nimport os\nimport sys\nimport multiprocessing\n...
python
chosen
[ { "from": "human", "value": "Add task for rounding of money\n" }, { "from": "gpt", "value": "def get_price_without_vat(price_to_show, vat_percent):\n raise NotImplementedError()\n\n\ndef get_price_without_vat_from_other_valuta(conversion_rate, origin_price,\n ...
python
chosen
[ { "from": "human", "value": "Implement DTDA as TRIPS module\n" }, { "from": "gpt", "value": "from jnius import autoclass, cast\nfrom TripsModule import trips_module\n\nKQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative')\nKQMLList = autoclass('TRIPS.KQML.KQMLList')\nKQMLObject = autoclass...
python
chosen
[ { "from": "human", "value": "Create the serializer for the AbstractAccount\n" }, { "from": "gpt", "value": "from rest_framework import serializers\nfrom .models import AbstractAccount\n\n\nclass WholeAccountSerializer(serializers.ModelSerializer):\n password = serializers.CharField(write_only...
python
chosen
[ { "from": "human", "value": "Add script to occupy a seat group with a ticket bundle\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Occupy a seat group with a ticket bundle.\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Fix Bug for Nonetype ROI\n" }, { "from": "human", "value": "import cv2\nimport numpy as np\nimport plantcv as pcv\n\n\ndef white_balance(img, roi=None):\n\n \"\"\"Corrects the exposure of an image based on its histogram.\n Inputs:\n img - A grayscale image ...
python
chosen
[ { "from": "human", "value": "Add a test for -- terminating option processing.\n\n\ngit-svn-id: 7892167f69f80ee5d3024affce49f20c74bcb41d@48 fdb21ef1-2011-0410-befe-b5e4ea1792b1\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n__revision__ = \"test/option-n.py __REVISION__ __DATE__ __DEVE...
python
chosen
[ { "from": "system", "value": "Fix accidentally commited attribute name change\n" }, { "from": "human", "value": "from typing import Dict, Any\n\nimport attr\n\n\n@attr.s(slots=True)\nclass Rule:\n \"\"\"\n A rule describes how and when to make backups.\n \"\"\"\n\n volume_name = attr...
python
chosen
[ { "from": "human", "value": "Add test for `license context` function\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n Tests for the `license context` function\n\"\"\"\n\nfrom click.testing import CliRunner\n\nfrom choosealicense.main import (context,...
python
chosen
[ { "from": "human", "value": "Add data migration to deduplicate users\n" }, { "from": "gpt", "value": "\"\"\"\ndeduplicate users\n\nRevision ID: c519ecaf1fa6\nRevises: a6ff4a27b063\nCreate Date: 2018-09-26 16:45:13.810694\n\"\"\"\n# from alembic import op\n\nimport sqlalchemy as sa\n\n\n# Revisio...
python
chosen
[ { "from": "human", "value": "Support for Cached template loader with django adaptive\n" }, { "from": "gpt", "value": "\"\"\"\nProvide support for Cached loader.\nGenerate key for cached templates based on template names\nand device type (desktop or mobile or tablet)\n\"\"\"\nfrom django.template...
python
chosen
[ { "from": "human", "value": "Add automatic migration for dashboard changes.\n\nMigrations for 'dashboard_app':\n 0002_auto_20140917_1935.py:\n - Alter field is_deserialized on bundle\n - Alter field is_anonymous on bundlestream\n - Alter field time_check_performed on testrun\n\nChange-Id: I2627c0b...
python
chosen
[ { "from": "human", "value": "Add basic tests for simpleflow.exceptions.TaskFailed\n" }, { "from": "gpt", "value": "import unittest\n\nfrom sure import expect\n\nfrom simpleflow.exceptions import TaskFailed\n\n\nclass TestTaskFailed(unittest.TestCase):\n def test_task_failed_representation(sel...
python
chosen
[ { "from": "human", "value": "Add file to epsilon tests\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rule, EPS\nfrom .gramma...
python
chosen
[ { "from": "human", "value": "Add script for reading reldist for multiple trials\n" }, { "from": "gpt", "value": "import os\nimport yaml\nfrom thermof.parameters import plot_parameters\nfrom thermof.read import read_framework_distance\n\n# ---------------------------------------------------------...
python
chosen
[ { "from": "human", "value": "Add a simple functional tests for jenkins: check config-* jobs\n\nChange-Id: I41f880e55fe380273ed614944bc4523278501252\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>\n#\n# Licensed under the Apache Li...
python
chosen
[ { "from": "human", "value": "Add unit test for exceptions\n" }, { "from": "gpt", "value": "import pytest\n\nfrom .. import exceptions as e\n\n\ndef test_shape_error():\n raise_if(e.ShapeError.dimensions_mismatch(10, 20, 'inside test'))\n\n\ndef raise_if(e):\n if e is not None:\n rai...
python
chosen
[ { "from": "human", "value": "Admin: Add missed wizard spec setting definition\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.\n#\n# This source code is licensed under the AGPLv3 licens...
python
chosen
[ { "from": "human", "value": "Send try jobs that touch policy code to the linux_chromeos bot too.\n\n\nReview URL: https://chromiumcodereview.appspot.com/10473015\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@140268 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "gpt", "value": "#...
python
chosen
[ { "from": "human", "value": "Revert change from services to products for G9 lots\n\nJust when I thought I was out, they pull me back in.\n" }, { "from": "gpt", "value": "\"\"\"no lots are products for G-Cloud 9 - they are all services\n\nRevision ID: 820\nRevises: 810\nCreate Date: 2017-02-01 11...
python
chosen
[ { "from": "human", "value": "[NF] Read spectro from excel file with orders as input\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom pandas import ExcelFile, read_excel\nfrom numpy import squeeze, zeros, transpose\n\ndef read_spectro_xls(file_name):\n \"\"\"Read spectrogram as a...
python
chosen
[ { "from": "human", "value": "Add extension attribute table type\n" }, { "from": "gpt", "value": "from numba.typesystem import *\n\n#------------------------------------------------------------------------\n# Extension Attributes Type\n#------------------------------------------------------------...
python
chosen
[ { "from": "human", "value": "Allow running the `edb` command as `python -m edb.tools`\n" }, { "from": "gpt", "value": "#\n# This source file is part of the EdgeDB open source project.\n#\n# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.\n#\n# Licensed under the Apache License, Ve...
python
chosen
[ { "from": "human", "value": "Develop here. Belongs in top level Orthologs Project.\n" }, { "from": "gpt", "value": "\nfrom setuptools import setup, find_packages\n# To use a consistent encoding\nfrom codecs import open\nfrom os import path\n\nhere = path.abspath(path.dirname(__file__))\nPACKAGE...
python
chosen
[ { "from": "human", "value": "Add django 1.11 user migration to helevents\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.5 on 2017-09-15 12:29\nfrom __future__ import unicode_literals\n\nimport django.contrib.auth.validators\nfrom django.db import migrations,...
python
chosen
[ { "from": "system", "value": "Use exit_fail hl group for last_status segment\n\nFixes #270\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom powerline.theme import requires_segment_info\n\n\n@requires_segment_info\ndef last_status(segment_info):\n\t'''Return last exit code.'''\n...
python
chosen
[ { "from": "human", "value": "Add management command that empty search columns\n" }, { "from": "gpt", "value": "import logging\n\nfrom django.core.management.base import BaseCommand\nfrom munigeo.models import Address, AdministrativeDivision\n\nfrom services.models import Service, ServiceNode, Un...
python
chosen
[ { "from": "system", "value": "Fix typo that made private notes viewable by any other user.\n" }, { "from": "human", "value": "#\n# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU Affero...
python
chosen
[ { "from": "human", "value": "Add an unit test for vim.py\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom code2html.vim import vim_command\n\n\nclass VimCommandTest(unittest.TestCase):\n def test_vim_command(self):\n vimrc_file = '/tmp/temporary-vimrc...
python
chosen
[ { "from": "human", "value": "Add tests to validate vendor tornado usage\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Import Python libs\nfrom __future__ import absolute_import, unicode_literals\nimport os\nimport re\nimport logging\n\n\n# Import Salt Testing libs\nfrom tests.suppo...
python
chosen
[ { "from": "human", "value": "Implement validate frame range, as optional\n" }, { "from": "gpt", "value": "import pyblish.api\n\n\nclass ValidateMindbenderFrameRange(pyblish.api.InstancePlugin):\n \"\"\"Animation should normally be published with the range for a shot\"\"\"\n\n label = \"Val...
python
chosen
[ { "from": "human", "value": "[sql] Add operator module, which contains the base class for an Operator token.\n" }, { "from": "gpt", "value": "\"\"\"\nOperators - stuff like `column = 'value'`, and similar.\n\"\"\"\nimport abc\n\nfrom katagawa.sql import Token\nfrom katagawa.sql.dialects.common i...
python
chosen
[ { "from": "human", "value": "Add a script to print the ZK tree\n\nThis script uses a nodepool config file to connect to ZK and print\nthe entire contents of the ZK tree for debugging purposes.\n\nChange-Id: I31566e15d915e701639325f757d1b917ad93c780\n" }, { "from": "gpt", "value": "#!/usr/bin/env...
python
chosen
[ { "from": "human", "value": "Add failing test for desired behavior\n" }, { "from": "gpt", "value": "from django.test import override_settings\n\nfrom corehq import privileges\nfrom corehq.apps.accounting.models import SoftwarePlanEdition\nfrom corehq.apps.accounting.tests.base_tests import BaseA...
python
chosen
[ { "from": "system", "value": "Expand user in the path.\n" }, { "from": "human", "value": "import os\n\nfrom lib.base import DockerBasePythonAction\n\n\n__all__ = [\n 'DockerBuildImageAction'\n]\n\n\nclass DockerBuildImageAction(DockerBasePythonAction):\n def run(self, dockerfile_path, tag)...
python
chosen
[ { "from": "human", "value": "Add use case of spider with limits\n" }, { "from": "gpt", "value": "# coding: utf-8\nimport setup_script\nfrom grab.spider import Spider, Task\nimport logging\n\nclass TestSpider(Spider):\n def task_generator(self):\n yield Task('initial', url='http://googl...
python
chosen
[ { "from": "human", "value": "Add script to fetch lon/lat from DBPedia.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nScript to fetch DBpedia data\n\"\"\"\n\nimport sys, time\nfrom urllib.request import urlopen\nfrom urllib.parse import unquote\nimport json\n\ndef main():\n f...
python
chosen
[ { "from": "human", "value": "Add unit tests to check for CONF getattr during import\n\nSince the early days in tempest we've been fighting getattrs on CONF\nduring imports. We're able to get around this during test runs by lazy\nloading the conf file. However, in things like the tempest commands this\ndoesn...
python
chosen
[ { "from": "human", "value": "Add test for base spmatrix\n" }, { "from": "gpt", "value": "import unittest\n\nimport scipy.sparse\n\nimport cupy.sparse\nfrom cupy import testing\n\n\nclass DummySparseCPU(scipy.sparse.spmatrix):\n\n def __init__(self, maxprint=50, shape=None, nnz=0):\n su...
python
chosen
[ { "from": "human", "value": "Add custom dm upload script to be used by the android framework\n\nReview URL: https://codereview.chromium.org/979153002\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Copyright 2014 The Chromium Authors. All rights reserved.\n# Use of this source code is ...
python
chosen
[ { "from": "human", "value": "Add unit tests for Euronews plugin\n" }, { "from": "gpt", "value": "import unittest\n\nfrom streamlink.plugins.euronews import Euronews\n\n\nclass TestPluginEuronews(unittest.TestCase):\n def test_can_handle_url(self):\n # should match\n self.assertT...
python
chosen