conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add inventory job creation command\n" }, { "from": "gpt", "value": "import boto\nimport datetime\n\nclass CommandCreateInventoryJobForVault(object):\n\n def execute(self, args, config):\n glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('con...
python
chosen
[ { "from": "human", "value": "Create tags test. test for create single tag and create tag in category\n" }, { "from": "gpt", "value": "# tests/test_vendor.py\n\n\nimport unittest\n\nfrom tests.base import BaseTestCase\nfrom project.models import LineItem, Component\nfrom project.inventory.forms i...
python
chosen
[ { "from": "human", "value": "Add decision tree helper functions\n" }, { "from": "gpt", "value": "def http://www.arthotel.bg/premium-paket-vino-i-lyubovmode(dataset):\n counts = { 0: 0, 1:0 }\n for entity in dataset:\n counts[entity[0]]++\n# What if they are equal?\n if counts[0] ...
python
chosen
[ { "from": "human", "value": "Use processor to implement page generating time\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\r\n\r\n\r\n##############################\r\n# Reqirement:\r\n# pip install web.py\r\n##############################\r\n\r\n\r\nimport web\r\n\r\n\r\nurls = (\r\...
python
chosen
[ { "from": "human", "value": "Add a test for lib.unzip\n" }, { "from": "gpt", "value": "# Run the following command to test:\n#\n# (in /usr/local/googkit)\n# $ python -m {test_module_name}\n#\n# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface\n#\n# We can...
python
chosen
[ { "from": "human", "value": "Add a basic test for follow_file()\n\nSigned-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com>\n" }, { "from": "gpt", "value": "\"\"\"\nTests for dhcp2nest.util\n\"\"\"\nfrom nose.tools import with_setup, eq_\nfrom tempfile import...
python
chosen
[ { "from": "human", "value": "Put xpdAcq startup script under version control.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n##############################################################################\n#\n# xpdacq by Billinge Group\n# Simon J. L. Billinge...
python
chosen
[ { "from": "human", "value": "[WIP] Add push urls unit test\n" }, { "from": "gpt", "value": "# coding=utf-8\n\nfrom django.test.client import Client\nfrom django.test import TestCase\nfrom push.views import *\n\nclass UrlResolveTests(TestCase):\n def test_url_index(self):\n c = Client()...
python
chosen
[ { "from": "human", "value": "Add Input and Output virtual devices\n" }, { "from": "gpt", "value": "class Output:\n \"\"\"A device which prints whatever gets passed to it\"\"\"\n def write(self, index, value):\n print(value)\n\n def read(self, index):\n pass\n\nclass Inpu...
python
chosen
[ { "from": "human", "value": "Add migration for Django 2.0\n" }, { "from": "gpt", "value": "# Generated by Django 2.0 on 2017-12-08 13:13\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('users', '0004_auto_20171022_1456'),\...
python
chosen
[ { "from": "human", "value": "Add an integration test to satisfy Travis\n" }, { "from": "gpt", "value": "\"\"\"\n\"\"\"\n\nfrom zazo import main\n\ndef test_main(capsys):\n retval = main()\n\n assert retval == 0\n assert capsys.readouterr() == (\"Hello World!\\n\", \"\")\n" } ]
python
chosen
[ { "from": "human", "value": "Add test cases for the logger\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logbook\nfr...
python
chosen
[ { "from": "human", "value": "Add tests for enums module.\n" }, { "from": "gpt", "value": "\"\"\"\n test_enums\n ~~~~~~~~~~\n\n Contains tests for the :mod:`~adbwp.enums` module.\n\"\"\"\nimport pytest\n\nfrom adbwp import enums\n\n\n@pytest.mark.parametrize(('enum_value', 'int_value'), ...
python
chosen
[ { "from": "human", "value": "Change label for date fields\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 ('gk_collections_wo...
python
chosen
[ { "from": "human", "value": "Add migration for changing ordering of Family field.\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 ...
python
chosen
[ { "from": "human", "value": "Add Front Gate Manager python file\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport urllib2\nimport RPi.GPIO as GPIO\nfrom time import sleep\n\nclass Sonos:\n apiPort = 5005\n apiHost = '127.0.0.1'\n\n def say(self, room, str, lang = ...
python
chosen
[ { "from": "system", "value": "Add TOPLEVEL pos to unify node pos interface\n" }, { "from": "human", "value": "import extlib.vimlparser\n\n\nclass Parser(object):\n def __init__(self, plugins=None):\n \"\"\" Initialize Parser with the specified plugins.\n The plugins can add attr...
python
chosen
[ { "from": "human", "value": "Add py solution for Binary Search Tree Iterator\n\nBinary Search Tree Iterator: https://leetcode.com/problems/binary-search-tree-iterator/\n" }, { "from": "gpt", "value": "# Definition for a binary tree node\n# class TreeNode(object):\n# def __init__(self, x):\n...
python
chosen
[ { "from": "human", "value": "Add unittest for the YAMLReporter\n" }, { "from": "gpt", "value": "import yaml\nimport time\n\nfrom twisted.trial import unittest\n\nfrom ooni.reporter import YAMLReporter\n\nclass MockTest(object):\n _start_time = time.time()\n report = {'report_content': 'ham...
python
chosen
[ { "from": "human", "value": "Add script: fix boost dylib id on Mac OSX [skip ci]\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\n# Copyright (c) 2013, Ruslan Baratov\n# All rights reserved.\n\nimport argparse\nimport glob\nimport os\nimport re\nimport subprocess\nimport sys\n\nparser ...
python
chosen
[ { "from": "human", "value": "Add a put_object sample script.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport pprint\nimport sys\nfrom os import environ as env\n\nfrom swiftclient.client import get_auth, put_object, put_container\nfrom swiftclient.exceptions import ClientExceptio...
python
chosen
[ { "from": "human", "value": "Print true if the character is present in the string\n" }, { "from": "gpt", "value": "def main():\n a=raw_input()\n c=raw_input()\n if a.find(c)>=0:\n print \"True\"\n else:\n print \"False\" \n\n # Write code here \n\nmain()\n" } ]
python
chosen
[ { "from": "human", "value": "Add core functionality for formatter\n" }, { "from": "gpt", "value": "import sys\n\ndef fixFormat(file_name):\n\n original = open(file_name, 'r')\n fixed_copy = open(\"fixed_\" + file_name, 'w')\n \n for line in original:\n line = line.replace('&lt...
python
chosen
[ { "from": "human", "value": "Add ability to load wordlists into useable datastructures.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nfrom collections import namedtuple\nimport csv\n\nWordList = namedtuple(\"WordList\", ['nouns', 'verbs', 'conjunctions', 'others'])\n\ndef load_wordl...
python
chosen
[ { "from": "human", "value": "Add tests for org task util\n" }, { "from": "gpt", "value": "import mock\nfrom requests import HTTPError\n\nfrom django.test import TestCase\n\nfrom temba.base import TembaAPIError\n\nfrom tracpro.test import factories\n\nfrom .. import utils\n\n\nclass TestRunOrgTas...
python
chosen
[ { "from": "human", "value": "Add initial code for exercise 43.\n" }, { "from": "gpt", "value": "class Scene(object):\n\n def enter(self):\n pass\n\nclass Engine(object):\n\n def __init__(self, scene_map):\n pass\n\n def play(self):\n pass\n\nclass Death(Scene):\n\n ...
python
chosen
[ { "from": "human", "value": "Add test for ping endpoint\n" }, { "from": "gpt", "value": "from flask.ext.resty import Api\nimport pytest\n\n# -----------------------------------------------------------------------------\n\n\n@pytest.fixture(autouse=True)\ndef routes(app):\n api = Api(app, '/ap...
python
chosen
[ { "from": "human", "value": "Add a brute force solution for the maximum subarray\n" }, { "from": "gpt", "value": "# brute force solution\n# it works, but Time Limit Exceeded in leetcode\nclass Solution1:\n # @param {integer[]} nums\n # @return {integer}\n def maxSubArray(self, nums):\n ...
python
chosen
[ { "from": "human", "value": "Add extra utility to generate a URL list.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\" twitch_channels.py - Queries Twitch for channels of interest.\n Used in conjunction with livestreamer-completion.\n\n Usage examples:\n\n ./twitch_chan...
python
chosen
[ { "from": "human", "value": "Add tool for debug of Calisphere id.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Use this to get data from the couchdb instance for a record from calisphere\n# defaults to the staging environment\nimport sys\nimport argparse\nimport urllib\nimport Con...
python
chosen
[ { "from": "human", "value": "Add a wget replacement for platforms that don't have wget\n\nsvn:r13313\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n###\n### Simple HTTP download utility for platforms without wget\n###\n### Copyright 2008 Steven J. Murdoch <http://www.cl.cam.ac.uk/users/sj...
python
chosen
[ { "from": "human", "value": "Add test for calcprops in pipeline related objects\n" }, { "from": "gpt", "value": "import pytest\n\ndef test_analysis_step_version_name_calcprop(testapp, analysis_step_version):\n assert analysis_step_version['minor_version'] == 0\n assert analysis_step_versio...
python
chosen
[ { "from": "human", "value": "Test response code of current user's (HTML) page\n" }, { "from": "gpt", "value": "\"\"\"\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom tests.base import AbstractAppTestCase\n\n\nclass CurrentUserTestCase...
python
chosen
[ { "from": "human", "value": "Add form validation for target\n" }, { "from": "gpt", "value": "from django.forms import ModelForm\nfrom breach.models import Target\n\n\nclass TargetForm(ModelForm):\n class Meta:\n model = Target\n fields = (\n 'name',\n 'endp...
python
chosen
[ { "from": "human", "value": "Add migration to prune toi\n" }, { "from": "gpt", "value": "from redis import StrictRedis\nfrom tilequeue.cache import RedisCacheIndex\nfrom tilequeue.config import make_config_from_argparse\nfrom tilequeue.tile import coord_unmarshall_int\n\ncfg = make_config_from_a...
python
chosen
[ { "from": "human", "value": "Add missing python script to explore python config and set vars in cmake\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>\n# All rights reserved.\n#\n# Redistribution and use in source and ...
python
chosen
[ { "from": "human", "value": "Add two dimensional forward python solver\n" }, { "from": "gpt", "value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\nimport seaborn as sns\nsns.set()\n\nfig = plt.figure()\n\nN = 31\nh = 1.0/(N-1)\nt = 1\nt_steps =...
python
chosen
[ { "from": "system", "value": "Remove duplicate 'context': context in GitHub renderer.\n" }, { "from": "human", "value": "from flask import abort, json\nimport requests\n\n\ndef render_content(text, gfm=False, context=None, username=None, password=None):\n \"\"\"Renders the specified markup us...
python
chosen
[ { "from": "human", "value": "Add tests for `v2ex sign`\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n Tests for the `v2ex last` function\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport pytest\n\nfrom v2ex_daily_mission...
python
chosen
[ { "from": "human", "value": "Add migration for survey application\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\nclass Migration(SchemaM...
python
chosen
[ { "from": "human", "value": "Add a real-time frequency meter example\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nfrom phasortoolbox import PDC,Client\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nclass FreqMeter(o...
python
chosen
[ { "from": "human", "value": "Add datamigration from mozillians.geo data to cities_light.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.db.models import Q\n\n\ndef migrate_countries(apps, schema_e...
python
chosen
[ { "from": "human", "value": "Add script for adding B/W locations\n\nin the hope that it will be useful in future generations.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n\nfrom codecs import open\n\nfrom pokedex.db import connect, identifier_from_name\nfrom pokedex.db.tables import ...
python
chosen
[ { "from": "human", "value": "Add a script to download all the fully free tracks from Jamendo (as Ogg Vorbis)\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Jamendo database dumps can be fetched from: http://img.jamendo.com/data/dbdump_artistalbumtrack.xml.gz\n\nimport xml.etree.cEle...
python
chosen
[ { "from": "human", "value": "Package for Melange specific views added.\n\nIt will contain modules with view classes and functions that are not specific neither CI nor SOC package.\n" }, { "from": "gpt", "value": "# Copyright 2013 the Melange authors.\n#\n# Licensed under the Apache License, Vers...
python
chosen
[ { "from": "human", "value": "Add test for np.empty 1d case\n" }, { "from": "gpt", "value": "from __future__ import print_function, absolute_import, division\n\nimport numpy as np\n\nfrom numba import unittest_support as unittest\nfrom numba import njit\n\n\nclass TestDynArray(unittest.TestCase):...
python
chosen
[ { "from": "human", "value": "Remove default permissions in the \"output\" app, since irrelevant\n" }, { "from": "gpt", "value": "# Copyright (C) 2013 by Johan De Taeye, frePPLe bvba\n#\n# This library is free software; you can redistribute it and/or modify it\n# under the terms of the GNU Affero...
python
chosen
[ { "from": "human", "value": "Write function that returns first instance of non-repeating character in input string\n" }, { "from": "gpt", "value": "# Given a string s, find and return the first instance of a non-repeating character in it. If there is no such character, return '_'\n# function on...
python
chosen
[ { "from": "human", "value": "Add tests for dynamodb throughput.\n\nPiperOrigin-RevId: 445294911\n" }, { "from": "gpt", "value": "# Copyright 2022 PerfKitBenchmarker Authors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ...
python
chosen
[ { "from": "human", "value": "Add unit tests for Block\n" }, { "from": "gpt", "value": "import unittest\n\nfrom struct import error\nfrom DAT.Block import Block, BlockChain\n\n\nclass TestBlock(unittest.TestCase):\n\n def test_parse_valid_blob(self):\n blob = \"\\xEF\\xBE\\xAD\\xDE\"\n...
python
chosen
[ { "from": "human", "value": "Add tests for yatsm cache CLI\n" }, { "from": "gpt", "value": "\"\"\" Tests for ``yatsm cache``\n\"\"\"\nfrom click.testing import CliRunner\nimport pytest\n\nfrom yatsm.cli.main import cli\n\n\ndef test_cli_cache_pass_1(example_timeseries, example_results, modify_co...
python
chosen
[ { "from": "human", "value": "Add PyQt5 gui for the matcher\n" }, { "from": "gpt", "value": "#!/usr/bin/python2\n\nimport signal\nsignal.signal(signal.SIGINT, signal.SIG_DFL)\nimport sys\nimport os\nfrom PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QVBoxLayout, QHBoxLayout, QLabel,...
python
chosen
[ { "from": "human", "value": "Add a signal timeout handler\n\nMany thanks to @ekimekim for writing this.\n" }, { "from": "gpt", "value": "# Taken from https://gist.github.com/ekimekim/b01158dc36c6e2155046684511595d57\nimport os\nimport signal\nimport subprocess\n\n\nclass Timeout(Exception):\n ...
python
chosen
[ { "from": "human", "value": "Add file sql tutorial with sqlachemy\n" }, { "from": "gpt", "value": "#!/usr/bin/python2\n\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer, String, Sequence\nfrom sqlalchemy.orm im...
python
chosen
[ { "from": "human", "value": "Add tests that check for database access during status and stop commands.\n" }, { "from": "gpt", "value": "\"\"\"\nTests for `kolibri.utils.cli` module.\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nfrom mock import patch\n...
python
chosen
[ { "from": "human", "value": "Variable: Add new test for custom variable initialisation to check types\n" }, { "from": "gpt", "value": "from parcels import Grid, ScipyParticle, JITParticle, Variable\nimport numpy as np\nimport pytest\n\n\nptype = {'scipy': ScipyParticle, 'jit': JITParticle}\n\n\n...
python
chosen
[ { "from": "human", "value": "Add test coverage for security module\n" }, { "from": "gpt", "value": "#\n# (C) Copyright IBM Corp. 2017\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a co...
python
chosen
[ { "from": "human", "value": "Add simple web service for Eidos reading\n" }, { "from": "gpt", "value": "import json\nfrom flask import Flask, request\nfrom indra.sources.eidos.eidos_reader import EidosReader\n\n\napp = Flask(__name__)\n\n\n@app.route('/process_text', methods=['POST'])\ndef proces...
python
chosen
[ { "from": "human", "value": "Add placeholder for relu gradient tests\n" }, { "from": "gpt", "value": "import pytest\n\n\n@pytest.mark.skip\ndef test_relu_clips_negative(model, input_BI):\n # TODO: There was a bug related to this\n pass\n\n\n@pytest.mark.skip\ndef test_relu_clipped_gradient...
python
chosen
[ { "from": "human", "value": "Add skeleton code for fetching and updating database data. Hard coded for now\n" }, { "from": "gpt", "value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with t...
python
chosen
[ { "from": "human", "value": "Add test for cps file\n" }, { "from": "gpt", "value": "import pytest\n# from ogusa.execute.scipts import runner\n\ndef test_set_data(monkeypatch):\n \"\"\"\n Check that setting `data` to 'cps' uses cps data\n \"\"\"\n from ogusa.txfunc import get_tax_func...
python
chosen
[ { "from": "human", "value": "Add a migration script accounting for flask changes\n\nPer the script's docstring, the only thing about the schema that's\nchanged is that the table names Flask-SQLAlchemy generates are slightly\ndifferent. The schema is otherwise the same, with one caveat:\n\nWith Postgres, for...
python
chosen
[ { "from": "human", "value": "Add migration: add 'private' field to Post table, drop Photo table\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 530a92c42c5\nRevises: 3255e6bed08\nCreate Date: 2016-08-09 19:46:36.752946\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nr...
python
chosen
[ { "from": "human", "value": "Add command to testing future implementation of get multiple records for driver profile.\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom driver27.models import Driver, Competition, Season\nfrom driver27.records...
python
chosen
[ { "from": "human", "value": "Add contrib code to load GP data from Celestrak\n" }, { "from": "gpt", "value": "\"\"\"\nAuthor: Juan Luis Cano Rodríguez\n\nCode to read GP data from Celestrak using the HTTP API and python-sgp4.\n\nRequires some extra dependencies:\n\n $ pip install httpx sgp4\n\n...
python
chosen
[ { "from": "human", "value": "Add new utility to make source documents\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# mk_topic.py\n#\n# Make a notebook for a new topic\n#\nimport datetime\nimport os\nimport sys\n\nimport lib\nfrom jinja2 import Environment, FileSystemLoader\nfrom li...
python
chosen
[ { "from": "human", "value": "Add implementation of matrix factorization\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport numpy\n\n\ndef matrix_factorization(R,\n P,\n Q,\n K,\n train_step=...
python
chosen
[ { "from": "human", "value": "Add the consistency config file\n" }, { "from": "gpt", "value": "from config.experiment_config_lib import ControllerConfig\nfrom sts.topology import BufferedPatchPanel\nfrom sts.topology import ConsistencyTopology\nfrom sts.controller_manager import UserSpaceControll...
python
chosen
[ { "from": "system", "value": "Change the warning message, since this will only affect v1.1 and up [skip ci]\n" }, { "from": "human", "value": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nimport warnings\n\nfrom .commands.test i...
python
chosen
[ { "from": "human", "value": "Add python implementation of toh\n" }, { "from": "gpt", "value": "def move( n, src, dest, temp ):\n\n\tif n >= 1 : \n\t\tmove( n - 1, src, temp, dest )\n\t\n\t\tprint( \"Moving %d -> %d\" % (src, dest))\n\n\t\tmove( n - 1, temp, dest, src )\n\n\ndef main():\n\tmove(3...
python
chosen
[ { "from": "human", "value": "Add function to load neighborhood data\n" }, { "from": "gpt", "value": "# Copyright (c) 2013 Azavea, Inc.\n# See LICENSE in the project root for copying permission\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.gis.utils import LayerMappi...
python
chosen
[ { "from": "human", "value": "Add classe RandList.py para gerar um deck embaralhado\n" }, { "from": "gpt", "value": "# encoding:utf-8\n\nimport random\n\ndef main():\n rl = RandList(500, 1000)\n rl.gen_random_list()\n rl.print_block_list()\n print \"\\n\\nPronto!\"\n\nclass RandList(o...
python
chosen
[ { "from": "human", "value": "Add a data migration to move more ResultEvent fields to Popolo models\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef migrate_remaining_fields_to_popolo_models(apps, schema...
python
chosen
[ { "from": "human", "value": "Add migration for additional slug fields.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.7 on 2016-09-19 11:49\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mi...
python
chosen
[ { "from": "human", "value": "Add utility script for searching Jenkins console logs\n\nThis small python script can be used to quickly check the last\n100 (or more if you're willing to edit and wait) to see if a\nstring is present within the console log. This can help find\ninstances of errors to help determ...
python
chosen
[ { "from": "human", "value": "Change the field escuela in the Integrante form to plantel. And add a\noptional value escuela to all members\n\nMerge migrations\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2017-06-21 22:19\nfrom __future__ import unicode...
python
chosen
[ { "from": "human", "value": "Transform boto3.ServiceRequest to look like dynamic class\n\n`boto3.resource` creates resources dynamically via a resource factory.\nUnfortunately that completely breaks static analysis leading to spurious\nfalse positives since pylint cannot determine sanely that attributes\nex...
python
chosen
[ { "from": "system", "value": "Fix invalid key (nice docs circleci)\n" }, { "from": "human", "value": "import subprocess\n\nfrom flask import Blueprint, request, current_app\n# from rowboat.redis import rdb\n# from rowboat.util.decos import authed\n\nfrom disco.types.message import MessageEmbed\n...
python
chosen
[ { "from": "human", "value": "Implement example codes to use Cars196 with the modified SerialIterator\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Jan 23 13:09:27 2017\n\n@author: sakurai\n\"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom ch...
python
chosen
[ { "from": "human", "value": "Add tests for assets version extraction\n" }, { "from": "gpt", "value": "import unittest\nfrom hamcrest import *\n\nfrom service.smplayservice import SmPlayServiceStarter\nfrom smcontext import SmContext, SmApplication\n\nclass TestSmPlayService(unittest.TestCase):\n...
python
chosen
[ { "from": "human", "value": "Add some simple tests for file formats.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nimport unittest\n\nfrom blivet.formats import device_formats\nimport blivet.formats.fs as fs\n\...
python
chosen
[ { "from": "human", "value": "Add script to co-add repeat visits of stars\n" }, { "from": "gpt", "value": "\n\n\"\"\"\nStack RAVE spectra from repeat visits.\n\"\"\"\n\nimport cPickle as pickle\nimport os\nimport numpy as np\nfrom astropy.table import Table\n\nparent_spectrum_dir = \"/data/gaia-e...
python
chosen
[ { "from": "human", "value": "Add kubernetes.client.apis as an alias to kubernetes.client.api\n\nReference: https://github.com/kubernetes-client/python/issues/974\n\nSigned-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>\n" }, { "from": "gpt", "value": "from __future__ im...
python
chosen
[ { "from": "human", "value": "Add program for anagram in string_fundamental.\n" }, { "from": "gpt", "value": "\"\"\"\n An anagram of a string is another string that contains same characters, only the order of characters can be different.\n For example \"qwerty\" and \"werqty\" are anagrams of eac...
python
chosen
[ { "from": "human", "value": "Solve equality in a array\n" }, { "from": "gpt", "value": "from collections import Counter\n\nsize = int(input().strip())\ncounts = Counter((map(int, input().strip().split(' '))))\nelement, count = counts.most_common(1)[0]\nprint (size - count)\n" } ]
python
chosen
[ { "from": "human", "value": "Add test for constraint bindings\n" }, { "from": "gpt", "value": "import pytest\nimport toppra.cpp as tac\n\n\ndef test_linear_vel():\n c = tac.LinearJointVelocity([-1, -1], [1, 1])\n c.discretizationType = tac.DiscretizationType.Interpolation\n\n assert c.h...
python
chosen
[ { "from": "human", "value": "Add unit testing for sequence average pool operator.\n" }, { "from": "gpt", "value": "import unittest\nimport numpy as np\nfrom op_test import OpTest\n\n\nclass TestSeqAvgPool1D(OpTest):\n def setUp(self):\n self.op_type = 'sequence_avg_pool'\n # one...
python
chosen
[ { "from": "human", "value": "Add script to make some test data\n" }, { "from": "gpt", "value": "import sqlite3\n\n\nINSERT_SONG = '''\nINSERT INTO jukebox_song_queue VALUES (?)\n'''\n\nTEST_URIS = [\n 'spotify:track:5lB3bZKPhng9s4hKB1sSIe', \n 'spotify:track:5MSfgtOBZkbxlcwsI9XNpf',\n '...
python
chosen
[ { "from": "human", "value": "Add a cli for ontology report generator\n" }, { "from": "gpt", "value": "from etk.ontology_api import Ontology\nfrom etk.ontology_report_generator import OntologyReportGenerator\n\n\ndef add_arguments(parser):\n parser.description = 'Generate HTML report for the i...
python
chosen
[ { "from": "human", "value": "Relocate dict generator for the locations.\n" }, { "from": "gpt", "value": "def get_location_dict(item, location_type):\n return {\n 'type': location_type,\n 'latitude': item.position.latitude,\n 'longitude': item.position.longitude,\n ...
python
chosen
[ { "from": "human", "value": "Test suite for new gettext.py module.\n" }, { "from": "gpt", "value": "import os\nimport gettext\n\ndef get_qualified_path(name):\n \"\"\"Return a more qualified path to name\"\"\"\n import sys\n import os\n path = sys.path\n try:\n path = [os.p...
python
chosen
[ { "from": "human", "value": "Implement solution for sum of first 1000 primes\n" }, { "from": "gpt", "value": "\ndef gen_primes():\n # logic from Sieve of Eratosthenes\n # by David Eppstein, UC Irvine, 28 Feb 2002\n # http://code.activestate.com/recipes/117119/\n # changed var names\n...
python
chosen
[ { "from": "human", "value": "Add dummy int/long object implementing Number\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nint/long implementation.\n\"\"\"\n\nfrom __future__ import print_function, division, absolute_import\n\nfrom ... import jit, implements, typeof\nfrom ..i...
python
chosen
[ { "from": "human", "value": "Implement GCI url patterns module based on the core url patterns module.\n\nThis code is partly taken from Selwyn's patches during GSoC 2011. Thanks\nto Selwyn for the patch.\n\n--HG--\nextra : rebase_source : a64b9d703c2e309084a77aec627b8c7160186c66\n" }, { "from": "gpt...
python
chosen
[ { "from": "human", "value": "Add a tool script to make geom.json files.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)\n\n# This script is provided under the terms and conditions of the MIT license:\n#...
python
chosen
[ { "from": "human", "value": "Split functions to avoid eventlet import.\n\nSome of these functions are used in setup.py. In a virtualenv\nbased workflow, python setup.py sdist is called to create a\ntarball which is then installed into the virtualenv. These\nfunctions need to be in a separate file so that th...
python
chosen
[ { "from": "human", "value": "Create script to compare resource id of all volumes\n" }, { "from": "gpt", "value": "from faasclient.client import Client\n\n\ncredential = get_credentials_for(Environment.objects.get(name='dev'), CredentialType.FAAS)\nfaas_client = Client(\n authurl=credential.endp...
python
chosen
[ { "from": "human", "value": "Add test for relative root_map.\n" }, { "from": "gpt", "value": "import pathlib\nimport shutil\n\nfrom bluesky.plans import count\nfrom databroker._drivers.jsonl import BlueskyJSONLCatalog\nimport intake\nfrom ophyd.sim import img\nimport pytest\nfrom suitcase.jsonl ...
python
chosen
[ { "from": "human", "value": "Add plugin for venue Jack the rooster.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nfrom typing import List\n\nimport lxml.html\n\nimport re\nimport time\n\nfrom venues.abstract_venue import AbstractVenue\n\n\nclass Jacktherooster...
python
chosen
[ { "from": "human", "value": "Add missing migrations related to video URL\n\nRelated to #668\n\nSigned-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2020-06-17 18:07\nfrom __future__ ...
python
chosen