conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add second migration, it works!\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom oopgrade import oopgrade\nimport netsvc\n\n\ndef migrate(cr,v):\n print \"somenergia-generationkwh_0.0.1.2: Hem entrat al Migrate\"\n return\n\ndef up(cursor, installed_versio... | python | chosen |
[
{
"from": "human",
"value": "Add tests for patient lists templatetags\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUnittests for opal.templatetags.patient_lists\n\"\"\"\nfrom mock import MagicMock\n\nfrom opal.core.test import OpalTestCase\n\nfrom opal.tests.test_patient_lists import TestTabbedPatie... | python | chosen |
[
{
"from": "human",
"value": "Add a broken test for a Double Pinch Heat Exchanger\n"
},
{
"from": "gpt",
"value": "import components as comp\nfrom model import DnaModel\n\n#for plotting:\nfrom numpy import linspace\nimport matplotlib.pyplot as plt\n\ndef round_down(num, divisor):\n return num ... | python | chosen |
[
{
"from": "human",
"value": "Add test for dead code removal.\n"
},
{
"from": "gpt",
"value": "from numba import compiler, typing\nfrom numba.targets import cpu\nfrom numba import types\nfrom numba.targets.registry import cpu_target\nfrom numba import config\nfrom numba.annotations import type_an... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract the crosswalk between msas and tracts\n"
},
{
"from": "gpt",
"value": "\"\"\"crosswalk_msa_tract.py\n\nExtract the crosswalk between 2000 msa and tracts.\n\"\"\"\nimport os\nimport csv\n\n#\n# Import data\n#\n\n## MSA to counties crosswalk\n# co... | python | chosen |
[
{
"from": "human",
"value": "Add work queue example using streams.\n"
},
{
"from": "gpt",
"value": "import threading\nimport time\n\nfrom walrus import Walrus\n\n\ndb = Walrus()\n\ndef create_consumer_group():\n consumer = db.consumer_group('tasks-cg', ['tasks'])\n if not db.exists('tasks'... | python | chosen |
[
{
"from": "human",
"value": "Add migration for iSpindel temperature correction\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.0.11 on 2020-11-27 19:22\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('gravity', '0... | python | chosen |
[
{
"from": "human",
"value": "Add code to send promotional mails\n"
},
{
"from": "gpt",
"value": "from contextlib import contextmanager\n\nfrom email.mime.text import MIMEText\nfrom email.utils import formatdate\n\nfrom cfg import config, parse_end_date\n\nimport os\nimport re\n\nfrom teammails i... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating x25519 keys\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport base64\ntry:\n import nacl.public\nexcept ImportError:\n print('PyNaCl is required: \"pip install pynacl\" or similar')\n exit(1)\n\n\ndef key_str(key):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Reboot script for run_on_swarming_bots\n\nChange-Id: I01c72ef2157660e5d7f3c5d47a9b30fa78054e9f\nReviewed-on: https://skia-review.googlesource.com/135381\nAuto-Submit: Ben Wagner <3ef7217be91069877d94f7907ce5479000772cd3@google.com>\nCommit-Queue: Kevin Lubick <7cdab2cfab351f... | python | chosen |
[
{
"from": "human",
"value": "Support for creating S3 buckets.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2013, Bob Van Zant <bob@veznat.com>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty, Tags\n\n\nclass WebsiteConfiguration(AWSPro... | python | chosen |
[
{
"from": "human",
"value": "Test ability to log in\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom selenium import webdriver\nfrom selenium.webdriver.common.keys import Keys\n\nclass LoginTestCase(unittest.TestCase):\n\n def setUp(self):\n self.browser = webdriver.Firefox()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add LAPS module thx to @T3KX\n"
},
{
"from": "gpt",
"value": "from impacket.ldap import ldapasn1 as ldapasn1_impacket\n\nclass CMEModule:\n '''\n Module by technobro refactored by @mpgn (now compatible with LDAP protocol + filter by computer)\n\n Initial... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the charge filter."
},
{
"from": "gpt",
"value": "\n\"\"\"\nUnit tests for the charge filter\n\n\"\"\"\nimport unittest\n\nimport numpy as np\n\nfrom ....state import lattice\nfrom .. import chargeFilter\nfrom .. import base\n\n\n######################... | python | chosen |
[
{
"from": "system",
"value": "Add a comma here to help out people who modify this file.\n\nSee https://bugzilla.redhat.com/show_bug.cgi?id=1184523\n"
},
{
"from": "human",
"value": "# Setup fedmsg logging.\n# See the following for constraints on this format https://bit.ly/Xn1WDn\nbare_format = \... | python | chosen |
[
{
"from": "human",
"value": "Add test that uses function pointer.\n"
},
{
"from": "gpt",
"value": "'''\nTest parallel-vectorize with numpy.fromfunc.\nUses the work load from test_parallel_vectorize.\nThis time we pass a function pointer.\n'''\n\nfrom test_parallel_vectorize import *\n\nimport nu... | python | chosen |
[
{
"from": "human",
"value": "Add one smoketest to str(sampleset)\n"
},
{
"from": "gpt",
"value": "# Copyright 2019 D-Wave Systems Inc.\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 o... | python | chosen |
[
{
"from": "human",
"value": "Add db connection pool example"
},
{
"from": "gpt",
"value": "class ConnectionPool():\n \"\"\"\n Usage:\n conn_pool = nmi_mysql.ConnectionPool(config)\n db = conn_pool.get_connection()\n db.query('SELECT 1', [])\n conn_pool.return_co... | python | chosen |
[
{
"from": "human",
"value": "Implement backpropagation algorithm for neural network\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport math\nimport numpy as np\n\n\ndef sigmoid(x):\n return 1.0 / (1 + np.exp(-x))\n\n\ndef sigmoid_derivate(x):\n return x * (1 - x)\n\n\ndef main():... | python | chosen |
[
{
"from": "human",
"value": "[12.0][MIG][WIP] Move test from l10n_br_sale_product to l10n_br_sale.\n"
},
{
"from": "gpt",
"value": "# @ 2019 Akretion - www.akretion.com.br -\n# Magno Costa <magno.costa@akretion.com.br>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\nim... | python | chosen |
[
{
"from": "human",
"value": "Add function to simulate load of CSR merge matrix\n"
},
{
"from": "gpt",
"value": "import random\nimport itertools as it\nfrom sklearn.externals import joblib\n\ndef simulate_loads(nfrag, ngt, q):\n loads = [1] * nfrag\n active = set(range(nfrag))\n for k in... | python | chosen |
[
{
"from": "system",
"value": "Print the stack info more clearly, when holding the global lock for too long\n"
},
{
"from": "human",
"value": "import threading\nimport contextlib\nimport time\nimport traceback\nimport logging\n\n\n_lock = threading.Lock()\n\n\n@contextlib.contextmanager\ndef lock... | python | chosen |
[
{
"from": "human",
"value": "Load the Sovereignty xml and process\n\nCompose a list of SystemID to SystemName mappings\n"
},
{
"from": "gpt",
"value": "import lxml\nimport json\nimport urllib\nfrom lxml import etree\n\ntmpresponce = urllib.urlopen(\"https://api.eveonline.com/map/Sovereignty.xml.... | python | chosen |
[
{
"from": "human",
"value": "Update object status to Draft when null, CORE-1519\n"
},
{
"from": "gpt",
"value": "\n\"\"\"Update status column to draft\n\nRevision ID: 16883afbc18b\nRevises: 56bda17c92ee\nCreate Date: 2015-03-26 19:01:26.702662\n\n\"\"\"\n\n# revision identifiers, used by Alembic... | python | chosen |
[
{
"from": "human",
"value": "Add a data migration which deletes any stock items which have been scheduled for deletion.\n\nAlso deletes any instance of the \"delete_old_stock_items\" worker task\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.2.5 on 2021-12-05 06:33\n\nfrom django.db im... | python | chosen |
[
{
"from": "human",
"value": "Add a utility script to add source header\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport itertools\nimport os\nimport re\nimport traceback\nfrom optparse import OptionParser\n\nheader_path = \"source_header.txt\"\n\ndef debug(s):\n sy... | python | chosen |
[
{
"from": "human",
"value": "Add handlers for internal/user errors, not found, method not allowed\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, absolute_import, division\nimport re\nimport json\nfrom uuid import uuid4\n\nimport falcon.responders\nfrom falcon import HT... | python | chosen |
[
{
"from": "human",
"value": "Add a script to check if all function are wraped to Python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nCheck that all the functions defined in the chemfiles-sys crate are\neffectivelly used in the chemfiles binding.\n\"\"\"\nimport os\n\nROOT = os... | python | chosen |
[
{
"from": "system",
"value": "Make the blobstore service wsgi handler only serve our upload handler view\n"
},
{
"from": "human",
"value": "import os\nimport threading\nimport logging\n\n\nblobstore_service = None\nserver = None\n\n\ndef start_blobstore_service():\n \"\"\"\n When the b... | python | chosen |
[
{
"from": "human",
"value": "Use color transformation functions from scikit-image for now, even though it is a bit slower (there seems to be a bug somewhere in my manual implementation).\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.colors as mcolors\nfrom skimage.color ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for new `max_length` of field `username`.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.29 on 2022-06-30 14:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migrati... | python | chosen |
[
{
"from": "human",
"value": "Add an analog to `pipeline` to deal with proposals\n\nSome of the underlying commands aren't using dependencies properly, so there's\nsignificant rebuilding every run. That said, it works!\n"
},
{
"from": "gpt",
"value": "import click\n\nfrom regparser.commands.annua... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add date_created field to response.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-11-07 22:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.utils.t... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the twitter_username validator\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom ..forms import BasePersonForm\n\nclass TestValidators(TestCase):\n\n def test_twitter_bad_url(self):\n form = BasePersonForm({\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration file for exif change.\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.12 on 2020-04-12 11:11\n\nimport django.contrib.postgres.fields.hstore\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependen... | python | chosen |
[
{
"from": "human",
"value": "Add tests for 01 challenge.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom solution import body_mass_index, shape_of\n\n\nclass TestBodyMassIndex(unittest.TestCase):\n def test_body_mass_index(self):\n self.assertEqual(body_mass_index(90, 2), 22.5)\... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights remove array part problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Remove Array Part Problem\n\n\ndef removeArrayPart(inputArray, l, r):\n return inputArray[:l] + inputArray[r + 1:]\n\n\ndef main():\n tests = [\n... | python | chosen |
[
{
"from": "human",
"value": "Add usage example for FSlowTask\n"
},
{
"from": "gpt",
"value": "from unreal_engine import FSlowTask\nimport time\n\n# Create an FSlowTask object, defining the amount of work that\n# will be done, and the initial message.\nt = FSlowTask(10, \"Doing Something\")\nt.in... | python | chosen |
[
{
"from": "human",
"value": "Copy DesignDocument class to its own module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n_design_document_\n\nClass representing a Cloudant design document\n\n\"\"\"\nfrom .document import Document\nfrom .views import View\n\n\nclass DesignDocument... | python | chosen |
[
{
"from": "human",
"value": "Test that --help returns the options we expect it to\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\nimport sys\nimport unittest\n\nimport mopidy\n\nclass HelpTest(unittest.TestCase):\n def test_help_has_mopidy_options(self):\n mopidy_dir = o... | python | chosen |
[
{
"from": "human",
"value": "Add first version of percent unmergeable PRs script."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"Print the percentage of unmergeable PRs and some associated stats.\"\"\"\n\nimport github_tools\n\nRepo = github_tools.get_repo()\nmerge_true = 0\nmerg... | python | chosen |
[
{
"from": "human",
"value": "Create test cache page new style\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom unittest import TestCase\nfrom django.http import HttpRequest\n\nfrom opps.core.cache import cache_page\n\n\nclass DecoratorsTest(TestCase):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add an index to compute_node_stats\n\nThis will improve the performance of scheduler lookups of compute nodes\nand their associated stats.\n\nbug 1177487\n\nChange-Id: I0e04849543916e874ea0ddfc76c3d70ff71c09d0\n"
},
{
"from": "gpt",
"value": "# Copyright 2013 Rackspa... | python | chosen |
[
{
"from": "human",
"value": "Add top script to generate binaries from scratch.\n"
},
{
"from": "gpt",
"value": "import subprocess\r\nimport os\r\n\r\nPYVER = \"2.5\"\r\n\r\n# Bootstrap\r\nsubprocess.check_call(['python', 'prepare_bootstrap.py'])\r\n\r\n# Build binaries\r\nsubprocess.check_call([... | python | chosen |
[
{
"from": "human",
"value": "Add script to randomly choose n packages\n\nSigned-off-by: Harsh Gupta <c4bd8559369e527b4bb1785ff84e8ff50fde87c0@gmail.com>\n"
},
{
"from": "gpt",
"value": "import argparse\nimport numpy as np\nparser = argparse.ArgumentParser()\nparser.add_argument(\"package_list\",... | python | chosen |
[
{
"from": "human",
"value": "feat: Add permission list checking feature\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nimport requests\n\ndef get(access_token):\n h={'Authorization': 'Bearer ' + access_token}\n r=requests.get('https://api.line.me/v1/permissions', headers=h)\n print... | python | chosen |
[
{
"from": "system",
"value": "Use max_length=255 instead of 256 to be nice to MySQL indexing\n\nSigned-off-by: Patrick Lauber <13f2d5de65599746f4871ec052d451e6ee4f4f27@divio.ch>"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _... | python | chosen |
[
{
"from": "human",
"value": "Add tests for sip module\n"
},
{
"from": "gpt",
"value": "import pytest\n\ndef test_sip():\n \"\"\"Test the qtpy.sip namespace\"\"\"\n sip = pytest.importorskip(\"qtpy.sip\")\n\n assert sip.assign is not None\n assert sip.cast is not None\n assert sip.... | python | chosen |
[
{
"from": "human",
"value": "Add test for valid registration form\n"
},
{
"from": "gpt",
"value": "import wtforms_json\nimport pytest\n\nfrom forms.RegistrationForm import RegistrationForm\n\nwtforms_json.init()\n\n\nclass TestRegistrationForm:\n\n def test_valid(self):\n json = {\n ... | python | chosen |
[
{
"from": "human",
"value": "Add start of photo plugin\n"
},
{
"from": "gpt",
"value": "outputs = []\nfiles = []\n\ndef process_message(data):\n if data['channel'].startswith(\"D\"):\n outputs.append([data['channel'], \"I shall send you an image!\" ])\n files.append([data['chann... | python | chosen |
[
{
"from": "human",
"value": "Add command to delete archives\n"
},
{
"from": "gpt",
"value": "import boto\nfrom boto.glacier.exceptions import UnexpectedHTTPResponseError\n\nclass CommandDeleteArchiveFromVault(object):\n\n def execute(self, args, config):\n glacier_connection = boto.connect_g... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 98\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDefinition of ListNode\nclass ListNode(object):\n\n def __init__(self, val, next=None):\n self.val = val\n self.next = next\n\"\"\"\nclass Solution:\n \"\"\"\n @param... | python | chosen |
[
{
"from": "human",
"value": "Make model field `Stargazer.role` not nullable\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 (... | python | chosen |
[
{
"from": "human",
"value": "Add a Command to Migrate UserProfile.name_en\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nfrom django.core.management.base import BaseCommand\nfrom django.db import connection, migrations\nfrom django.db.utils import OperationalError\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add slug column to assessment template table\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: miha@reciprocit... | python | chosen |
[
{
"from": "human",
"value": "Add comment columns to assessments table\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: dan@reciprocitylabs... | python | chosen |
[
{
"from": "human",
"value": "TEST - skeleton of tests for qball\n"
},
{
"from": "gpt",
"value": "\"\"\" Testing qball \n\n\"\"\"\n\nimport numpy as np\n\nimport dipy.core.qball as qball\n\nfrom nose.tools import assert_true, assert_false, \\\n assert_equal, assert_raises\n\nfrom numpy.testin... | python | chosen |
[
{
"from": "human",
"value": "Add Finnish collation to all text columns\n"
},
{
"from": "gpt",
"value": "\"\"\"Add Finnish collations to all text columns\n\nRevision ID: 1ef4e5f61dac\nRevises: 485b2296735\nCreate Date: 2014-02-09 21:51:35.842781\n\n\"\"\"\n\n# revision identifiers, used by Alembi... | python | chosen |
[
{
"from": "human",
"value": "Add a test which compares the schnider params against the full data set\n"
},
{
"from": "gpt",
"value": "from csvreader import read_patient_csv\nfrom patient_solver import solve_for_patient\nfrom patient_state import PatientState\n\ndef test_against_real_data():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for Soundcloud get_unstarted_query function\n"
},
{
"from": "gpt",
"value": "from nose.tools import * # noqa\nimport datetime\n\nfrom pmg.models.soundcloud_track import SoundcloudTrack\nfrom pmg.models import db, File, Event, EventFile\nfrom tests impo... | python | chosen |
[
{
"from": "human",
"value": "ADD (94) class MockCloudifyContextRelationships to mock relationships behaviour\n"
},
{
"from": "gpt",
"value": "from cloudify.mocks import (MockCloudifyContext,\n MockNodeInstanceContext,\n )\n\n\nclass MockNodeIn... | python | chosen |
[
{
"from": "human",
"value": "Create command to delete documents of a given dossier\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom document.models import Document, Kamerstuk\nimport scraper.documents\n\n\nclass Command(BaseCommand):\n\n def add_arg... | python | chosen |
[
{
"from": "human",
"value": "Add a script for easy diffing of two Incars.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\nCreated on Nov 12, 2011\n'''\n\n__author__=\"Shyue Ping Ong\"\n__copyright__ = \"Copyright 2011, The Materials Project\"\n__version__ = \"0.1\"\n__maintainer__... | python | chosen |
[
{
"from": "human",
"value": "Test the satellites notebook specifically (though no satellite-specific tests yet).\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010-2016, MIT Probabilistic Computing Project\n#\n# Licensed under the Apache License, Version 2.0 (th... | python | chosen |
[
{
"from": "human",
"value": "Add queryset for ordering memberships by activity\n"
},
{
"from": "gpt",
"value": "from django.db import models\nfrom django.db.models import Case, When, Value, IntegerField, Sum\nfrom django.utils.timezone import now, timedelta\n\n\nclass MembershipQuerySet(models.Q... | python | chosen |
[
{
"from": "human",
"value": "Add a script to create homebrew formula\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\n'''\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n'''\n\nfrom __future__ import print_function, unicode_literals\n\nimport io\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add test for the indentation fix.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for IPython.lib.pretty.\n\"\"\"\n#-----------------------------------------------------------------------------\n# Copyright (c) 2011, the IPython Development Team.\n#\n# Distributed under... | python | chosen |
[
{
"from": "human",
"value": "Add script to nicely print logMessages\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport os\nimport argparse\nimport json\n\nimport cereal.messaging as messaging\n\n\nLEVELS = {\n \"DEBUG\": 10,\n \"INFO\": 20,\n \"WARNING\": 30,\n \"ERROR\": 40,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a python script to pull relevant fields out of Shadertoy json.\n"
},
{
"from": "gpt",
"value": "# parse_shadertoy_json.py\n\nfrom __future__ import print_function\nimport json\nimport os\nfrom PIL import Image\n\njsonfile = \"ldXXDj.txt\"\n#jsonfile = \"4lX3RB.tx... | python | chosen |
[
{
"from": "human",
"value": "Prepare class for collecting build operations.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2016, Fabian Greif\n# All Rights Reserved.\n#\n# The file is part of the lbuild project and is released under the\n# 2-... | python | chosen |
[
{
"from": "human",
"value": "Test the complete h2xml and xml2py toolchain on Windows by running it\nover 'windows.h'.\n\n\ngit-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@60459 6015fed2-1504-0410-9fe1-9d1591cc4771\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sys\nfrom ctypeslib ... | python | chosen |
[
{
"from": "human",
"value": "Add a management command for adding seats based on a seatmap file\n\nThis can be used to import seats and pricing groups from text-files\n"
},
{
"from": "gpt",
"value": "import csv\n\nfrom django.core.management.base import BaseCommand\n\nfrom karspexet.venue.models ... | python | chosen |
[
{
"from": "human",
"value": "Add test for read_files, removed from indra_db.\n"
},
{
"from": "gpt",
"value": "from os import path\nfrom indra.tools.reading.read_files import read_files, get_readers\n\nfrom nose.plugins.attrib import attr\n\n\n@attr('slow', 'nonpublic')\ndef test_read_files():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add PyUnit for DeepWater cat/dog/mouse image classification.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nimport h2o\nfrom tests import pyunit_utils\nfrom h2o.estimator... | python | chosen |
[
{
"from": "human",
"value": "Add : first orphaned test.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.6\n#Copyright (C) 2009-2010 :\n# Gabes Jean, naparuba@gmail.com\n# Gerhard Lausser, Gerhard.Lausser@consol.de\n#\n#This file is part of Shinken.\n#\n#Shinken is free software: yo... | python | chosen |
[
{
"from": "human",
"value": "Add tests for declarations of widget outputs\n"
},
{
"from": "gpt",
"value": "import re\nimport unittest\nimport importlib.util\n\nfrom Orange.canvas.registry import global_registry\n\n\nclass TestWidgetOutputs(unittest.TestCase):\n def test_outputs(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Policy: Add new network objects to all deployments\n"
},
{
"from": "gpt",
"value": "from core.models import *\n\ndef handle(network):\n\t# network deployments are not visible to users. We must ensure\n\t# networks are deployed at all deploymets available to their sli... | python | chosen |
[
{
"from": "human",
"value": "Insert similar repositories in Mongo\n"
},
{
"from": "gpt",
"value": "from py2neo import Graph\nimport os.path\nfrom flask import Flask\napp = Flask(__name__)\nfrom pymongo import MongoClient\n\n\n#TODO: delete document before entry\n\ngraph = Graph(os.environ['neoUR... | python | chosen |
[
{
"from": "human",
"value": "Add an example for ErrorsTable\n"
},
{
"from": "gpt",
"value": "\"\"\"\nShow the use of the ErrorsTable widget.\n\"\"\"\nimport sys\nfrom pyqode.qt import QtWidgets\nfrom pyqode.core.modes import CheckerMessage, CheckerMessages\nfrom pyqode.core.widgets import Errors... | python | chosen |
[
{
"from": "human",
"value": "Add script to rewrite config files so travis is happy.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport json\nimport argparse\nimport glob\nimport os\n\n\ndef rewrite(fobj):\n text = json.load(fobj)\n clean = json.dumps(... | python | chosen |
[
{
"from": "human",
"value": "Drop offering components related to volume types if storage mode is fixed.\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\nTENANT_TYPE = 'Packages.Template'\nSTORAGE_MODE_FIXED = 'fixed'\n\n\ndef drop_offering_components(apps, schema_editor):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for G4 expiry\n"
},
{
"from": "gpt",
"value": "\"\"\"Add additional indexes for audit_events\n\nRevision ID: 460\nRevises: 450\nCreate Date: 2016-01-13 16:45:18.621169\n\n\"\"\"\n\nrevision = '460'\ndown_revision = '450'\n\nfrom alembic import op\n\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Add LdrLoadDLL + Fix winproxy.VirtualProtect + add a first draft on veh sample\n"
},
{
"from": "gpt",
"value": "import ctypes\nimport windows\nfrom windows.vectored_exception import VectoredException\nimport windows.generated_def.windef as windef\nfrom windows.genera... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Django 1.11\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.27 on 2020-01-19 17:07\nfrom __future__ import unicode_literals\n\nimport django.contrib.auth.validators\nfrom django.db import migrations, models\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to clean out failed archive\n\n[skip ci]\n\nOSF-5632\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"One-off script to clear out a few registrations that failed during archiving.\"\"\"\nimport logging\nimport sys\n\nfrom framework.transacti... | python | chosen |
[
{
"from": "human",
"value": "Add minimal test for info endpoint\n"
},
{
"from": "gpt",
"value": "from base import BaseAPITestCase\nfrom django.core.urlresolvers import reverse\n\n\nclass PublicAPITestCase(BaseAPITestCase):\n \"\"\"\n IMPORTANT: These tests are to never be changed. They are... | python | chosen |
[
{
"from": "human",
"value": "Heapchecker: Add presubmit checks for suppressions.\n\nBUG=none\nTEST=none\nReview URL: http://codereview.chromium.org/3197014\n\ngit-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@57132 4ff67af0-8c30-449e-8e8b-ad334ec8d88c\n"
},
{
"from": "gpt",
"value": "# Copyri... | python | chosen |
[
{
"from": "human",
"value": "[Python] LeetCode: Add Solution to Add Two Numbers\n\nPython Solution for 02 Add Two Numbers\n\n[Link]: https://leetcode.com/problems/add-two-numbers\n[Complexity]:\n\nSigned-off-by: Jerry C Wang <398b9cc4b6d7225db629d423b2c3e64586a4df74@gmail.com>\n"
},
{
"from": "gpt",... | python | chosen |
[
{
"from": "human",
"value": "TST: Validate the existence of `.pyi` stub files\n"
},
{
"from": "gpt",
"value": "import os\nfrom pathlib import Path\n\nimport numpy as np\nfrom numpy.testing import assert_\n\nROOT = Path(np.__file__).parents[0]\nFILES = [\n ROOT / \"py.typed\",\n ROOT / \"__... | python | chosen |
[
{
"from": "human",
"value": "KT-47068: Add a script for filling user group locations\n"
},
{
"from": "gpt",
"value": "from os import path\n\nimport geocoder\nfrom ruamel import yaml\n\ndata_folder = path.join(path.dirname(__file__), \"../data\")\ndata_file = path.join(data_folder, \"user-groups.... | python | chosen |
[
{
"from": "system",
"value": "Use simpler invocation that actually fails. Leave it to @thijskh to use Popen-type of invocation\n"
},
{
"from": "human",
"value": "#\n# Usage: {{ foo | vault }}\n#\n\ndef vault(encrypted, env):\n method = \"\"\"\nfrom keyczar import keyczar\nimport os.path\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add the function for parsing strings to phonemes\n"
},
{
"from": "gpt",
"value": "import csv\n\n\nclass Synthesizer():\n\n def __init__(self):\n self.word_map = {}\n\n filename = \"../../dictionaries/VoxForgeDict\"\n for line in csv.reader(ope... | python | chosen |
[
{
"from": "human",
"value": "Add a 4 resistors example\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright (c) 2015 Matthew Earl\n# \n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Soft... | python | chosen |
[
{
"from": "system",
"value": "Modify testing code to work if executed from above its own directory\n"
},
{
"from": "human",
"value": "\"\"\"\nThe code this example is all based on is from http://tinyurl.com/pmmnbxv\nSome notes on this in the oommf-devnotes repo\n\"\"\"\n\nimport os\n\nimport pyt... | python | chosen |
[
{
"from": "human",
"value": "Copy List with Random Pointer\n"
},
{
"from": "gpt",
"value": "# Definition for singly-linked list with a random pointer.\n# class RandomListNode:\n# def __init__(self, x):\n# self.label = x\n# self.next = None\n# self.random = None\n\n\nc... | python | chosen |
[
{
"from": "human",
"value": "DOC: Add an example of feature selection.\n\n\n\ngit-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@458 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAn example showing feature selection.\n\"\"\"\n\nimport numpy as np\nimport pylab a... | python | chosen |
[
{
"from": "human",
"value": "Add script to find projects using IVR\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom collections import defaultdict\nfrom corehq.apps.reminders.models import CaseReminderHandler, METHOD_IVR_SURVEY\nfrom django.core.management.base impor... | python | chosen |
[
{
"from": "human",
"value": "Initialize the geolang toolkit package\n"
},
{
"from": "gpt",
"value": "from geolang.geolang import (\n\t\t\t\t\t__author__,\n\t\t\t\t\t__version__,\n\t\t\t\t\tKA2LAT,\n\t\t\t\t\tLAT2KA,\n\t\t\t\t\tUNI2LAT,\n\t\t\t\t\t_2KA,\n\t\t\t\t\t_2LAT,\n\t\t\t\t\tencode_slugify... | python | chosen |
[
{
"from": "human",
"value": "Create a default store on syncdb.\n\nThis is done by a hook to post_syncdb.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCreates the default Site object.\n\"\"\"\n\n# Modelled after django.contrib.sites.management.\n\nfrom django.db.models import signals\nfrom django.db ... | python | chosen |
[
{
"from": "human",
"value": "Add mixin to render JS and CSS links\n"
},
{
"from": "gpt",
"value": "from branca.element import Figure, Element, JavascriptLink, CssLink\n\n\nclass JSCSSMixin(Element):\n \"\"\"Render links to external Javascript and CSS resources.\"\"\"\n\n default_js = []\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.