conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add standalone MCU load support\n" }, { "from": "gpt", "value": "\"\"\"\n*******************************************************************************\n* Ledger Blue\n* (c) 2016 Ledger\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* ...
python
chosen
[ { "from": "human", "value": "Add \"spotlight\" field to article/file models\n" }, { "from": "gpt", "value": "# Generated by Django 3.0.7 on 2021-01-18 18:01\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('museum_site', '0...
python
chosen
[ { "from": "human", "value": "Add main script for running Rally CI\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport config\nimport events\n\ncfg = config.Config()\ncfg.load([\"/etc/rally-ci/\", \"etc/rally-ci\"])\nhandler = events.EventHandler(cfg)\nhandler.loop()\n" } ]
python
chosen
[ { "from": "human", "value": "Add middleware, if not for keeping the coverage up :)\n" }, { "from": "gpt", "value": "import mock\n\n\nfrom wheelcms_axle.middleware import FixMessageMiddleware\n\n\nclass TestFixMessageMiddleware(object):\n def test_oldstyle(self):\n \"\"\" mock CookieSto...
python
chosen
[ { "from": "human", "value": "Add iterative case update script from a while back\n" }, { "from": "gpt", "value": "from xml.etree import cElementTree as ElementTree\n\nfrom corehq.form_processor.interfaces.dbaccessors import CaseAccessors\n\nfrom .utils import CASEBLOCK_CHUNKSIZE, submit_case_bloc...
python
chosen
[ { "from": "human", "value": "Add appengine config for data transfer.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n# Copyright 2011 Friday Film Club. All Rights Reserved.\n\n\"\"\"App Engine config.\"\"\"\n\n__author__ = 'adamjmcgrath@gmail.com (Adam McGrath)'\n\n\n# Enabled copying dat...
python
chosen
[ { "from": "human", "value": "Test if some command keys have a space\n" }, { "from": "gpt", "value": "from pathlib import Path\nimport json\nimport sys\n\ncwd = Path(sys.argv[0]).parent\ncmd_files = cwd.joinpath('../data/packages').glob('*_cmd.json')\nall_cmds = {}\nfor f in cmd_files:\n f_cmd...
python
chosen
[ { "from": "human", "value": "Test a dcd writer can be attached to a simulation and ran without errors\n" }, { "from": "gpt", "value": "import hoomd\nimport pytest\nimport numpy as np\n\n\ndef test_attach(simulation_factory, two_particle_snapshot_factory, tmp_path):\n d = tmp_path / \"sub\"\n ...
python
chosen
[ { "from": "human", "value": "Add command to migrate winesteam installers to Proton\n" }, { "from": "gpt", "value": "\"\"\"Migrates winesteam scripts to Proton\"\"\"\nimport logging\nfrom django.core.management.base import BaseCommand\n\nfrom common.util import load_yaml, dump_yaml\nfrom games.mo...
python
chosen
[ { "from": "human", "value": "Add post title validation functional test\n" }, { "from": "gpt", "value": "from .base import FunctionalTest\n\n\nclass PostValidationTest(FunctionalTest):\n def test_cannot_add_empty_title(self):\n self.browser.get(self.live_server_url)\n self.move_t...
python
chosen
[ { "from": "human", "value": "Add script to find user login events for IP address\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Find user login events for an IP address.\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfr...
python
chosen
[ { "from": "human", "value": "Add script to make the lfd_settings package.\n" }, { "from": "gpt", "value": "import argparse\nimport os\nimport lfd\n\ndef make_settings_tree(src, dst):\n names = os.listdir(src)\n for name in names:\n srcname = os.path.join(src, name)\n dstname ...
python
chosen
[ { "from": "human", "value": "Move win32 audio experiment to trunk.\n\n--HG--\nextra : convert_revision : svn%3A14d46d22-621c-0410-bb3d-6f67920f7d95/trunk%40736\n" }, { "from": "gpt", "value": "#!/usr/bin/python\r\n# $Id:$\r\n\r\n# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID...
python
chosen
[ { "from": "human", "value": "Add the standalone wave trigger script.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Standard library imports\nimport argparse\nimport collections\nimport functools\nimport logging\nimport os\nimport json\nimport time\n\n# Additional library imports\ni...
python
chosen
[ { "from": "human", "value": "feat(vocabularies): Replace single_value with selection_type (SDESK-3551)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8; -*-\n# This file is part of Superdesk.\n# For the full copyright and license information, please see the\n# AUTHORS and LICENSE files distr...
python
chosen
[ { "from": "human", "value": "Remove IRIS CF Matrix generation notebook\n\n" }, { "from": "gpt", "value": "from sklearn.datasets import load_iris\nimport skfuzzy as fuzz\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.metrics.pairwise import cosine_similarity\nfrom sklearn impo...
python
chosen
[ { "from": "human", "value": "Add data migration to fix image paths on pre-existing badges.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "human", "value": "Test ability to log in\n\n\nFormer-commit-id: b29fa5c96fa5e0fdd2117164baace9ac8492867d" }, { "from": "gpt", "value": "import unittest\nfrom selenium import webdriver\nfrom selenium.webdriver.common.keys import Keys\n\nclass LoginTestCase(unittest.TestCase):\n\n de...
python
chosen
[ { "from": "human", "value": "Add helper script for executing agents in PyDev.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2.7\n'''\nThis module supports launching agents from Eclipse PyDev with minimal\nconfiguration. To get it working, follow these simple steps:\n\n 1. Create a new \...
python
chosen
[ { "from": "human", "value": "Add a simple python to fetch matrices from UoF collection.\n" }, { "from": "gpt", "value": "import sys\n\nfrom HTMLParser import HTMLParser\n\nclass MyHtmlParser(HTMLParser):\n\n def __init__(self):\n HTMLParser.__init__(self)\n\t\t\t\tself.state = 'NONE'\n...
python
chosen
[ { "from": "human", "value": "Create a worker pool to handle pool of workers that can grow or shrink as necessary\n" }, { "from": "gpt", "value": "import queue\n\nfrom bot.multithreading.work import Work\nfrom bot.multithreading.worker import QueueWorker\nfrom bot.multithreading.worker.pool.name_...
python
chosen
[ { "from": "human", "value": "Add template for cli test\n" }, { "from": "gpt", "value": "import click\nfrom click.testing import CliRunner\n\nfrom cyhdfs3 import cli\nfrom utils import *\n\n\ndef test_create_file_list(hdfs):\n runner = CliRunner()\n result = runner.invoke(cli.ls)\n # ass...
python
chosen
[ { "from": "human", "value": "Check response headers for clickjacking and HSTS headers\n" }, { "from": "gpt", "value": "import requests\n\n#checking if the app is vulnerable to clickjacking\ndef check_clickjacking(url):\n response = requests.get(url, verify=False)\n try:\n response_c...
python
chosen
[ { "from": "human", "value": "Add Netflix back in ... maybe\n" }, { "from": "gpt", "value": "import foauth.providers\n\n\nclass Netflix(foauth.providers.OAuth1):\n # General info about the provider\n provider_url = 'https://www.netflix.com/'\n docs_url = 'http://developer.netflix.com/doc...
python
chosen
[ { "from": "system", "value": "[Telemetry] Fix profile generation after r275633.\n\nTBR=dtu@chromium.org\nNOTRY=True\nBUG=\n\nReview URL: https://codereview.chromium.org/323703003\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@275689 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "huma...
python
chosen
[ { "from": "human", "value": "Add test for default commands\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nThis test check the commands\n\"\"\"\n\nfrom __future__ import print_function\nimport os\nimport time\nimport shlex\nimport subprocess\nimport copy\...
python
chosen
[ { "from": "human", "value": "Test for perturbation confusion with nesting\n" }, { "from": "gpt", "value": "from test_util import *\nfrom funkyyak import grad\n\n## See Siskind & Pearlmutter (2008), \"Nesting forward-mode AD in a\n## functional framework\", Higher Order and Symbolic Computation\n...
python
chosen
[ { "from": "human", "value": "Add unit tests for the log receivers.\n" }, { "from": "gpt", "value": "\"\"\"Tests for the Socket Receiver\"\"\"\n\nfrom unittest.mock import patch\n\nfrom nose.tools import raises, eq_, ok_\n\nimport multilog.receivers as receivers\nfrom multilog.handlers import Log...
python
chosen
[ { "from": "human", "value": "Add script to run all pairwise MISO comparisons for each event type.\n" }, { "from": "gpt", "value": "\"\"\"\nthis script is to do all pairwise comparisons of each class of events\ncalled by MISO. It assumes MISO has already been run on each sample\nand there is a di...
python
chosen
[ { "from": "system", "value": "Add another test for full repair command\n" }, { "from": "human", "value": "from vdirsyncer.cli.utils import repair_storage\nfrom vdirsyncer.storage.memory import MemoryStorage\nfrom vdirsyncer.utils.vobject import Item\n\n\ndef test_repair_uids():\n s = MemorySt...
python
chosen
[ { "from": "human", "value": "Add tests for the processing module\n" }, { "from": "gpt", "value": "import mock\nimport pytest\n\nfrom scrapi import events\nfrom scrapi import settings\n\nsettings.DEBUG = False\nsettings.RAW_PROCESSING = ['storage', 'osf', 'foo', 'bar']\nsettings.NORMALIZED_PROCES...
python
chosen
[ { "from": "human", "value": ":hammer: Add first test: check if both collection type selected is invalid\n" }, { "from": "gpt", "value": "import datetime\n\nfrom django.test import TestCase\n\nfrom samples.forms import CollectedSampleForm\nfrom samples.models import (\n Patient, AdmissionNote,...
python
chosen
[ { "from": "human", "value": "Add a small flask app for redirecting /.\n\nThis should never hit the database,\nand give us a nice place to make smarter redirects." }, { "from": "gpt", "value": "import json\n\nfrom flask import Flask, make_response, redirect, request\n\napp = Flask(__name__)\n\nPR...
python
chosen
[ { "from": "human", "value": "Add spider for Hacker News\n" }, { "from": "gpt", "value": "from scrapy.spiders import Spider\nfrom scrapy.http import Request\nfrom hackernews_scrapy.items import HackernewsScrapyItem\nfrom scrapy.selector import Selector\n\n\nclass HackernewsSpider(Spider):\n\tname...
python
chosen
[ { "from": "human", "value": "Add a Python script which lists the friendships of a Twitter user.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"This script lists all the followers of a Twitter user.\n\nExamples:\n You must specify the user's screen_name yo...
python
chosen
[ { "from": "human", "value": "Add a management command to bankrupt users.\n\n(imported from commit 58fbd08fc31a69c9ee7fb73b9302d44eb87db1fa)\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfrom django.core.management.base import BaseCommand\n\nfrom zephyr.lib.actions im...
python
chosen
[ { "from": "human", "value": "Add test measurements against 500 errors and timeouts\n" }, { "from": "gpt", "value": "import logging\nimport ssl\nimport urllib2\n\nTRIES=3\n\nclass TimeoutError(Exception):\n pass\n\ndef test_3times_then_fail(func, *args, **kwargs):\n log = logging.getLogger(...
python
chosen
[ { "from": "human", "value": "Add letter logo for Pension Wise\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0214_another_letter_org\nRevises: 0213_brand_colour_domain_\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0214_another_letter_org'\ndown_revisio...
python
chosen
[ { "from": "human", "value": "Add missing django db migration\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport jsonfield.fields\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "human", "value": "Add settings file to run Django test suite with django-pickling in effect\n" }, { "from": "gpt", "value": "# This is a settings file to run Django tests with django-pickling in effect\nprint('Installing django-pickling')\nimport django_pickling\n\nDATABASES = {\n ...
python
chosen
[ { "from": "human", "value": "Rewrite the name resolving pass.\n\nThis pass takes care of resolving which object are identifiers bound to.\nIt then stores the result by adding a 'resolved' attribute to each identifier\nand qualified identifier node in the tree. These 'resolved' attributes can then\nbe access...
python
chosen
[ { "from": "human", "value": "Move tickets admin to wagtail\n\nTODO: adding responses should be supported\n\ntouch #162\n" }, { "from": "gpt", "value": "from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register\n\nfrom tickets import models\n\n\nclass QuestionAdmin(ModelAdmin...
python
chosen
[ { "from": "human", "value": "Add a script to make a transparent PNG file\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\r\n# coding: utf-8\r\n\r\n'''\r\nAdding an alpha pixel to an image and writing as a ARGB image file\r\nCopyright (C) 2018 Zettsu Tatsuya\r\n'''\r\n\r\nimport cv2\r\nfrom o...
python
chosen
[ { "from": "human", "value": "Add attributes to Anime migration\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 ('mangaki', '0...
python
chosen
[ { "from": "human", "value": "Add function to create a seat group test fixture\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntestfixtures.seating\n~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2016 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\n...
python
chosen
[ { "from": "human", "value": "Implement JSONWriter Class for Saving into files\n\n- base file name\n- save every\n- output folder\n- buffer documents and save when reach maximum file size\n" }, { "from": "gpt", "value": "from pipeline import *\nimport json\nimport os\n\nclass JsonWriter(BasePipel...
python
chosen
[ { "from": "human", "value": "Add command to create VS property sheets for all pkgconfig pacakges\n" }, { "from": "gpt", "value": "# cerbero - a multi-platform build system for Open Source software\n# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>\n#\n# This library is free softw...
python
chosen
[ { "from": "human", "value": "Add hook for missing platformthemes on linux\n" }, { "from": "gpt", "value": "#-----------------------------------------------------------------------------\n# Copyright (c) 2013-2016, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General...
python
chosen
[ { "from": "human", "value": "Add a test for the DRY rule\n" }, { "from": "gpt", "value": "import pytest\nfrom thefuck.rules.dry import match, get_new_command\nfrom tests.utils import Command\n\n\n@pytest.mark.parametrize('command', [\n Command(script='cd cd foo'),\n Command(script='git git...
python
chosen
[ { "from": "human", "value": "Add crawler for Abstruse Goose\n" }, { "from": "gpt", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerResult\nfrom comics.meta.base import MetaBase\n\nclass Meta(MetaBase):\n name = 'Abstruse Goose'\n language = 'en'\n url = 'http://www.a...
python
chosen
[ { "from": "human", "value": "Add cpm_data migration getting rid of known jury duplicates\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef remove_duplicate_jury_members(apps, schema_editor):\n jury_na...
python
chosen
[ { "from": "human", "value": "Add the Knn Viewer of Topic Model\n" }, { "from": "gpt", "value": "import models\nfrom optparse import OptionParser\n\n\ndef show_topicmodel_topic():\n modelfile = \"./../mvtwe/Dataset/model-final.tassign\"\n wordmapfile = \"./../mvtwe/Dataset/wordmap.txt\"\n ...
python
chosen
[ { "from": "system", "value": "Migrate employee field to timesheet only if it exists in time log\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport frappe\n\ndef execute():\n\tif frappe.db.table_exists(\"Time Log\"):\n\t\ttimesheet = frappe.db.sql(\"\"\"select tl.e...
python
chosen
[ { "from": "human", "value": "Read map and detect walls based on distance\n" }, { "from": "gpt", "value": "from math import floor, cos, sin\n\nmap_file = open(\"map.txt\", 'r')\n\nmap_array = [[0 for x in range(800)] for x in range(533)]\nlinenum = 0\n\nfor line in map_file:\n processed_line =...
python
chosen
[ { "from": "human", "value": "Add problem 31, coin dynamic programming\n" }, { "from": "gpt", "value": "from time import time\n\nTARGET_SUM = 200\nCOINS = [1, 2, 5, 10, 20, 50, 100, 200]\n\nDYNAMIC_TABLE = {}\n\n\ndef calculate(point, coinset):\n if point - coinset[0] < 0:\n return 0\n ...
python
chosen
[ { "from": "human", "value": "Add sort method for ints\n" }, { "from": "gpt", "value": "def int_radix(mylist):\n '''\n Sorts a list of ints by looking at the 1's place,\n the 10's, 100's, etc.\n '''\n for i in mylist:\n if (type(i) != int) or (i < 0):\n return 'Pl...
python
chosen
[ { "from": "human", "value": "Add signal receivers for post-save and delete\n" }, { "from": "gpt", "value": "\"\"\"\nadminrestrict signals\n\"\"\"\n\n__author__ = \"Robert Romano\"\n__copyright__ = \"Copyright 2020 Robert C. Romano\"\n\nfrom django.db.models.signals import post_save, post_delete\...
python
chosen
[ { "from": "human", "value": "Add script for predicing loci from bamova\n" }, { "from": "gpt", "value": "import sys\n\nimport numpy as np\n\ndef predict_loci(phi_values, cutoff_percent):\n\taverage_phi_values = np.mean(axis=1)\n\n\tsortable = []\n\tfor loci, phi in enumerate(average_phi_values)\n...
python
chosen
[ { "from": "human", "value": "Add some tests for metrics\n" }, { "from": "gpt", "value": "import requests\nimport urllib.parse\n\nclass TestMetrics:\n\n def test_metrics_html(self, master_ar_process_pertest, valid_user_header):\n \"\"\"\n /nginx/status returns metrics in HTML for...
python
chosen
[ { "from": "human", "value": "Add script for running parameter sweep\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nRun multiple simulations varying a single parameter.\n\"\"\"\n\nimport numpy as np\nfrom subprocess import call\nimport os\nimport pandas as pd\nimport argparse\n\n...
python
chosen
[ { "from": "human", "value": "tests: Verify Health Check splaying works\n\nSee also: PSOBAT-1399\n" }, { "from": "gpt", "value": "\"\"\"Test ELB creation functions.\"\"\"\nfrom foremast.elb.create_elb import SpinnakerELB\n\n\ndef test_splay():\n \"\"\"Splay should split Health Checks properly....
python
chosen
[ { "from": "human", "value": "Fix: Add migration file for lastest version of django_images\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport core.utils\n\n\nclass Migration(migrations.Migration):\n...
python
chosen
[ { "from": "human", "value": "Change minor meta options on models\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('djconnectw...
python
chosen
[ { "from": "human", "value": "Add missing file from previous commit (thanks Izzet Fatih).\n" }, { "from": "gpt", "value": "\nRAW_VALUE_BY_DEFAULT = False\n\n\ndef env_to_statement(env):\n ''' Return the abstraction description of an environment variable definition\n into a statement for she...
python
chosen
[ { "from": "system", "value": "Fix type in creation of fasta_dir biobox entry\n" }, { "from": "human", "value": "import os\nimport yaml\n\ndef generate(args):\n output = {\"version\" : \"0.9.0\", \"arguments\" : args}\n return yaml.safe_dump(output, default_flow_style = False)\n\ndef parse(...
python
chosen
[ { "from": "human", "value": "Read in train data to dataframe\n" }, { "from": "gpt", "value": "import pandas\n\n\ndef main():\n train_all = pandas.DataFrame.from_csv('train.csv')\n train = train_all[['Survived', 'Sex', 'Fare']]\n print(train)\n\n\nif __name__ == '__main__':\n main()\n...
python
chosen
[ { "from": "human", "value": "Add the missing migration in the members app.\n\nRef: issue #791\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-08-01 20:07\nfrom __future__ import unicode_literals\n\nimport annoying.fields\nfrom django.db import migra...
python
chosen
[ { "from": "human", "value": "Add changelog plugin and command.\n" }, { "from": "gpt", "value": "\"\"\"Command to get the bot's changelog by running git log on the current working directory.\"\"\"\n\nimport asyncio\nfrom asyncio.subprocess import PIPE\n\nfrom plumeria.command import commands\nfro...
python
chosen
[ { "from": "human", "value": "Add in a demo for embossing.\n" }, { "from": "gpt", "value": "# Kernel Filtering Example\n#\n# This example shows off how to use a generic kernel filter.\n\nimport sensor, image, time\n\nsensor.reset() # Initialize the camera sensor.\nsensor.set_pixformat(sensor.GRAY...
python
chosen
[ { "from": "human", "value": "Add an ipython pyface widget.\n\n\n" }, { "from": "gpt", "value": "#------------------------------------------------------------------------------\n# Copyright (c) 2008, Enthought, Inc.\n# All rights reserved.\n#\n# This software is provided without warranty under th...
python
chosen
[ { "from": "human", "value": "Add international_letters service permission for all services.\n" }, { "from": "gpt", "value": "\"\"\"\n\nRevision ID: 0328_international_letters_perm\nRevises: 0327_idx_notification_history\nCreate Date: 2020-08-10 14:12:02.870838\n\n\"\"\"\nfrom alembic import op\n...
python
chosen
[ { "from": "human", "value": "Add tool to drop a specific stage (for rerunning)\n" }, { "from": "gpt", "value": "import argparse\nimport os\nimport sys\n\nimport sqlitedict\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--state\",\n help...
python
chosen
[ { "from": "human", "value": "Add migration for new model field.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2016-03-18 21:40\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):...
python
chosen
[ { "from": "human", "value": "Add fixtures for connecting to Postgres test database\n" }, { "from": "gpt", "value": "import pytest\n\nfrom sqlalchemy import text\nfrom sqlalchemy.exc import ProgrammingError\nfrom sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine\nfrom sqlalchemy.ext....
python
chosen
[ { "from": "human", "value": "Add unit test for state diff method\n" }, { "from": "gpt", "value": "import random\nfrom copy import deepcopy\n\nfrom raiden.transfer.state import (\n ChainState,\n NettingChannelEndState,\n NettingChannelState,\n PaymentNetworkState,\n TokenNetworkSta...
python
chosen
[ { "from": "human", "value": "Add script to visualize pipestats.\n\nBug: 78765090\nChange-Id: If95a59a7020a835968aa9fdf1660b97b4ed6bb4e" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n# Copyright (C) 2018 The Android Open Source Project\n#\n# Licensed under the Apache License, Version 2.0 (th...
python
chosen
[ { "from": "human", "value": "Add API test for profile list\n\nAdd API test for profile list\n\nChange-Id: Ia317e86f253d84e3e00c68c5e9db6afbed6cf604\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in complian...
python
chosen
[ { "from": "human", "value": "Add GIN index to JSONB fields via migration\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom ashlar.models import RecordSchema, Record, ItemSchema\n\n\nclass Migration(...
python
chosen
[ { "from": "human", "value": "Create event in google calendar\n" }, { "from": "gpt", "value": "from apiclient.discovery import build\nfrom httplib2 import Http\nfrom oauth2client import file,client,tools\ntry:\n\timport argparse\n\tflags=argparse.ArgumentParser(parents=[tools.argparser]).parse_ar...
python
chosen
[ { "from": "human", "value": "Convert tfrecords to csv to be used in Spark.\n" }, { "from": "gpt", "value": "from subprocess import check_output\nimport tensorflow as tf\nimport csv\n\nVIDEO_LEVEL_DATA_FODLER = \"/Users/Sophie/Documents/youtube-8m-data/train/\"\n\nCSV_FILE_PATH = 'train.csv'\nwit...
python
chosen
[ { "from": "human", "value": "Add Redis commands to Redis Mass Insertion script\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n redis-mass.py\n ~~~~~~~~~~~~~\n Prepares a newline-separated file of Redis commands for mass insertion.\n\n :copyright: (c) 2015 by Tim Simm...
python
chosen
[ { "from": "human", "value": "Test for missing primary input in the workflow\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom tests.functional_tests import FunctionalTestBase, isolate\n\nclass TestErrorInWorkflow(FunctionalTestBase):\n\n @isolate\n def test_missing_primary_r...
python
chosen
[ { "from": "human", "value": "Add Python script to view a table in the db\n" }, { "from": "gpt", "value": "import os\nimport sqlite3\nimport sys\n\ntry:\n BASE_DIR = directory_name=sys.argv[1]\nexcept:\n BASE_DIR = os.path.dirname(os.path.abspath(__file__))\ndb_location = os.path.join(BASE_...
python
chosen
[ { "from": "human", "value": "Add the tag screen to display my personal information\n" }, { "from": "gpt", "value": "import Image\nimport ImageDraw\nimport ImageFont\nimport screen\n\ndef draw_rotated_text(image, text, position, angle, font, fill=(255,255,255)):\n # Get rendered font width and...
python
chosen
[ { "from": "human", "value": "Add migration for previous commit\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('contacts', '...
python
chosen
[ { "from": "human", "value": "Write basic test on generic list views\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.test import TestCase, Client\nfrom django.contrib.auth.models import User\nfrom django.utils import timezone\n\nfrom opps.articles.mode...
python
chosen
[ { "from": "human", "value": "Add appctl/Mode to evdev_teleport receiver bridge\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"\nThis node listens for appctl/Mode changes and toggles an evdev_teleport\nreceiver accordingly.\n\"\"\"\n\nimport rospy\nfrom appctl.msg import Mode\nfr...
python
chosen
[ { "from": "human", "value": "Write some locations to MongoDb\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\"\"\"\nCopyright 2011 Elliot Murphy\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 ...
python
chosen
[ { "from": "human", "value": "Add str to hex utility\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport sys\n\nif len(sys.argv) < 2:\n print('Incorrect usage')\n exit(1)\n\nfor char in sys.argv[1]:\n sys.stdout.write('\\\\x' + char.encode('hex'))\n" } ]
python
chosen
[ { "from": "human", "value": "Add a manul python test file.\n" }, { "from": "gpt", "value": "__author__ = 'QSG'\nimport unittest\nfrom selenium import webdriver\nfrom selenium.webdriver.support.wait import WebDriverWait\n# from selenium.webdriver.support import expected_conditions as EC\n# from s...
python
chosen
[ { "from": "human", "value": "Add test to constrain speed to positive\n" }, { "from": "gpt", "value": "import unittest\nfrom hunting.sim.entities import *\n\n\nclass TestFighter(unittest.TestCase):\n def test_base_speed_must_be_positive(self):\n with self.assertRaises(ValueError):\n ...
python
chosen
[ { "from": "human", "value": "Add a handler for performing client load testing.\n\nReview URL: http://codereview.appspot.com/3844044" }, { "from": "gpt", "value": "# Copyright 2011, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# mod...
python
chosen
[ { "from": "human", "value": "Add a new test script to evaluate status of different parsers.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\n\nimport os\nimport subprocess\n\n# ARGUMENTS:\n# 1 - path to the parser executable\n# 2 - path to the parser-lalr executable\n# 3 - p...
python
chosen
[ { "from": "human", "value": "Remove profile until QBO integration gets merged in\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2019-01-17 04:02\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migration...
python
chosen
[ { "from": "human", "value": "Add script that removes non-existent xml entries from shed_tool_conf.xml and migrated_tool_conf.xml\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n## Example usage: python clean_tool_conf.py -i /galaxy/config/shed_tool_conf.xml -o clean_shed_tool_conf.xml\...
python
chosen
[ { "from": "system", "value": "Fix Event.dispatch to return True if execution is to proceed\n" }, { "from": "human", "value": "# event system\n\nEVENT_CALLBACKS = {}\n\ndef add_listener(event, callback, priority = 5):\n if event not in EVENT_CALLBACKS:\n EVENT_CALLBACKS[event] = []\n\n ...
python
chosen
[ { "from": "human", "value": "Test the RQ task as well.\n" }, { "from": "gpt", "value": "# Lots of work to be done here!!!!\n\nfrom unittest import mock\n\nfrom django.test import TestCase\n\nfrom metaci.build.tasks import check_queued_build\nfrom metaci.conftest import (\n BuildFactory,\n ...
python
chosen
[ { "from": "human", "value": "Refactor journal abbreviations into seperate file\n" }, { "from": "gpt", "value": "\"\"\"Some additional journal abbreviations which are not provided by Crossref.\"\"\"\n\nJOURNAL_ABBRVS = {\n \"American Journal of Mathematics\": \"Am. J. Math.\",\n \"American ...
python
chosen
[ { "from": "human", "value": "message: Add migrations to correct has_* fields.\n\nThis follows up on changes to correctly set has_link, has_attachment,\nand has_image when rendering messages.\n\nFixes #12912.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.24 ...
python
chosen
[ { "from": "human", "value": "Add test for demonstrating new test utilities\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nfrom framework.test_framework import Testbed, TestEnv, require_on_aqm_node\nfrom framework.test_utils import *\n\ndef test_simple():\n\n def my_test(testcase):...
python
chosen