conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a tool to convert pcap to Murphy's python classes.\n\nNot quite useful yet\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Installed from: http://dirtbags.net/py-pcap.html\nimport pcap\nimport argparse\nimport sys\nimport os\nsys.path.append(os.path.j... | python | chosen |
[
{
"from": "human",
"value": "Add STATS type to display the ports that the server is listening on\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.factory import UserFactory\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import im... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Observation model options change.\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 script to transform CT result to trace list\n"
},
{
"from": "gpt",
"value": "import csv\nimport sys\n\ndef csv_to_traces(infile, outfile):\n traces = []\n with open(infile) as inf:\n results = csv.DictReader(inf)\n for r in results:\n for t in r['tra... | python | chosen |
[
{
"from": "human",
"value": "Add start of z-order example.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nEventually this will be an example showing how we support z-ordering.\n\"\"\"\nimport arcade\n\nSCALE = 0.75\n\nSCREEN_HEIGHT = 320\nSCREEN_WIDTH = 512\n\n\nclass MyApplication(arcade.Window):\n ... | python | chosen |
[
{
"from": "human",
"value": "examples: Add example script to flash an LED using inline assembler.\n"
},
{
"from": "gpt",
"value": "# flash LED #1 using inline assembler\n@micropython.asm_thumb\ndef flash_led(r0):\n movw(r1, (stm.GPIOA + stm.GPIO_BSRRL) & 0xffff)\n movt(r1, ((stm.GPIOA + st... | python | chosen |
[
{
"from": "human",
"value": "Cover the syntax error from wrong indentation as well.\n"
},
{
"from": "gpt",
"value": "#\n# Kay Hayen, mailto:kayhayen@gmx.de\n#\n# Python test originally created or extracted from other peoples work. The\n# parts from me are in the public domain. It is ... | python | chosen |
[
{
"from": "human",
"value": "Add a Google Translate plugin.\n"
},
{
"from": "gpt",
"value": "import json\nimport re\n\nimport pycountry\nfrom titlecase import titlecase\n\nfrom plumeria.command import commands, CommandError\nfrom plumeria.message import Message\nfrom plumeria.message.lists impor... | python | chosen |
[
{
"from": "human",
"value": "Add Muster parallel clustering library.\n"
},
{
"from": "gpt",
"value": "from spack import *\n\nclass Muster(Package):\n \"\"\"The Muster library provides implementations of sequential and\n parallel K-Medoids clustering algorithms. It is intended as a\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to get OAuth2 credentials for Google Sheets API\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProgram: Get Credentials\nProgrammer: Michael Fryar, Research Fellow, EPoD\nDate created: January 5, 2017\n\nPurpose: Gets OAuth2 credentials to allow interacting\nwit... | python | chosen |
[
{
"from": "human",
"value": "Convert basecall files to BED3 files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n'''\nConverts a file in basecall format to BED3 format.\n'''\nimport sys,os\n\ndef basecall_to_bed(fname):\n with open(fname) as f:\n for line in f:\n if... | python | chosen |
[
{
"from": "human",
"value": "Add minimisation & then dynamics example test\n"
},
{
"from": "gpt",
"value": "def test_min_dyn():\n import glob\n import matplotlib.pyplot as plt\n %matplotlib inline\n from joommf.sim import Sim\n from joommf.mesh import Mesh\n from joommf.energie... | python | chosen |
[
{
"from": "human",
"value": "Add failing line number test.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\n# Copyright 2017 Eddie Antonio Santos <easantos@ualberta.ca>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t... | python | chosen |
[
{
"from": "human",
"value": "Test case showing the RL bug\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph\nfrom reportlab.platypus.tables import *\n\ndef go():\n Story=[]\n doc = SimpleDo... | python | chosen |
[
{
"from": "human",
"value": "Create Execution class to represent data read from configuration Sheet\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 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 the Lice... | python | chosen |
[
{
"from": "human",
"value": "Add command transfer user votes\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom datasets.models import User\n\n\nclass Command(BaseCommand):\n help = 'Transfer the votes of an user to another' \\\n 'Usage: pytho... | python | chosen |
[
{
"from": "human",
"value": "Test finding empty subplots for all selector combinations\n\nThis tests go.Figure._subplot_not_empty\n"
},
{
"from": "gpt",
"value": "import pytest\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\nfrom itertools import combinations, prod... | python | chosen |
[
{
"from": "human",
"value": "Attach LTOP as the attribute and remove index\n"
},
{
"from": "gpt",
"value": "\ndef handle_ltop_links(dmrs_xml):\n '''\n Remove LTOP links from DMRS and add LTOP attribute to the DMRS entity\n :param dmrs_xml: Input DMRS XML\n :return: Modified DMRS XML\... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 594. Longest Harmonious Subsequence\n\n594. Longest Harmonious Subsequence: https://leetcode.com/problems/longest-harmonious-subsequence/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def findLHS(se... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 521. Longest Uncommon Subsequence I\n\n521. Longest Uncommon Subsequence I: https://leetcode.com/problems/longest-uncommon-subsequence-i/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findLUSlength(self, a, b):\n \"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add test for subresource documentation\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance... | python | chosen |
[
{
"from": "human",
"value": "Add Raspberry PI Alexa control server\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask_ask import Ask, statement, convert_errors\nimport logging\nfrom rfsend import rf_send\n\nGPIO.setmode(GPIO.BCM)\n\napp = Flask(__name__)\nask = Ask(app, '/')\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to send a statsd message\n\n(imported from commit 25ead4a0dee185a139eb5401e109c9cbe937c7bf)\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nclass Command(BaseCommand):\... | python | chosen |
[
{
"from": "human",
"value": "attachment: Add migration to fix duplicate attachment objects.\n\nThe comment in the migration explains this change in detail.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-04-13 22:12\nfrom __future__ import unicode_l... | python | chosen |
[
{
"from": "system",
"value": "Allow auditors to CR comments in context\n"
},
{
"from": "human",
"value": "# Copyright (C) 2015 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: anze@reciprocity... | python | chosen |
[
{
"from": "human",
"value": "Add rudimentary smoke test for hearing admin\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport pytest\nfrom django.contrib import admin\nfrom django.core.urlresolvers import reverse\n\n\n@pytest.mark.django_db\ndef test_hearing_admin_renders(admin_clie... | python | chosen |
[
{
"from": "human",
"value": "Add a binary to convert model to tflite supported foramt.\n\nPiperOrigin-RevId: 302497553\n"
},
{
"from": "gpt",
"value": "# Copyright 2019 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may... | python | chosen |
[
{
"from": "human",
"value": "Add unittests for bridgedb.util module.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# This file is part of BridgeDB, a Tor bridge distribution system.\n#\n# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>\n# please also se... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 182\n"
},
{
"from": "gpt",
"value": "class Solution:\n \"\"\"\n @param A: A positive integer which has N digits, A is a string.\n @param k: Remove k digits.\n @return: A string\n \"\"\"\n def DeleteDigits(self, A, k... | python | chosen |
[
{
"from": "human",
"value": "Add task for running fsx on an rbd image.\n"
},
{
"from": "gpt",
"value": "import contextlib\nimport logging\n\nfrom ..orchestra import run\nfrom teuthology.parallel import parallel\n\nlog = logging.getLogger(__name__)\n\n@contextlib.contextmanager\ndef task(ctx, con... | python | chosen |
[
{
"from": "human",
"value": "Add line position to TSV file.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\nimport csv\nfrom itertools import tee\n\nimport nltk\n\n\nMATCH_FILE = 'data/6705bigrams-PopewDryden.txt'\nOUTPUT_FILE = 'data/6705bigrams-Output.txt'\n\n\ndef tokenize(text):\... | python | chosen |
[
{
"from": "human",
"value": "Add script to export hashtags counts, user tweet counts, etc.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSome really simple export scripts.\n\n\"\"\"\nfrom __future__ import unicode_literals\n\nimport io\nimport iterutils\nimport pymongo\n\nimport twitterproj\n\ndef gr... | python | chosen |
[
{
"from": "system",
"value": "Use real events and proper TestCase\n"
},
{
"from": "human",
"value": "import unittest2\n\nfrom ..plugins import prof\nfrom ._common import Stub, FakeStartTestRunEvent\n\n\nclass TestProfPlugin(unittest2.TestCase):\n tags = ['unit']\n\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Move schemaextender automatic getter and setter methods\n"
},
{
"from": "gpt",
"value": "\"\"\"Generic field extensions\n\"\"\"\nfrom Acquisition import aq_inner\nfrom Acquisition import aq_parent\nfrom Acquisition import Implicit\nfrom Acquisition import ImplicitAcq... | python | chosen |
[
{
"from": "human",
"value": "Add template loader for clients\n"
},
{
"from": "gpt",
"value": "from django.template.loader import BaseLoader\nfrom django.db import connection\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.utils._os import s... | python | chosen |
[
{
"from": "human",
"value": "Add a test for qisrc reset\n\nChange-Id: I6d009b46aefc53c7eca18d77225796614d200d10\n"
},
{
"from": "gpt",
"value": "# this is only used on buildfarm, so only test this\nimport pytest\n\nimport qisrc.snapshot\n\ndef test_reset_dash_f(qisrc_action, git_server):\n gi... | python | chosen |
[
{
"from": "human",
"value": "Add a script to calibrate PID\n"
},
{
"from": "gpt",
"value": "from LLD import *\nimport csv\n\nSAMPLING_PERIOD = 15\nMAX_DUTY = 1800/3200\nlld = LLD()\n\n\nclass Fake_Tank(object):\n\n def __init__(self, name):\n self.resistor_duty = 0\n self.tank_n... | python | chosen |
[
{
"from": "human",
"value": "Add command to seed forum permissions to existing users\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis must be run only after seed_permissions_roles.py!\n\nCreates default roles for all users currently in the database. Just runs through\nEnrollments.\n\"\"\"\nfrom dja... | python | chosen |
[
{
"from": "human",
"value": "Disable tv through raspberry pi's cec interface.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport cec # from python-cec\nimport os.path\nimport time\n\ncec.init()\n\nfor adress, device in cec.list_devices().items():\n print device.address, dev... | python | chosen |
[
{
"from": "human",
"value": "Add test for dummy violation\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom tasks.const import STATUS_SUCCESS\nfrom ..dummy import dummy_violation\n\n\nclass DummyViolationCase(TestCase):\n \"\"\"Dummy violation case\"\"\"\n\n def test_... | python | chosen |
[
{
"from": "system",
"value": "Hide PyLint warning with undefined WindowsError exception\n"
},
{
"from": "human",
"value": "# Copyright (C) Ivan Kravets <me@ikravets.com>\n# See LICENSE for details.\n\nimport atexit\nfrom os import remove\nfrom tempfile import mkstemp\n\nMAX_SOURCES_LENGTH = 8000... | python | chosen |
[
{
"from": "human",
"value": "Add SQS visibility timeout message example\n"
},
{
"from": "gpt",
"value": "# Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in c... | python | chosen |
[
{
"from": "human",
"value": "Add Indonesia weights as migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django_countries import countries\n\ndef populate_weights(apps, schema_editor):\n Weights... | python | chosen |
[
{
"from": "human",
"value": "Add tests around our new handling of exceptions\n"
},
{
"from": "gpt",
"value": "# 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 copy of the License at\n#\n# h... | python | chosen |
[
{
"from": "system",
"value": "Update SNS per 2019-11-21 changes\n"
},
{
"from": "human",
"value": "# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty, Tags\nfrom .compat import policytypes\... | python | chosen |
[
{
"from": "human",
"value": "Read in python dependency graph and clean up\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nimport itertools as it\nwith open('pypi-deps.txt', 'r') as fin:\n lines = fin.readlines()\n edges = [line.rstrip().split() for line in lines]\n packages = s... | python | chosen |
[
{
"from": "human",
"value": "Set up shell argparser for sge module\n"
},
{
"from": "gpt",
"value": "import argparse\nimport textwrap\nfrom qstat import Qstat\n\n__author__ = 'Datasnakes'\n\nparser = argparse.ArgumentParser(\n formatter_class=argparse.RawDescriptionHelpFormatter,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 501. Find Mode in Binary Search Tree\n\n501. Find Mode in Binary Search Tree: https://leetcode.com/problems/find-mode-in-binary-search-tree/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# de... | python | chosen |
[
{
"from": "human",
"value": "Add better solution for simple cipher\n"
},
{
"from": "gpt",
"value": "import re\nimport time\nimport random\nrandom.seed(int(time.time()))\nlength = 100\nkeyinit = \"\".join([chr(random.randint(97,122)) for i in range(0,100)])\n\nclass Cipher(object):\n def __ini... | python | chosen |
[
{
"from": "human",
"value": "Move LockFixture into a fixtures module\n\nIn Nova and other projects, fixtures are in test-requirements.txt and\nNOT in requirements.txt so updating nova to use latest lockutils.py\nis not possible. So let us move LockFixture out into it a separate\nfixtures.py module where in ... | python | chosen |
[
{
"from": "human",
"value": "Add a BCE loss impl that converts dense targets to sparse /w smoothing as an alternate to CE w/ smoothing. For training experiments.\n"
},
{
"from": "gpt",
"value": "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\nclass DenseBinaryCrossEntro... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test for the history page\n"
},
{
"from": "gpt",
"value": "from tests.conftest import SERVICE_ONE_ID\n\n\ndef test_history(\n client_request,\n mock_get_service_history,\n):\n client_request.get('main.history', service_id=SERVICE_ONE_ID)\n"
}
... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for connection change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom sure import scenario\n\nfrom pyeqs import QuerySet\nfrom tests.helpers import prepare_data, cleanup_data, add_document... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for DeviceRule\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-04-20 15:47\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add script to ensure virtual webcam is running.\n\nThis script will check that a webcam is running and start it if it's\nnot currently running.\nIt's tailored to the way our buildbots are currently configured.\n\nTEST=local execution on Windows, Mac and Linux.\nBUG=none\nR=phogl... | python | chosen |
[
{
"from": "human",
"value": "Implement the custom prefixes module\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom twisted.python import log\nfrom txircd.module_interface import IMode, IModuleData, Mode, ModuleData\nfrom txircd.utils import ModeType\nfrom zope.interface ... | python | chosen |
[
{
"from": "human",
"value": "Add management command to export TCamp lobby day participants.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom reg.models import *\n\nfrom optparse import make_option\nimport cStringIO, csv\nfrom collections im... | python | chosen |
[
{
"from": "human",
"value": "Add a test collecting all doctests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2007-2013 Parisson SARL\n\n# This file is part of TimeSide.\n\n# TimeSide is free software: you can redistribute it and/or modify\n# it under the terms of ... | python | chosen |
[
{
"from": "human",
"value": "Test for radio buttons in lists"
},
{
"from": "gpt",
"value": "import gobject\nimport gtk\nfrom kiwi.ui.widgets.list import Column, List\n\nclass Object:\n def __init__(self, name, value): \n self.name, self.value = name, value\n\ncolumns = [Column('name'),... | python | chosen |
[
{
"from": "human",
"value": "Add local settings template for local server instances.\n\n(imported from commit 96f59e6a041992f5b2c467558a2fcc14a951a8a9)\n"
},
{
"from": "gpt",
"value": "# Template for Django settings for the Zulip local servers\nimport os\nimport platform\nimport re\n\n# TODO: Re... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in digest comment."
},
{
"from": "human",
"value": "from collections import Counter\n\n\n# TODO(tkaemming): This should probably just be part of `build_digest`.t\ndef get_digest_metadata(digest):\n start = None\n end = None\n\n counts = Counter()\n... | python | chosen |
[
{
"from": "human",
"value": "Add Python LinePlot Charts Test\n\nLargely a clone of the Cxx version save that the data arrays must\nbe manipulated directly since the vtkVariant based methods on vtkTable\naren't available to Python.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Run t... | python | chosen |
[
{
"from": "human",
"value": "Add Bluetooth support. Still buggy but works. Mostly. If you are lucky.\n"
},
{
"from": "gpt",
"value": "from time import sleep\nfrom bluetooth import *\n\nclass BluetoothDataSource:\n\tdef __init__(self, params):\n\t\tself.params = params\n\t\tself.socket = Bluetoot... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert (some of) hdf5 tracking data to csv\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nfrom os.path import join, splitext\nimport glob\n\nimport pandas as pd\n#import matplotlib.pyplot as plt\n\nim... | python | chosen |
[
{
"from": "system",
"value": "Create snapshot after deploy openstack\n"
},
{
"from": "human",
"value": "from openstack_site_pp_base import OpenStackSitePPBaseTestCase\nimport unittest\n\nclass OpenStackCase(OpenStackSitePPBaseTestCase):\n\n def test_deploy_open_stack(self):\n self.vali... | python | chosen |
[
{
"from": "human",
"value": "Add basic unittest for espeak\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom unittest import mock\n\nfrom mycroft.tts.espeak_tts import ESpeak\n\n\n@mock.patch('mycroft.tts.tts.PlaybackThread')\nclass TestMimic(unittest.TestCase):\n @mock.patch('mycroft.tt... | python | chosen |
[
{
"from": "human",
"value": "Add example for the load and addid command\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport sys\nimport ampdclient\n\n\n# This script demonstrates the lsinfo, addid and load command.\n# It can be called on with the host and the path as argument:\n# `python ... | python | chosen |
[
{
"from": "human",
"value": "Add beta version of redis storage\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright (c) 2011-2013, Shopkick Inc.\n# All rights reserved.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of th... | python | chosen |
[
{
"from": "human",
"value": "Add script to compare npm versions\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# This script compares the npm packages version in the Luxembourg\n# project with the ones in ngeo.\n# Make sure to call \"npm i\" in the geoportal ... | python | chosen |
[
{
"from": "human",
"value": "Add migration about station maintainers\n\nThis migration was apparently accidentally omitted in df653b5dcf.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.con... | python | chosen |
[
{
"from": "human",
"value": "Add a super-class for simple wrappers (that wrap potentials independent of R,Z,phi\n"
},
{
"from": "gpt",
"value": "###############################################################################\n# SimpleWrapperPotential.py: Super-class for simple wrapper potentia... | python | chosen |
[
{
"from": "human",
"value": "Add no-op migration to test deploys\n"
},
{
"from": "gpt",
"value": "\"\"\"No-op migration for testing deploys\n\nRevision ID: 3be4004781bc\nRevises: a0ee5e10f44b\nCreate Date: 2019-11-04 18:56:29.459718\n\"\"\"\n\nimport logging\n\n\nlog = logging.getLogger(\"alembi... | python | chosen |
[
{
"from": "human",
"value": "ENH: Create file for the black box node\n"
},
{
"from": "gpt",
"value": "######################################################################\n# Copyright (C) 2015 Jaakko Luttinen\n#\n# This file is licensed under Version 3.0 of the GNU General Public\n# License. S... | python | chosen |
[
{
"from": "human",
"value": "Add problems for lesson 2\n"
},
{
"from": "gpt",
"value": "from core import test_helper\n\n# Question 1\n# ----------\n# Given a list of strings, return the count of the number of strings where the string length\n# is 2 or more and the first and last chars of the str... | python | chosen |
[
{
"from": "human",
"value": "Add simple tests for models.Vault\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom keybar.tests.factories.vault import VaultFactory\n\n\n@pytest.mark.django_db\nclass TestVault:\n\n def test_simple(self):\n vault = VaultFactory.create()\n\n ass... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the wrapper\n"
},
{
"from": "gpt",
"value": "# Licensed under an MIT open source license - see LICENSE\n\nfrom ..statistics import stats_wrapper\nfrom ._testing_data import \\\n dataset1, dataset2\n\n\ndef test_wrapper():\n\n run_wrapper = stats_... | python | chosen |
[
{
"from": "human",
"value": "Add helper methods for commonly added commandline options for experiments\n\nSigned-off-by: Diana Guttman <98d11df29868673c9a01b97a41154316626a31b0@intel.com>\n"
},
{
"from": "gpt",
"value": "#\n# Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation\n... | python | chosen |
[
{
"from": "human",
"value": "Add --check-version to see if you are on latest release.\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, division, absolute_import\nimport re\nfrom argparse import _VersionAction\n\nimport flexget\nfrom flexget.utils import requests\nfrom fl... | python | chosen |
[
{
"from": "human",
"value": "Add simple scripts to plot frequencies.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nPlot user tweet activity.\n\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nimport twitterproj\n\ndef plot_counts(collection, ax=None):\n if ax ... | python | chosen |
[
{
"from": "human",
"value": "Add script to find bad / outdated registrations\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\n\"\"\"\n\nfrom website.app import init_app\nfrom website import models\nfrom framework import Q\n\napp = init_app()\n\nknown_schemas = [\n 'Open-Ended_Registration',\n 'O... | python | chosen |
[
{
"from": "system",
"value": "Add moon (Q405) to the list of globes\n\nChange-Id: I2dd9f87fcb1d748bff94328575f8439dc36035e3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n__version__ = '$Id$'\n\nfrom pywikibot import family\n\n# The wikidata family\n\n\nclass Family(family.Wikime... | python | chosen |
[
{
"from": "human",
"value": "Add scraper for Jyväskylä city council members\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport requests\nimport requests_cache\nfrom lxml import html\n\nfrom utils import ScrapeError, submit_council_members\nfrom finland impo... | python | chosen |
[
{
"from": "human",
"value": "Add iteration over menu items\n"
},
{
"from": "gpt",
"value": "import json\nimport re\nfrom collections import defaultdict\n\ndef extract_ingredients_from_string(description):\n if description:\n cleaned_description = re.sub('[^a-z ]', '', description.lower())\n ... | python | chosen |
[
{
"from": "human",
"value": "Add trainer for fcn8s on apc2016\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport os.path as osp\n\nimport chainer\nfrom chainer import cuda\n\nimport fcn\n\nimport datasets\n\n\ndef main():\n parser = argparse.ArgumentP... | python | chosen |
[
{
"from": "human",
"value": "Add audit foreign key to assessments and issues\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"\nAdd audit FK to assessments and issues\n\nCreate Date: 2017-03... | python | chosen |
[
{
"from": "human",
"value": "Add python test of importing Parquet files from S3\n"
},
{
"from": "gpt",
"value": "import h2o\nimport os\n\nfrom h2o.persist import set_s3_credentials\n\nfrom tests import pyunit_utils\nfrom pandas.testing import assert_frame_equal\n\n\ndef test_import_parquet_from_... | python | chosen |
[
{
"from": "human",
"value": "Add first simple transformation tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#\n# Tests Transform functions in Pints\n#\n# This file is part of PINTS (https://github.com/pints-team/pints/) which is\n# released under the BSD 3-clause license. See acc... | python | chosen |
[
{
"from": "human",
"value": "Add a new test for WindowDict\n"
},
{
"from": "gpt",
"value": "from allegedb.cache import WindowDict\nfrom itertools import cycle\n\ntestvs = ['a', 99, ['spam', 'eggs', 'ham'], {'foo': 'bar', 0: 1, '💧': '🔑'}]\ntestdata = []\nfor k, v in zip(range(100), cycle(testvs... | python | chosen |
[
{
"from": "human",
"value": "Add android implementation of storage path\n"
},
{
"from": "gpt",
"value": "'''\nAndroid Storage Path\n--------------------\n'''\n\nfrom plyer.facades import StoragePath\nfrom jnius import autoclass\nfrom android import mActivity\n\nEnvironment = autoclass('android.o... | python | chosen |
[
{
"from": "human",
"value": "Add tests for about page.\n"
},
{
"from": "gpt",
"value": "import datetime\n\nfrom django_webtest import WebTest\nfrom django.contrib.auth.models import User\n\nfrom pylab.core.models import Event\n\n\nclass AboutPageTests(WebTest):\n\n def setUp(self):\n s... | python | chosen |
[
{
"from": "human",
"value": "Add example that prints info on the CRAB service.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nThis script prints all available information on the CRAB webservice.\n'''\n\nfrom crabpy.client import crab_factory\n\ncrab = crab_factory()\n\nprint crab... | python | chosen |
[
{
"from": "human",
"value": "Add profile script for comparisons\n"
},
{
"from": "gpt",
"value": "from firedrake import *\nimport sys\n\nparameters[\"pyop2_options\"][\"lazy_evaluation\"] = False\n\n\ndef is_intstring(s):\n try:\n int(s)\n return True\n except ValueError:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for cse for all supporting backends\n"
},
{
"from": "gpt",
"value": "from .. import Backend\nimport pytest\n\n\nbackends = []\nfor bk in Backend.backends.keys():\n try:\n _be = Backend(bk)\n except ImportError:\n continue\n\n _x = _be... | python | chosen |
[
{
"from": "human",
"value": "Add script to test sending email with Pybossa Flask-Mail config.\n"
},
{
"from": "gpt",
"value": "import argparse, sys\nfrom pybossa.core import create_app\nfrom flask_mail import Mail\nfrom flask_mail import Message\n\n\nif __name__ == '__main__':\n arg_parser = ... | python | chosen |
[
{
"from": "human",
"value": "Add single machine parallelism helper script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport argparse\nimport datetime\nimport multiprocessing\nimport os\nimport subprocess\nimport sys\nimport time\n\ndef main():\n\t#Parse arguments\n\tparser = argp... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for volume qos\n\nChange-Id: I80010b56b399bc027ac864304be60a3ee53bda00\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. ... | python | chosen |
[
{
"from": "human",
"value": "Add script to test webhooks\n\nSearching for the right curl commands through my shell history gets\ntedious. Let's add a bit of automation.\n"
},
{
"from": "gpt",
"value": "#!/bin/env python3\n\n# Copyright 2016 Ruud van Asseldonk\n#\n# This program is free software:... | python | chosen |
[
{
"from": "human",
"value": "Add an extremely simple \"sanity test\" to the test suite.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport unittest\n\nclass TestSanity(unittest.TestCase):\n def setUp(self):\n self.right_answer = 4\n\n def test_sanity(self):\n s... | python | chosen |
[
{
"from": "human",
"value": "Make a special settings file for collectstatic\n\nThis is useful to minimize the services needed by a collectstatic container\n"
},
{
"from": "gpt",
"value": "# Settings used by containers running collectstatic. Scope our services\n# to the only ones needed to run c... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for flask integration\n"
},
{
"from": "gpt",
"value": "import os\nimport socket\nfrom webtest import TestApp\nfrom nose.tools import eq_, assert_raises\nfrom mock import MagicMock, patch\n\nfrom flask import Flask\nfrom bugsnag.six import Iterator\nfro... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.