conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add fuzz target for WebSocket parser.\n" }, { "from": "gpt", "value": "import sys\n\nimport atheris\n\n\nwith atheris.instrument_imports():\n from websockets.exceptions import PayloadTooBig, ProtocolError\n from websockets.frames import Frame\n from websocke...
python
chosen
[ { "from": "human", "value": "Add migration for changes to model\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2016-05-28 14:11\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration...
python
chosen
[ { "from": "human", "value": "Add test fro add_items_to_message function.\n" }, { "from": "gpt", "value": "from django_logutils.utils import add_items_to_message\n\n\ndef test_add_items_to_message():\n msg = \"log message\"\n items = {'user': 'benny', 'email': 'benny@example.com'}\n msg ...
python
chosen
[ { "from": "human", "value": "Add migrations for EASUid storage format (part 1 of 3).\n" }, { "from": "gpt", "value": "\"\"\"update eas schema\n\nRevision ID: 281b07fa75bb\nRevises:576f5310e8fc\nCreate Date: 2015-05-19 01:08:57.101681\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevisio...
python
chosen
[ { "from": "human", "value": "[jsk_2015_apc_common] Add bof object recognition test script\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport cPickle as pickle\nimport gzip\nimport sys\n\nimport cv2\nfrom imagesift import get_sift_keypoints\...
python
chosen
[ { "from": "human", "value": "Add proper tests to importstring.\n" }, { "from": "gpt", "value": "\"\"\"Tests for IPython.utils.importstring.\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2013 The IPython Development Team\n#\n# Distribu...
python
chosen
[ { "from": "human", "value": "Convert video files captured with raspivid\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport time\nimport os\nimport glob\nimport sys\nimport shutil\n\ndef RPxLog(severity, message):\n\tprint time.time(), severity, message\n\ndef RPxErrLog(message):\n\...
python
chosen
[ { "from": "human", "value": "Test assignment of permissions to roles\n" }, { "from": "gpt", "value": "\"\"\"\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom byceps.services.authorization import service\n\nfrom tests.base import Abstra...
python
chosen
[ { "from": "human", "value": "Add tests for transaction proxy\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom aiohttp.test_utils import make_mocked_request\nfrom plone.server.browser import View\nfrom plone.server.transactions import RequestAwareDB\nfrom plone.server.transactions i...
python
chosen
[ { "from": "human", "value": "Add a management command to generate hashes for all streams that need them.\n\n(imported from commit b3a05e47dfe69b44f984185e360d79bf04f7885b)\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nfrom django.core.management.base import BaseCommand\n\nfrom zerver.lib...
python
chosen
[ { "from": "human", "value": "Test for purge main entry point\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# FOGLAMP_BEGIN\n# See: http://foglamp.readthedocs.io/\n# FOGLAMP_END\n\n\"\"\" Test tasks/purge/__main__.py entry point\n\n\"\"\"\n\nimport pytest\nfrom unittest.mock import ...
python
chosen
[ { "from": "human", "value": "Add script to populate the Subset table\n" }, { "from": "gpt", "value": "import os\nfrom models import db, Subset\n# importing from admin rather than db, because it needs app context\nfrom admin import app\n\n\nif __name__ == '__main__':\n\n # http://stackoverflo...
python
chosen
[ { "from": "human", "value": "Replace the clumsy Makefile with proper command infrastructure\n\nSemantix now has a proper infrastructure for shell commands, complete\nwith argument passing and complex sub-commands. Every semantix-based\nproject (including semantix itself) will how have an executable script\...
python
chosen
[ { "from": "human", "value": "Add command to invalidate all of a particular variant.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom ...utils import get_va...
python
chosen
[ { "from": "human", "value": "Add a description to word lists.\n" }, { "from": "gpt", "value": "\"\"\"Add description to list\n\nRevision ID: 1d8e0b3b949\nRevises: 594033d136f\nCreate Date: 2014-07-20 13:37:41.064387\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '1d8e0b3b949'\...
python
chosen
[ { "from": "human", "value": "Add test for `anaconda copy`\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\n# Standard library imports\nimport json\nimport unittest\n\n# Local imports\nfrom binstar_client.scripts.cli import main\nfrom binstar_client.tests.fixture import C...
python
chosen
[ { "from": "human", "value": "Add UMA 2.0 SCIM/Passport script" }, { "from": "gpt", "value": "# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.\n# Copyright (c) 2017, Gluu\n#\n# Author: Jose Gonzalez\n# Adapted from previous 3.0.1 script of ...
python
chosen
[ { "from": "human", "value": "Add python wrapper for tf.contrib.hadoop.SequenceFileDataset\n\nSigned-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>\n" }, { "from": "gpt", "value": "# Copyright 2018 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apa...
python
chosen
[ { "from": "human", "value": "Add management command to update ES mappings\n\nThis management command uses Put Mapping to update the mappings for the\naips and aipfiles indices, to ensure proper sorting in the Archival\nStorage tab DataTable, and runs an Update By Query to populate the new\nfilePath.raw subf...
python
chosen
[ { "from": "human", "value": "Add ScriptFields object used as parameter script_fields of Search object\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__author__ = 'Armando Guereca'\n\nclass ScriptFields:\n _internal_name = \"script_fields\"\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Add base celery operation task\n" }, { "from": "gpt", "value": "from pipelines.models import Operation\nfrom polyaxon.celery_api import CeleryTask\n\n\nclass OperationTask(CeleryTask):\n \"\"\"Base operation celery task with basic logging.\"\"\"\n _operation = ...
python
chosen
[ { "from": "human", "value": "Add Python expansion service entry point.\n" }, { "from": "gpt", "value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regardi...
python
chosen
[ { "from": "human", "value": "Add script for setting contact-level backend ids in bulk\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom optparse import make_option\nfrom corehq.apps.sms.mixin import VerifiedNumber\n\n\nclass Command(BaseComm...
python
chosen
[ { "from": "human", "value": "Add tests to demonstrate bad Host header problem\n" }, { "from": "gpt", "value": "import pytest\nimport requests\n\n\nclass TestRedirect:\n\n @pytest.mark.parametrize(\n 'path', ('/mesos_dns', '/net', '/exhibitor', '/mesos')\n )\n def test_redirect(se...
python
chosen
[ { "from": "human", "value": "Add test for EC lots\n" }, { "from": "gpt", "value": "import unittest\nimport sys\n\nsys.path.append('../..') # TODO anybetter way?\n\nfrom ebroker.EasyClickLots import EasyClickLots\n\nclass TestConfig(unittest.TestCase):\n\n def setUp(self):\n self.lots ...
python
chosen
[ { "from": "human", "value": "Remove section name - migrate\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 ('thingys', '0003_...
python
chosen
[ { "from": "human", "value": "Add py solution for 718. Maximum Length of Repeated Subarray\n\n718. Maximum Length of Repeated Subarray: https://leetcode.com/problems/maximum-length-of-repeated-subarray/\n" }, { "from": "gpt", "value": "class Solution(object):\n def findLength(self, A, B):\n ...
python
chosen
[ { "from": "human", "value": "Add test dropdown remove options.\n" }, { "from": "gpt", "value": "import json\n\nfrom dash import Dash, html, dcc, Output, Input\nfrom dash.exceptions import PreventUpdate\n\n\nsample_dropdown_options = [\n {\"label\": \"New York City\", \"value\": \"NYC\"},\n ...
python
chosen
[ { "from": "system", "value": "[FIX] Fix useless import following the removal of rml purchase reports\n\nbzr revid: openerp-sle@openerp-sle.home-20140214150700-2zuukk4ahs4q1zhs" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################...
python
chosen
[ { "from": "human", "value": "Add migration for model app_name change in preceding commit\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\n...
python
chosen
[ { "from": "human", "value": "Add first pass at BETS location dump\n" }, { "from": "gpt", "value": "import csv\nfrom django.core.management.base import BaseCommand\nfrom corehq.apps.locations.models import SQLLocation\nfrom custom.enikshay.integrations.bets.repeaters import BETSLocationRepeater\n...
python
chosen
[ { "from": "human", "value": "Add Xcode link map analyzer\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# Copyright 2018 gRPC authors.\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 obtai...
python
chosen
[ { "from": "human", "value": "Add custom stamp to add its-base revision to version number\n\nChange-Id: I87bacf25e25e58ee4c648963912056726cd297dc\n" }, { "from": "gpt", "value": "import os\nimport sys\n\n# As this plugin is typically only sym-linked into a gerrit checkout and both os.getcwd and\n...
python
chosen
[ { "from": "human", "value": "Add corporation flag in blueprints\n\n" }, { "from": "gpt", "value": "\"\"\"add corporation flag\n\nRevision ID: d03236a0cda4\nRevises: 47e567919169\nCreate Date: 2017-04-12 13:21:03.482000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\n\nimport sqlalchemy as...
python
chosen
[ { "from": "human", "value": "Add framework for example client\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport npyscreen\nimport curses\n\nclass EditorFormExample(npyscreen.FormMutt):\n MAIN_WIDGET_CLASS = npyscreen.BufferPager\n\n def __init__(self, *args, **keywords):\n\tsu...
python
chosen
[ { "from": "human", "value": "Add REPL that evaluates code on various Python versions\n" }, { "from": "gpt", "value": "\"\"\"A repl across hosts.\"\"\"\nimport ast\nimport sys\nimport readline\nimport traceback\nfrom io import StringIO\n\n\ndef read_stmt():\n stmt = ''\n prompt = '>>> '\n ...
python
chosen
[ { "from": "human", "value": "Test in a new file\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom pycublas import *\nfrom ctypes import *\n\n#Test functions\nhandle = cublasHandle_t()\n\ndef Init():\n status = cublasCreate(byref(handle))\n print status\n\ndef Close():\n s...
python
chosen
[ { "from": "human", "value": "ZA: Add a command to output a CSV file of constituency offices\n" }, { "from": "gpt", "value": "import csv\nimport sys\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom pombola.core.models import Organisation, OrganisationRelationship\n\nMA...
python
chosen
[ { "from": "human", "value": "Add solution to lintcode question 29\n" }, { "from": "gpt", "value": "class Solution:\n \"\"\"\n @params s1, s2, s3: Three strings as description.\n @return: return True if s3 is formed by the interleaving of\n s1 and s2 or False if not.\n @hi...
python
chosen
[ { "from": "human", "value": "Add a sensor feedback sample\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#coding: utf-8\nimport sys,time\n\nj1,j2,j3,j5,j6 = 0,60,0,0,0\n\nwhile True:\n # \u001b$B%m%\\%C%H$N3QEY$NFI$_9~$_<~4|$O\u001b(B20ms\u001b$B!J%\"%P%&%H$G$9!K\u001b(B\n time.sl...
python
chosen
[ { "from": "human", "value": "Remove obsolete table from database\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.9 on 2018-01-26 00:19\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nDROP_UNUSED_TABLES = \"\"\"\\\n DROP TABLE...
python
chosen
[ { "from": "human", "value": "Add management command to denormalize channel and containers\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom opps.channels.models import Channel\nfrom opps.containers.models import ContainerBox\nfrom opps.artic...
python
chosen
[ { "from": "human", "value": "Create bar charts with error bars for foj sensitivity scores.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# a bar plot with errorbars\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# extract column of the dataset\ndata = np.genfromtxt('../data/se...
python
chosen
[ { "from": "human", "value": "Add tests for Graph rendering\n" }, { "from": "gpt", "value": "from django.contrib.contenttypes.models import ContentType\nfrom django.test import TestCase\n\nfrom dcim.models import Site\nfrom extras.choices import ExportTemplateLanguageChoices\nfrom extras.models i...
python
chosen
[ { "from": "human", "value": "Add script to generate visualization pairs for predicted labels\n" }, { "from": "gpt", "value": "\"\"\"Generate visualization pairs (emotion label - concept type) for predicted\nlabels.\n\nInput: directory containing text files with predicted heem labels.\n\nGenerate...
python
chosen
[ { "from": "human", "value": "Create (beginnings of a) Python module for misc BatStack related functions.\n\nFirst method, read_chanmap, for reading plaintext files that specify\nchannel mappings, i.e. how local numbering maps to the global of an\nentire Array system.\n\nMy planned style for batstack.py is t...
python
chosen
[ { "from": "human", "value": "Add data/settings fields to document/collection" }, { "from": "gpt", "value": "# Generated by Django 3.1.8 on 2021-05-05 15:20\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('document', '0024_...
python
chosen
[ { "from": "human", "value": "Add migration for tidying up old values in progress fields\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.10 on 2018-03-28 07:50\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef tidy_progress_...
python
chosen
[ { "from": "human", "value": "Add simple task to test integration of celery\n\nThis adds a very simple logging task that just dumps and argument out to\nthe log. This can be used to setup a periodic task that will show that\nall of the workers (worker, beat and celerycam) are working in harmony.\n" }, { ...
python
chosen
[ { "from": "human", "value": "Solve Code Fights count black cells problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Count Black Cells Problem\n\nfrom fractions import gcd\n\n\ndef countBlackCells(m, n):\n # Manhattan distance plus lattice points less 2 end points\...
python
chosen
[ { "from": "human", "value": "Add ability for ExternalTaskSensor to wait on multiple runs of a task\n\nCurrently using the execution_date_fn parameter of the ExternalTaskSensor\nsensors only allows to wait for the completion of one given run of the\ntask the ExternalTaskSensor is sensing.\n\nHowever, this pr...
python
chosen
[ { "from": "human", "value": "[AC-8797] Add migration to use full gender spec\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.24 on 2021-07-01 20:17\n\nfrom django.db import migrations\n\n\ndef update_criterion_specs(apps, schema_editor):\n CriterionOptionSpec = apps.get_model(\"Cri...
python
chosen
[ { "from": "human", "value": "Write a function that print something n times including relatives spaces\n" }, { "from": "gpt", "value": "# Write a function that print something n times\r\n# including relatives spaces\r\n\r\n\r\ndef pprint(wyp, ntimes):\r\n wyp = str(wyp) + \" \"\r\n print wy...
python
chosen
[ { "from": "human", "value": "Test for conflict message from requirements.txt\n" }, { "from": "gpt", "value": "from tests.lib import create_basic_wheel_for_package\n\n\ndef test_new_resolver_conflict_requirements_file(tmpdir, script):\n create_basic_wheel_for_package(script, \"base\", \"1.0\")...
python
chosen
[ { "from": "human", "value": "Add complete test for javascript sourcemap resolving\n" }, { "from": "gpt", "value": "# coding: utf-8\n\nfrom __future__ import absolute_import\n\nimport os\nimport json\nimport responses\n\nfrom sentry.testutils import TestCase\nfrom sentry.models import Event\n\n\n...
python
chosen
[ { "from": "human", "value": "Add File with decorator functions\n" }, { "from": "gpt", "value": "# from slave1 import Slave1\n# from slave2 import Slave2\n\nimport rocksdb\nimport encodings\n\n\n\n# class Replica:\n\n# def __init__(self):\n# print(\"Decorator\")\n\n# def decorator...
python
chosen
[ { "from": "system", "value": "Add back a deleted newline.\n" }, { "from": "human", "value": "# Copyright 2016 Twitter. 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 obtai...
python
chosen
[ { "from": "human", "value": "[RM-11742] Add argparse tests for mds\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 TestParserMDS(object):\n\n def setup(sel...
python
chosen
[ { "from": "human", "value": "Put internal paths in one place.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\n# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not us...
python
chosen
[ { "from": "human", "value": "Add python example of how to use splines\n" }, { "from": "gpt", "value": "\n# http://de.wikipedia.org/wiki/Non-Uniform_Rational_B-Spline\n# len(knot_u) := nNodes_u + degree_u + 1\n# len(knot_v) := nNodes_v + degree_v + 1\n\ndegree_u=2\ndegree_v=2\nnNodes_u=5\nnNodes_...
python
chosen
[ { "from": "human", "value": "Add a basic server to go along with.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom socket import socket, AF_UNIX, SOCK_STREAM\nimport os\n\ns = socket(AF_UNIX, SOCK_STREAM)\ns.bind('/tmp/socket_lua_debug')\ns.listen(1)\nlua = s.accept()[0]\nprint \"C...
python
chosen
[ { "from": "system", "value": "Make sure sys.path is setup correctly\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"example.settings\")\n\n from django.core.management impo...
python
chosen
[ { "from": "human", "value": "Add a command to create provider migrations\n" }, { "from": "gpt", "value": "import os\n\nfrom django.apps import apps\nfrom django.db.migrations.state import ProjectState\nfrom django.core.management.base import BaseCommand\nfrom django.db.migrations.loader import M...
python
chosen
[ { "from": "system", "value": "Update development status to beta\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport inflection\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\n\nsetup(\n name='infle...
python
chosen
[ { "from": "human", "value": "Add management command to recalculate the field\n" }, { "from": "gpt", "value": "from django.conf import settings\nfrom django.core.management import BaseCommand, CommandError\nfrom django.utils import timezone\n\nfrom legalaid.models import Case\n\n\nclass Command(B...
python
chosen
[ { "from": "human", "value": "Add migration to add pro users.\n" }, { "from": "gpt", "value": "\"\"\"add pro field to user table\n\nRevision ID: a9ecd1c767\nRevises: 66594a9866c\nCreate Date: 2014-11-05 10:31:37.734790\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = 'a9ecd1c767'...
python
chosen
[ { "from": "human", "value": "Add a test continously failing one node, causing group split and reconnects\n\n\n20071126190126-93b9a-a75d8096a67cfd837b21cb9c6b20eec234993a90.gz\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Both have a very small chance of occuring\n\nfrom twisted.int...
python
chosen
[ { "from": "human", "value": "Add script to create reference output databases\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\nimport os\n\nfrom cyclus_tools import run_cyclus\nfrom tests_list import sim_files\n\ndef main():\n \"\"\"Creates reference databases. Assumes that cyclus is...
python
chosen
[ { "from": "system", "value": "Upgrade ldap3 0.9.9.1 => 0.9.9.2\n" }, { "from": "human", "value": "import sys\n\nfrom setuptools import find_packages, setup\n\n\nVERSION = '2.0.dev0'\n\n\ninstall_requires = [\n 'django-local-settings>=1.0a10',\n 'stashward',\n]\n\nif sys.version_info[:2] < ...
python
chosen
[ { "from": "human", "value": "Add a command line script to ad all users to instances\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"Add all users into the instances given on the command line.\n\"\"\"\nimport os\nimport sys\nfrom argparse import ArgumentParser\n\nfrom paste.deploy i...
python
chosen
[ { "from": "human", "value": "Add initial version of the embed coverart plugin.\n\nThis plugin allows users to embed the cover into the audio file.\nProbaly still has a few bugs but it should work in most cases right\nnow.\n" }, { "from": "gpt", "value": "from beets.plugins import BeetsPlugin\nfr...
python
chosen
[ { "from": "human", "value": "Add K Means clustering algorithm\n" }, { "from": "gpt", "value": "import numpy as np\n\nclass KMeans(object):\n\tdef __init__(self, inputs, clusters):\n\t\tself.inputs = np.array(inputs)\n\t\tif self.inputs.ndim == 1:\n\t\t\tself.inputs = self.inputs.reshape(self.inp...
python
chosen
[ { "from": "human", "value": "Add management command to find ccs record cases without delivery form\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport csv\n\nfrom django.core.management import BaseCommand\n\nfrom corehq.form_...
python
chosen
[ { "from": "human", "value": "Add class to raise app exceptions\n" }, { "from": "gpt", "value": "import six\n\nclass AppError(Exception):\n \"\"\"App exception\"\"\"\n\n def __init__(self, reason, response=None):\n self.reason = six.text_type(reason)\n self.response = response...
python
chosen
[ { "from": "human", "value": "Add placeholders for base classes\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport aardvark\nimport numpy as gpib\nimport scipy as serial\nimport socket\n\nclass Instrument(object):\n def __init__(self):\n pass\n\n ...
python
chosen
[ { "from": "human", "value": "Add pauze at height plugin.\n" }, { "from": "gpt", "value": "#Name: Pause at height\n#Info: Pause the printer at a certain height\n#Depend: GCode\n#Type: postprocess\n#Param: pauseLevel(float:5.0) Pause height (mm)\n#Param: parkX(float:190) Head park X (mm)\n#Param: ...
python
chosen
[ { "from": "human", "value": "Add test for /target post\n" }, { "from": "gpt", "value": "from django.test import Client, TestCase\nfrom django.core.urlresolvers import reverse\nfrom breach.models import Target\nfrom breach.views import VictimListView\nimport json\n\n\nclass ViewsTestCase(TestCase...
python
chosen
[ { "from": "human", "value": "Add an interactive test script for exercising curses\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $\n#\n# Interactive test suite for the curses module.\n# This script displays various things and the u...
python
chosen
[ { "from": "human", "value": "Add simple script to generate plate labels\n" }, { "from": "gpt", "value": "#! /usr/bin/env python3\n\nimport argparse\nimport string\n\ndef main(args):\n rows = string.ascii_uppercase[:8]\n cols = range(1, 13)\n if args.r:\n wells = [(r, c) for r in ...
python
chosen
[ { "from": "human", "value": "Use 'modified' field as default for 'updated'\n" }, { "from": "gpt", "value": "from django.db import models, migrations\n\ndef set_updated(apps, schema_editor):\n Proposal = apps.get_model(\"proposal\", \"Proposal\")\n db_alias = schema_editor.connection.alias\...
python
chosen
[ { "from": "human", "value": "Feeder: Add the feeder role in the ROLES table\n\nChange-Id: I4c09e0a5e7d08975602a683f4cecbf993cdec4ba\n" }, { "from": "gpt", "value": "#\n# Copyright (C) 2017 Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use thi...
python
chosen
[ { "from": "human", "value": "Add functional tests for security group rule\n\nTests:\ntest_find\ntest_get\ntest_list\n\nChange-Id: If54342ec8c57b926a5217d888a43dcd98223bd69\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this...
python
chosen
[ { "from": "system", "value": "Switch over to extend HQPillow\n" }, { "from": "human", "value": "from corehq.apps.groups.models import Group\nfrom corehq.pillows.mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING\nfrom dimagi.utils.decorators.memoized import memoized\nfrom pillowtop.listene...
python
chosen
[ { "from": "human", "value": "Add failing test showing the issue\n\nRelates to issue #258.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8; -*-\nimport re\n\nfrom sqlalchemy import Column, Integer, MetaData, String, Table\nfrom sqlalchemy.sql.ddl import CreateTable\n\nfrom pyathena.sqlalchem...
python
chosen
[ { "from": "human", "value": "Add script for writing virus names to txt file\n\n" }, { "from": "gpt", "value": "import json\n\nnames = list()\n\nwith open(\"viruses.json\", \"r\") as f: \n names = [virus[\"name\"] for virus in json.load(f)]\n\n\nnames = sorted(names)\n\nwith open(\"names.tx...
python
chosen
[ { "from": "human", "value": "Add test script for environment.\n" }, { "from": "gpt", "value": "\"\"\"\nThis script tests whether the current environment works correctly or not.\n\"\"\"\n\nimport sys; sys.path.insert(0, '../geoplot/')\nimport geoplot as gplt\nfrom geoplot import crs as gcrs\nimpo...
python
chosen
[ { "from": "human", "value": "Add simple unittests for serio message\n\nSigned-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>\n" }, { "from": "gpt", "value": "import unittest\n\nfrom meshnet.serio.messages import SerialMessage, MessageType\n\nKEY = b'\\x00\\x01\...
python
chosen
[ { "from": "human", "value": "Add test for WonderfulBing class\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom os import path\n\nimport mock\nimport pytest\n\nfrom wonderful_bing.wonderful_bing import Won...
python
chosen
[ { "from": "human", "value": "Add image url replacement script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\n\n\nROOT_FOLDER = '/home/mjulian/coding/figarocorso.github.io/'\nPOST_FOLDER = ROOT_FOLDER + '_posts/day-by-day/'\nIMAGE_FOLDER = ROOT_FOLDER + ...
python
chosen
[ { "from": "human", "value": "Add module declaration for karenina\n" }, { "from": "gpt", "value": "from karenina import modules\n\n\nclass Admin(modules.InstallableModule):\n icon = \"mdi-action-settings-applications\"\n order = 1000\n\n @property\n def label(self):\n return 'A...
python
chosen
[ { "from": "human", "value": "Solve reverse a linked list\n" }, { "from": "gpt", "value": "#!/bin/python3\n\nimport math\nimport os\nimport random\nimport re\nimport sys\n\nclass SinglyLinkedListNode:\n def __init__(self, node_data):\n self.data = node_data\n self.next = None\n\n...
python
chosen
[ { "from": "human", "value": "ADD Network users unit tests\n" }, { "from": "gpt", "value": "\ndef test_create_user(client):\n result = client.post(\"/users/\", data={\"username\": \"test\", \"password\": \"1234\"})\n assert result.status_code == 200\n assert result.get_json() == {\"msg\"...
python
chosen
[ { "from": "human", "value": "Create class for terminal adding test when gramar is create\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 TestCase, main\nfrom gram...
python
chosen
[ { "from": "human", "value": "Add coverage test for \"deprecated\" decorater\n" }, { "from": "gpt", "value": "import warnings\n\nfrom sympy.core.decorators import deprecated\nfrom sympy.utilities.exceptions import SymPyDeprecationWarning\n\n\ndef test_deprecated():\n @deprecated(useinstead=\"b...
python
chosen
[ { "from": "human", "value": "Add test for CPU widget\n" }, { "from": "gpt", "value": "# Copyright (c) 2021 elParaguayo\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the S...
python
chosen
[ { "from": "human", "value": "Add script to find parameters for SVC\n" }, { "from": "gpt", "value": "import asl\n\nfrom sklearn.cross_validation import train_test_split\nfrom sklearn.grid_search import GridSearchCV\nfrom sklearn.metrics import classification_report\nfrom sklearn.svm import SVC\n\...
python
chosen
[ { "from": "system", "value": "Update to use multiprocessing library" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport os\n\nbind = \"127.0.0.1:%(gunicorn_port)s\"\nworkers = (os.sysconf(\"SC_NPROCESSORS_ONLN\") * 2) + 1\nloglevel = \"error\"\nproc_name = \"%(proj_n...
python
chosen
[ { "from": "human", "value": "Add a snippet to remove LangSys from DFLT script\n\nSuch fonts violate the spec and OTS rejects them, this snippet should\nhelp quickly fixing such fonts.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport argparse\nimport logging\nimport os\nimport sys...
python
chosen
[ { "from": "human", "value": "Add missing addoncategory migrations (follow-up from fd2e3b1d)\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.12 on 2020-06-04 09:28\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('addons'...
python
chosen
[ { "from": "human", "value": "Add test to check tunnel shuts down child\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nfrom subprocess import Popen\nfrom test_common import *\nimport socket, ssl, time, os, signal\n\nif __name__ == \"__main__\":\n ghostunnel = None\n try:\n # crea...
python
chosen