conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Modify caget method to convert to values using a list\n\nAlso refactoring some of the variables names.\n" }, { "from": "gpt", "value": "import pkg_resources\npkg_resources.require('aphla')\nimport aphla as ap\n\n# Load the machine\nap.machines.load('SRI21')\nsri21_pv...
python
chosen
[ { "from": "human", "value": "Test the call_attribute utility method.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport datetime\nimport pytest\n\nfrom components.correlations.utils import call_attributes\n\nFIELDS = ['started']\n\n\ndef test_successful_attribute_call():\n class...
python
chosen
[ { "from": "human", "value": "Add quick POC of ICallInterceptor to COM samples\n" }, { "from": "gpt", "value": "import windows\nimport windows.generated_def as gdef\nfrom windows import winproxy\n\n# POC of ICallInterceptor\n# Based on works by Pavel Yosifovich\n# http://blogs.microsoft.co.il/pav...
python
chosen
[ { "from": "human", "value": "Add print view hierarchy command.\n" }, { "from": "gpt", "value": "\"\"\"Prints the current view hierarchy.\n\nUsage: pv\n\"\"\"\ndef print_view_hierarchy(debugger, command, result, internal_dict):\n debugger.HandleCommand('po [[UIWindow keyWindow] recursiveDescript...
python
chosen
[ { "from": "human", "value": "Add command to message everybody.\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nimport persistent_messages\n\nclass Command(BaseCommand):\n help = \"Sends a message to all users...
python
chosen
[ { "from": "human", "value": "Create StorageApi inspired by clock-bot one\n" }, { "from": "gpt", "value": "from bot.storage.async.scheduler import StorageScheduler\nfrom bot.storage.data_source.data_source import StorageDataSource\n\n\nclass StorageApi:\n def __init__(self, data_source: Storag...
python
chosen
[ { "from": "human", "value": "Add a management command to purge a rabbitmq queue\n\nThis is useful in debugging when you just want to discard all the\nmessages in a queue because they have the wrong structure.\n\n(imported from commit 8559ac74f11841430b4d0c801d5506ebcb74c3eb)\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "human", "value": "Add US bank routing transit numbers\n" }, { "from": "gpt", "value": "# rtn.py - functions for handling banking routing transit numbers\n#\n# Copyright (C) 2014 Lifealike Ltd\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the te...
python
chosen
[ { "from": "system", "value": "Add test which detects the UnicodeDecodeError from pip\n\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 4095: unexpected end of data\nhttps://github.com/mathiasertl/fabric/issues/5\n" }, { "from": "human", "value": "from __future__ import with...
python
chosen
[ { "from": "human", "value": "Create mask file outlining map extents\n" }, { "from": "gpt", "value": "import numpy as np\nimport aplpy\nimport matplotlib.pyplot as plt\nfrom astropy.io import fits\nfrom config import plottingDictionary\n\ndef mask_obs_area(rms_data):\n rms_data[np.isfinite(rms...
python
chosen
[ { "from": "human", "value": "Add initialisation script to add the admin user.\n" }, { "from": "gpt", "value": "import getpass\nimport hashlib\nfrom pymongo import MongoClient\n\nspider_db = MongoClient().spider\n\nadmin_present = False\nfor user in spider_db.auth.find():\n if user[\"username\...
python
chosen
[ { "from": "human", "value": "hooks: Add a hook to limit the size of any individual file\n" }, { "from": "gpt", "value": "from mercurial import context\nfrom mercurial.i18n import _\n\n'''\n[extensions]\nhgfilesize=~/m5/incoming/util/hgfilesize.py\n\n[hooks]\npretxncommit = python:hgfilesize.limi...
python
chosen
[ { "from": "human", "value": "Add towers of hanoi implementation\n\nSolves the tower of hanoi game for 3 disks." }, { "from": "gpt", "value": "def hanoi(disks, source, helper, target):\n if disks >= 1:\n # Move n-1 disks from source to helper\n hanoi(disks - 1, source, target, he...
python
chosen
[ { "from": "human", "value": "Add script for parse. Not completed, but commit for move branch.\n" }, { "from": "gpt", "value": "\nimport re\nfrom app.module.shogi import Koma\n\nclass ParseInput:\n self.koma_names = [\n \"歩\",\n \"と\",\n \"香\",\n \"香車\",\n \"...
python
chosen
[ { "from": "human", "value": "Add SgSession - a meta class for a query instance\n" }, { "from": "gpt", "value": "\"\"\"A class for SQLGitHub sessions.\n\nSample Usage:\n g = Github(token)\n s = SgSession(g, [\"name\", \"description\"], \"abseil.repos\")\n print(s.Execute())\n\"\"\"\n\nim...
python
chosen
[ { "from": "human", "value": "Add program to rename files automatically\n" }, { "from": "gpt", "value": "import os\nimport shutil\nimport sys\n\ndef fullpath_names(root_dir, file_list):\n \"\"\"Create a list of fullpath file-name\n \"\"\"\n fullpath_list = []\n for i in file_list:\n ...
python
chosen
[ { "from": "human", "value": "Add plugin for handling command permissions\n" }, { "from": "gpt", "value": "from parser import parse_prefix\n\nclass Limit_Plugin:\n \"\"\" Plugin to control which users can use which commands.\n \"\"\"\n\n def __init__(self, mib, params=None):\n sel...
python
chosen
[ { "from": "human", "value": "Add new test script that calls multiprocessing.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals, with_statement\n\nfrom mpi4py import MPI\n\nimport sys\nimport os\nimport num...
python
chosen
[ { "from": "human", "value": "Create the plugin based on PyScanPrev conftest.py\n" }, { "from": "gpt", "value": "\"\"\"Py.test doctest custom plugin\"\"\"\n# By Danilo J. S. Bellini\nimport sys, functools\n\ndef printer(value):\n \"\"\"Prints the object representation using the given custom fo...
python
chosen
[ { "from": "human", "value": "Add code for evaluating a hand. Incomplete.\n" }, { "from": "gpt", "value": "from collections import defaultdict\n\n#ranks. Add (rank of cards involved / 13) to these values\n#for straights and flushes, (highest card / 13) is added\n###########\nhand_str_dict = {\n ...
python
chosen
[ { "from": "human", "value": "Add failing unit test for query_intent to test RequestType reprompt\n" }, { "from": "gpt", "value": "from _ebcf_alexa import interaction_model as im\nfrom _ebcf_alexa.incoming_types import Intent\nimport pytest\n\n@pytest.fixture\ndef intent_with_bad_slots():\n re...
python
chosen
[ { "from": "human", "value": "Add general base64 formatting test\n" }, { "from": "gpt", "value": "import datetime\nfrom borica import Request\n\n\nclass FakeSignature:\n def sign(self, content):\n return 'G' * 128\n\n\ndef test_general_request_base64_formatting():\n request = Request...
python
chosen
[ { "from": "human", "value": "Mark orders older then 5 days that are still 'new' as 'failed'. This\nfixed rewards that are showed as \"claimed\", because old order were not\nfailed automatically.\n\nBB-10849 #resolve\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django ...
python
chosen
[ { "from": "human", "value": "Add a tool for running pylint on Jinja templates.\n\nCloses JIRA CAMKES-315\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''\nRun pylint on a Jinja 2 template.\n'''\n\nimport jinja2, os, subprocess, sys, tempfile\n\n# Clagged pieces from the runner.\nSTA...
python
chosen
[ { "from": "human", "value": "Add a tool to import Markdown from srweb\n" }, { "from": "gpt", "value": "import argparse\nimport yaml\nimport sys\nimport re\n\nparser = argparse.ArgumentParser()\nparser.add_argument('source', help='Path to source file',\n type=argparse...
python
chosen
[ { "from": "human", "value": "Add AWS disk integration tests\n" }, { "from": "gpt", "value": "# Copyright 2015 Google Inc. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may ob...
python
chosen
[ { "from": "human", "value": "Test for radio buttons in lists\n" }, { "from": "gpt", "value": "import gobject\nimport gtk\nfrom kiwi.ui.widgets.list import Column, List\n\nclass Object:\n def __init__(self, name, value): \n self.name, self.value = name, value\n\ncolumns = [Column('name'...
python
chosen
[ { "from": "human", "value": "Add proxy rax example for terran\n" }, { "from": "gpt", "value": "import random\n\nimport sc2\nfrom sc2 import Race, Difficulty, ActionResult\nfrom sc2.constants import *\nfrom sc2.player import Bot, Computer\n\nclass ProxyRaxBot(sc2.BotAI):\n async def on_step(se...
python
chosen
[ { "from": "system", "value": "Improve classifiers, version and url\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:\n README = readme.read()\n\n# allow setup.py to be run fr...
python
chosen
[ { "from": "human", "value": "[RM-11742] Add initial argparse tests for install\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n" }, { "from": "gpt", "value": "import pytest\n\nfrom ceph_deploy.cli import get_parser\n\n\nclass TestParserInstall(object):\n\n ...
python
chosen
[ { "from": "human", "value": "Add script to diff installed R packages\n\nUsed to check if all the R packages in the current\nR hub image are present in the new R hub image.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\"\"\"\nLists R packages in one docker image but not the other\n\"\...
python
chosen
[ { "from": "human", "value": "Add a brutal (but fast) script for clearing *all* annotations from all projects\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n# This is a small helper script to remove all annotations from a\n# project.\n\n# You may need to install psycopg2, e.g. with:\n# s...
python
chosen
[ { "from": "system", "value": "Fix for missing username and clear the social_auth to force re-authentication at next login." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n#import datetime\n\nfrom celery import task\n\nfrom django.contrib.auth import get_user_model\n\n...
python
chosen
[ { "from": "human", "value": "Add settings file for launching tests\n" }, { "from": "gpt", "value": "# runtests for django reusable apps\n# see http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app\n\nimport glob\nimport os\nimport sys\n\nimport django\nfrom djang...
python
chosen
[ { "from": "human", "value": "Add a little package-em-up script for the Subversion book.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n\nimport sys\nimport os\nimport shutil\n\ndef die(msg):\n sys.stderr.write('ERROR: ' + msg)\n sys.exit(1)\n\ncwd = os.getcwd()\nif not os.path.exists...
python
chosen
[ { "from": "human", "value": "Move python code to Pi\n\nNot complete, just moving to Pi\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#Geoff Spielman\n#April 22, 2016\n\nimport sys\nimport time\nimport serial\nser = serial.Serial('/dev/ttyACM0', 9600)\n#stings and ints for storing left and ...
python
chosen
[ { "from": "human", "value": "Add script variant of the Gauss example\n" }, { "from": "gpt", "value": "import sys\nimport time\nimport numpy as np\nfrom abcpy.core import *\nfrom abcpy.distributions import *\nfrom distributed import Client\nfrom dask.dot import dot_graph\nfrom functools import pa...
python
chosen
[ { "from": "human", "value": "Add a script that scans a directory tree for .js files, reads them,\nand builds an map -- path from root to file contents.\nThis is outputted as a JSON string to standard out.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Scans a directory tree for ...
python
chosen
[ { "from": "human", "value": "Add importer wrapper for NaPTAN\n" }, { "from": "gpt", "value": "import httplib\nfrom tempfile import TemporaryFile\nfrom zipfile import ZipFile\nfrom tch.parsers.naptan import NaptanParser\n\nclass NaptanImporter(object):\n\n HTTP_HOST = \"www.dft.gov.uk\"\n R...
python
chosen
[ { "from": "human", "value": "Add script to turn off all non-build nodes\n" }, { "from": "gpt", "value": "#\n# Copyright 2012 Cisco Systems, Inc.\n#\n# Author: Soren Hansen <sorhanse@cisco.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this...
python
chosen
[ { "from": "human", "value": "[draft] Add tests for the AsyncActivationHandler\n" }, { "from": "gpt", "value": "from unittest import mock\n\nfrom django.test import TestCase\nfrom viewflow import lock\nfrom viewflow.activation import STATUS\nfrom viewflow.base import this\n\nfrom ..flows import A...
python
chosen
[ { "from": "human", "value": "Add indexes to new instance_uuid columns.\n\nResolves bug 1009738 as well as several other bugs that haven't been\nreported yet.\n\nChange-Id: I09b456df70aaaba1bc4ac00514e63bda804d7f92\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# ...
python
chosen
[ { "from": "human", "value": "Add LineAnimator example with variable x-axis values.\n" }, { "from": "gpt", "value": "\"\"\"\n=============\nLineAnimator\n=============\n\nThis example shows off some ways in which you can use the\nLineAnimator object to animate line plots.\n\"\"\"\nimport numpy as...
python
chosen
[ { "from": "human", "value": "Add migration to populate Entity type\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2018-11-07 08:44\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef populate_entity_type(apps, schema_e...
python
chosen
[ { "from": "human", "value": "Add FFmpeg module for converting video files into image sequences\n" }, { "from": "gpt", "value": "\n\n__author__ = 'Konstantin Dmitriev'\n\nfrom renderchan.module import RenderChanModule\nfrom renderchan.utils import which\nimport subprocess\nimport os\nimport rando...
python
chosen
[ { "from": "human", "value": "Add a helpful message for people looking for old script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nprint('''udemy-dl can now be installed using pip\n\npip install udemy-dl\n\n\nIf you are looking for the old script, it is now located here:\n\nsrc/udemy_dl/...
python
chosen
[ { "from": "human", "value": "Test for the multiply.py function\n" }, { "from": "gpt", "value": "import multiply as mp \n\ndef test_multiply():\n\t\"\"\"\n\tTests that the multiply function works\n\t\"\"\"\n\tassert mp.multiply(5,5) == 25\n\tassert mp.multiply(3,0) == 0\n\t" } ]
python
chosen
[ { "from": "human", "value": "Add class for updating stock\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nclass StockUpdater:\n\n def __init__(self, db_connection):\n self.db_connection = db_connection\n\n def set_items(self, items):\n self....
python
chosen
[ { "from": "human", "value": "Add a test for bot action registration\n" }, { "from": "gpt", "value": "import re\nimport unittest\nfrom gather.bot import ListenerBot\n\n\nclass TestGatherBot(unittest.TestCase):\n def test_register(self):\n bot = ListenerBot()\n self.assertEqual({}...
python
chosen
[ { "from": "human", "value": "Add mochitest failure test analyzer\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http:...
python
chosen
[ { "from": "human", "value": "Add python version of extract_binary." }, { "from": "gpt", "value": "from argparse import ArgumentParser\nimport errno\nimport os.path\nimport urllib\nimport shutil\nfrom subprocess import (\n check_call,\n check_output,\n )\n\ndef get_args():\n parser = ...
python
chosen
[ { "from": "human", "value": "Test suite for the ndlib\n" }, { "from": "gpt", "value": "import unittest\nimport networkx as nx\nimport sys\nsys.path.append(\"..\")\nimport ndlib.VoterModel as vm\nimport ndlib.SznajdModel as sm\nimport ndlib.MajorityRuleModel as mrm\n\n__author__ = 'rossetti'\n__l...
python
chosen
[ { "from": "human", "value": "Add solution for problem A2\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*- \n\n# Copyright 2014 Fabian M.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ...
python
chosen
[ { "from": "human", "value": "Add tests for creating from file location, file, StringIO, and string\n" }, { "from": "gpt", "value": "from __future__ import division, absolute_import, print_function\nimport unittest\nfrom svgpathtools import *\nfrom io import StringIO\nfrom os.path import join, d...
python
chosen
[ { "from": "human", "value": "Add positional list skeleton ???\n" }, { "from": "gpt", "value": "class _DoubleLinkedBase:\n class _Node:\n __slots__ = '_element', '_prev', '_next'\n\n def __init__(self, element, prev, next):\n self._element = element\n self._...
python
chosen
[ { "from": "human", "value": "Split bam files based on barcodes.\n" }, { "from": "gpt", "value": "from __future__ import (absolute_import, division,\n print_function, unicode_literals)\nfrom builtins import (ascii, bytes, chr, dict, filter, hex, input,\n ...
python
chosen
[ { "from": "human", "value": "Add initial helper functions for connecting to LDAP\n" }, { "from": "gpt", "value": "# Handles queries to the LDAP backend\n# Reads the LDAP server configuration from a JSON file\n\nimport json\nimport ldap\n\nfirst_connect = True\n# The default config filename\nconf...
python
chosen
[ { "from": "human", "value": "Add some tests for pop method\n" }, { "from": "gpt", "value": "from ..maps import PreshMap\n\n\ndef test_pop1():\n table = PreshMap()\n table[10] = 20\n table[30] = 25\n assert table[10] == 20\n assert table[30] == 25\n table.pop(30)\n assert tab...
python
chosen
[ { "from": "human", "value": "Add command to update Satellites names\n" }, { "from": "gpt", "value": "from orbit import satellite\n\nfrom django.core.management.base import BaseCommand\n\nfrom db.base.models import Satellite\n\n\nclass Command(BaseCommand):\n help = 'Update existing Satellites...
python
chosen
[ { "from": "human", "value": "Add a function for simple command line stdout histogram over an array\n" }, { "from": "gpt", "value": "import numpy as np\n\n\ndef hist(data, width=20):\n counts, values = np.histogram(data)\n max_count = counts.max()\n\n for (count, value) in zip(counts, va...
python
chosen
[ { "from": "human", "value": "Add logging and redaction tests\n" }, { "from": "gpt", "value": "import structlog\nimport logging\nimport traceback\n\nfrom raiden.log_config import configure_logging\n\n\ndef test_basic_logging(capsys):\n configure_logging({'': 'DEBUG'})\n log = structlog.get_...
python
chosen
[ { "from": "human", "value": "Add script to convert JSON arrays to newline separated JSON\n\n[Finished #37633897]\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport json\nimport sys\n\ndef newline_json(in_file, out_file):\n for line in json.load(in_file):\n json.dump(line, o...
python
chosen
[ { "from": "human", "value": "Add the tests for the arithmetic submodule\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\n.. module:: text_dragonfire\n :platform: Unix\n :synopsis: tests for the arithmetic submodule.\n\n.. moduleauthor:: Mehmet Mert Yı...
python
chosen
[ { "from": "human", "value": "Add mgmt command to auto-add new fields\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.custom_data_fields.models import CustomDataFieldsDefinition, CustomDataField\nfrom corehq.apps.locations.views import Locati...
python
chosen
[ { "from": "human", "value": "Add unit tests for copper\n\nChange-Id: Ia4e53e2aee5b93071b3acd3d75c7e42841321a0a\nSigned-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Copyright (c) 2017 Orange and others.\n...
python
chosen
[ { "from": "human", "value": "Create a temporal worker that is running only when there is work to do, waiting max_seconds_idle before ending\n" }, { "from": "gpt", "value": "import queue\n\nfrom bot.multithreading.worker import QueueWorker\n\n\nclass LimitedLifespanQueueWorker(QueueWorker):\n ...
python
chosen
[ { "from": "human", "value": "Add migrations for custom fields / groups custom fields\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2016-01-08 15:18\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrati...
python
chosen
[ { "from": "human", "value": "Add a data migration for extra fields for BF and CR\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\ndef from_person_extra_to_generic_fie...
python
chosen
[ { "from": "human", "value": "Add missing kingdom/user foreign key\n" }, { "from": "gpt", "value": "\"\"\"add creator\n\nRevision ID: 96ca40f7c6c2\nRevises: ef6fef5147b2\nCreate Date: 2016-10-27 15:14:18.031571\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '96ca40f7c6c2'\ndown...
python
chosen
[ { "from": "human", "value": "Add package for transforming context-free grammar into Chomskey hiearchy\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"" } ]
python
chosen
[ { "from": "human", "value": "Add an example listing installed Windows updates.\n" }, { "from": "gpt", "value": "\"\"\"\nExample script for listing installed updates on Windows 10\n\nRequirements:\n - Windows 10 (may work on Win7+)\n - pywinauto 0.6.1+\n\nThis example opens \"Control Panel\", n...
python
chosen
[ { "from": "human", "value": "Add management command to reindex mozillians ES.\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\n\nfrom mozillians.users.tasks import index_all_profiles\n\n\nclass Command(BaseCommand):\n def handle(self, *args, **options):\n ...
python
chosen
[ { "from": "human", "value": "Add a Ghidra pluglin for decrypting strings\n" }, { "from": "gpt", "value": "# Decrypts \"encrypted\" strings from ioncube's loaders\n#@author ss23\n#@category _NEW_\n#@keybinding \n#@menupath \n#@toolbar \n\nencryption_key = [0x25,0x68,0xd3,0xc2,0x28,0xf2,0x59,0x2e,...
python
chosen
[ { "from": "human", "value": "Create zinnia_twitter module and add metadatas\n" }, { "from": "gpt", "value": "\"\"\"Twitter plugin for Django-blog-zinnia\"\"\"\n__version__ = '1.0'\n__license__ = 'BSD License'\n\n__author__ = 'Fantomas42'\n__email__ = 'fantomas42@gmail.com'\n\n__url__ = 'https://...
python
chosen
[ { "from": "human", "value": "Create an underline for the selected text" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport re\nimport sublime, sublime_plugin\n\nclass UnderlineCommand(sublime_plugin.TextCommand):\n def run(self, edit):\n sel = self.view.sel()[0]\n line = self.v...
python
chosen
[ { "from": "human", "value": "Test for the gmail client class\n" }, { "from": "gpt", "value": "from mock import call, patch\nfrom unittest import TestCase\n\nfrom keteparaha import GmailImapClient\n\n\n@patch('keteparaha.email_client.IMAPClient')\nclass GmailClientTest(TestCase):\n\n def test_...
python
chosen
[ { "from": "human", "value": "Add a regression test showing hashing error\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nfrom marathon.models.base import MarathonObject\nimport unittest\n\n\nclass MarathonObjectTest(unittest.TestCase):\n\n def test_hashable(self):\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add utils's check_string_length test case\n\n1. What is the problem\nTricircle does not have utils module's test case\n\n2. What is the solution to the problem\nImplement related test case\n\n3. What the features need to be implemented to the Tricircle\nNo new features\n\nChange...
python
chosen
[ { "from": "human", "value": "Add db migration for user table\n" }, { "from": "gpt", "value": "\"\"\"Add user model\n\nRevision ID: 70c7d046881\nRevises: 19b7fe1331be\nCreate Date: 2013-12-07 15:30:26.169000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '70c7d046881'\ndown_rev...
python
chosen
[ { "from": "system", "value": "Add docutils to the list of requirements.\n\nInstall docutils during a pip install so that rendering\nreStructuredText (CTRL-r) works out of the box.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\nfrom nvpy import nvpy\n\n# Utility funct...
python
chosen
[ { "from": "human", "value": "Include a (very) simple example\n" }, { "from": "gpt", "value": "from dynamic_api_client import BaseClient\n\nclass MicroBlogApi(BaseClient):\n\n\tavailable_paths = ['POST account/signin', 'GET posts/all']\n\tseparator = '/'\n\n\tdef __init__(self, base_url='https://...
python
chosen
[ { "from": "human", "value": "Add test for main function; bring coverage to 100%\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport contextlib\nimport io\nimport nose.tools as nose\nimport src.simulator as sim\nfrom unittest.mock import patch\n\n\n@patch('sys.argv', [\n sim.__fi...
python
chosen
[ { "from": "human", "value": "Add default message for list pages\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-02-02 20:51\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio...
python
chosen
[ { "from": "human", "value": "Add unit test for suggest_restaurant command.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom click.testing import CliRunner\n\nimport yoda\n\n\nclass TestSuggestRestaurant(unittest.TestCase):\n \"\"\"\n Test for the following commands:\n\n | Mo...
python
chosen
[ { "from": "human", "value": "Add test for hard delete job\n" }, { "from": "gpt", "value": "import time\n\nfrom database import update, utc_now, db\nfrom database_testing import DatabaseTest\nfrom jobs import hard_delete_expired_datasets\nfrom models import User, UsersMutationsDataset\nfrom test_...
python
chosen
[ { "from": "human", "value": "Test for make_github_projec and make_github_organization\n" }, { "from": "gpt", "value": "from django.test import TestCase\n\nfrom django.contrib.auth.models import User\nfrom allauth.socialaccount.models import SocialToken \n\nfrom projects.models import Project\n\n...
python
chosen
[ { "from": "human", "value": "Create dummy files for /data\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# -----------------------------------------------------------------------------\n# EXPLANATION:\n# This file fills the folder /data with dummy files (neces...
python
chosen
[ { "from": "human", "value": "Add unit test for pollution_map" }, { "from": "gpt", "value": "#run the test with default values of df, state and year \n\n\nimport unittest\nfrom pollution_map import pollution_map\nimport pandas as pd\n\n\ndf = pd.read_csv(\"../data/pollution_us_2000_2016.csv\")\n\...
python
chosen
[ { "from": "human", "value": "Create enum for asset classes\n" }, { "from": "gpt", "value": "from enum import Enum\n\nclass AssetClass(Enum):\n CASH_EQUIVALENTS = \"Cash Equivalents\"\n COMMODITIES = \"Commodities\"\n EQUITIES = \"Equities\"\n FIXED_INCOME = \"Fixed Income\"\n REAL...
python
chosen
[ { "from": "human", "value": "Add script to test cuda via numba\n" }, { "from": "gpt", "value": "# install nvidia-cuda-toolkit into the OS\n# conda install numba\n# conda install cudatoolkit -- otherwise will error out\n\nimport numpy as np\nfrom numba import vectorize\nfrom time import perf_coun...
python
chosen
[ { "from": "human", "value": "Create a UserTermsAgreement object for every existing User\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef create_user_terms_agreements(apps, schema_editor):\n U...
python
chosen
[ { "from": "human", "value": "Add a log importer for logs that need indexing.\n" }, { "from": "gpt", "value": "# Copyright (c) Weasyl LLC\n# See COPYING for details.\n\nimport argparse\nimport datetime\nimport os.path\nimport re\n\nimport elastirc\n\nfrom whoosh import index\n\n\nline_pattern = r...
python
chosen
[ { "from": "human", "value": "src: Add empty implementation of the importer\n" }, { "from": "gpt", "value": "from collections import namedtuple\n\n# BoundingBox:\n# top (int) Top of the box\n# bottom (int) Bottom of the box\n# left (int) Left of the box\n# right (int) Right of t...
python
chosen
[ { "from": "human", "value": "Add initial tests for bbs_benchmarks.py\n" }, { "from": "gpt", "value": "\"\"\"Tests of time-series prediction benchmarking functions\"\"\"\n\nfrom pandas import DataFrame\nfrom pandas.util.testing import assert_frame_equal\n\nfrom bbs_benchmarks import *\n\ndef test...
python
chosen
[ { "from": "human", "value": "Implement validator for Austrian association register number\n" }, { "from": "gpt", "value": "# zvr_zahl.py - functions for handling Austrian association register numbers\n# coding: utf-8\n#\n# Copyright (C) 2017 Holvi Payment Services Oy\n# Copyright (C) 2017 Arthur...
python
chosen
[ { "from": "system", "value": "Add more detailed validation in dashboard\n" }, { "from": "human", "value": "from django import forms\nfrom django.utils.translation import pgettext_lazy\n\nfrom ...product.models import Discount\n\n\nclass DiscountForm(forms.ModelForm):\n class Meta:\n mo...
python
chosen
[ { "from": "human", "value": "Add a dead code elimination optimization pass.\n" }, { "from": "gpt", "value": "\"\"\"Removes unused instructions.\n\nThe definition of \"unused instruction\" is an instruction having a return\nID that is not used by any non-debug and non-decoration instruction, and\...
python
chosen
[ { "from": "human", "value": "Create test data generator script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport sys\nimport math\nimport urllib\nimport urllib2\nimport time\n\nid = '123456789012345'\nserver = 'http://localhost:5055'\nperiod = 1\nstep = 0.001\n\nwaypoints = [\n (40...
python
chosen
[ { "from": "human", "value": "Add small script to test micro:bit accelerometer\n" }, { "from": "gpt", "value": "from microbit import accelerometer as acc, sleep\n\ntx = 10\nty = 10\ntz = 40\nx = y = z = 0\n\nwhile True:\n nx, ny, nz = acc.get_values()\n\n if abs(nx - x) >= tx or abs(ny - y)...
python
chosen
[ { "from": "human", "value": "Break off helper functions from dakota.py\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\"\"\"Helper functions for processing Dakota parameter and results files.\"\"\"\n\nimport re\n\n\ndef get_response_descriptors(params_file):\n \"\"\"Extract response...
python
chosen