conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add python script to build the project using the platforms standard builder (used when we do automatic unit-testing using Bitten at Sequanto)"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport sys\nimport os\n\nif sys.platform == 'win32':\n os.system ( 'de... | python | chosen |
[
{
"from": "human",
"value": "Add build script for client\n"
},
{
"from": "gpt",
"value": "#\n# Build Script by Moloch\n# Requires Py2Exe for Python 2.7\n#\nfrom distutils.core import setup\nimport py2exe, sys, os\n\nsys.argv.append('py2exe')\n\nsetup(\n\toptions = {'py2exe': {'bundle_files': 1... | python | chosen |
[
{
"from": "human",
"value": "Add management script to rename the default site\n\nDjango 1.8 automatically names the default website instead of asking\nfor the domain name it should use. Our import script depends on\nsetting the domain name of the default site before importing content.\nThis script can be ru... | python | chosen |
[
{
"from": "human",
"value": "Add STDout plugin, fix status representation\n"
},
{
"from": "gpt",
"value": "from pinger.ext import ActionProvider\n\n\nclass StdOut(ActionProvider):\n \"\"\"\n Receives a response and prints it\n \"\"\"\n title = 'StdOut'\n\n def receive(self, name, ... | python | chosen |
[
{
"from": "human",
"value": "Add import script for cantons data\n"
},
{
"from": "gpt",
"value": "from xml.etree import ElementTree\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db import transaction\nimport requests\n\nfrom apps.curia_vista.models import *\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType)\n"
},
{
"from": "gpt",
"value": "''' imports from installed packages '''\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom django_m... | python | chosen |
[
{
"from": "human",
"value": "Add command for populating latitude and longitude\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom geopy.geocoders import get_geocoder_for_service\nfrom geopy.exc import GeocoderQuotaExceeded\n\nfrom ballot.models import Ball... | python | chosen |
[
{
"from": "human",
"value": "Add script to count the lines in a corpus\n\nThe results is saved to a csv file.\n"
},
{
"from": "gpt",
"value": "\"\"\"Script to count the lines in a corpus of texts.\n\nThis information can be used to normalize the results.\n\nInput: directory containing text files... | python | chosen |
[
{
"from": "human",
"value": "Add script to reshape attendance data\n"
},
{
"from": "gpt",
"value": "import argparse\nimport os\nimport sys\nimport csv\n\nfile_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))\nsys.path.append(os.path.abspath(os.path.join(file_path, os.pardir)))\n\... | python | chosen |
[
{
"from": "human",
"value": "Create sample file for Python\n"
},
{
"from": "gpt",
"value": "import ctypes\nimport os\n\n# Error\nT_ERROR_SUCCESS = 0 # Success\nT_ERROR_EMPTY = 1 # Empty expression\nT_ERROR_DIVZERO = 2 # Division by zero\nT_ERROR_TOKEN = 3 # Unknow... | python | chosen |
[
{
"from": "human",
"value": "Add an event class and several standard subclasses\n"
},
{
"from": "gpt",
"value": "class Event:\n MousePressEvent = 1\n MouseMoveEvent = 2\n MouseReleaseEvent = 3\n KeyPressEvent = 4\n KeyReleaseEvent = 5\n SceneChangeEvent = 6\n ToolActivateEve... | python | chosen |
[
{
"from": "human",
"value": "Add importer and exporter for JSON files\n\nWrapper around read_dict and write_dict\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nfile: io_json_format.py\n\nFunctions for exporting and importing graphs in structured JSON format\n\"\"\"\n\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add migration for User model generated by Django 2\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.24 on 2022-02-03 15:11\n\nimport django.core.validators\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependen... | python | chosen |
[
{
"from": "human",
"value": "Add integration tests for ChangeAPI\n"
},
{
"from": "gpt",
"value": "\nimport unittest\n\nimport changeling.api\nimport changeling.fakes\n\n\nclass TestChangeAPI(unittest.TestCase):\n def setUp(self):\n self.fake_storage = changeling.fakes.FakeStorage([])\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script for storing secrets\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\"\"\"\nStore a config variable in SSM under the key structure\n\n /{project_id}/secrets/{label}/{config_key}\n\nThis script can store a regular config ... | python | chosen |
[
{
"from": "human",
"value": "Add program to run single simulation\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport numpy as np\nfrom scripts.Dqn import Learner\nimport time\n\nif 'SUMO_HOME' in os.environ:\n tools = os.path.join(os.environ['SUMO_HOME'], 'tools')\n sys.path.ap... | python | chosen |
[
{
"from": "human",
"value": "Add a script to visualize detection matfiles.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport sys\nimport cv2\nfrom vdetlib.vdet.dataset import imagenet_vdet_class_idx\nfrom vdetlib.utils.common import imread, imwrite\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add missing DataDependency objects for duplicates\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.1.7 on 2021-10-12 10:39\nfrom django.db import migrations, models\n\n\ndef create_duplicate_dependencies(apps, schema_editor):\n Data = apps.get_model(\"flow... | python | chosen |
[
{
"from": "human",
"value": "Add demo for modelizing using peewee ORM\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAn attempt to modelize datas with the \"peewee\" ORM\n\nYou have to install \"peewee\" from its repository (this code use ManyToManyField that has been documented but omitted from the l... | python | chosen |
[
{
"from": "human",
"value": "Add basic API which can make GET and POST requests\n"
},
{
"from": "gpt",
"value": "import requests\n\nfrom auth import UnleashedAuth\n\n\nclass UnleashedApi(object):\n \"\"\"\n Unleashed API client library.\n \"\"\"\n\n def __init__(self, api_url, api_id... | python | chosen |
[
{
"from": "human",
"value": "Allow user to solve district court captcha\n"
},
{
"from": "gpt",
"value": "import cookielib\nimport os\nimport re\nimport sys\nimport urllib\nimport urllib2\nimport webbrowser\nfrom bs4 import BeautifulSoup\nfrom time import sleep\n\nuser_agent = u\"Mozilla/5.0 (Mac... | python | chosen |
[
{
"from": "human",
"value": "Add check script for polygon validity during aug\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, division\nimport numpy as np\n\nimport imgaug as ia\nimport imgaug.augmenters as iaa\nfrom imgaug.augmentables.polys import Polygon, PolygonsOnIma... | python | chosen |
[
{
"from": "human",
"value": "Add scripts that adds noise to datasets\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\"\"\"\nUsage: {script_name} INPUT_FILE OUTPUT_FILE\n\nAdds noise to the csv file given as input.\n\"\"\"\nimport random\nimport sys\nfrom collections import deque\n\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Connect nodes at same level in binary tree\n"
},
{
"from": "gpt",
"value": "import unittest\n\"\"\"\nWrite a function to connect all adjacent nodes at same level in binary tree.\n\"\"\"\n\n\nclass Node:\n def __init__(self, key, left=None, right=None):\n se... | python | chosen |
[
{
"from": "human",
"value": "Add script for finding duplicate results\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport argparse\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument('-s', '--samples_file', help=\"I... | python | chosen |
[
{
"from": "human",
"value": "Add migration for changes to ImagerProfile user related name\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\nclass Migration(migration... | python | chosen |
[
{
"from": "human",
"value": "Add letter logo for North Somerset council\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0249_another_letter_org\nRevises: 0248_enable_choose_postage\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0249_another_letter_org'\nd... | python | chosen |
[
{
"from": "system",
"value": "Test 1st training loss improves over 0th validation.\n"
},
{
"from": "human",
"value": "import theanets\n\nimport util\n\n\nclass TestTrainer(util.MNIST):\n def setUp(self):\n super(TestTrainer, self).setUp()\n self.exp = theanets.Experiment(\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script that generate a message\n"
},
{
"from": "gpt",
"value": "from django.utils import translation\nfrom django.template.loader import get_template\n\nfrom bluebottle.activities.tasks import get_matching_activities\nfrom bluebottle.members.models import Member\... | python | chosen |
[
{
"from": "human",
"value": "Change the name of usfm file according to ID\n\nThis script will change the name of a usfm file according to the ID information. Quite useful when users gives files with unconventional naming system."
},
{
"from": "gpt",
"value": "import os\r\nimport codecs\r\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add lib confirm for openpyxl\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n\nfrom openpyxl import Workbook\nwb = Workbook()\n\n# grab the active worksheet\nws = wb.active\n\n# Data can be assigned directly to cells\nws['A1'] = 42... | python | chosen |
[
{
"from": "human",
"value": "Add a simple UTC tzinfo implementation.\n\n * Python 2.x does not have any time zone info implemented.\n By default we will treat time as UTC time, adjustments should\n be done by the clients.\n Here we introduce a very simple UTC Python tzinfo class borrowed\n from... | python | chosen |
[
{
"from": "human",
"value": "Check that all required executors are loaded on AppVeyor\n"
},
{
"from": "gpt",
"value": "from dmoj import judgeenv, executors\nfrom dmoj.testsuite import Tester\nfrom dmoj.utils.ansi import ansi_style\n\n\nrequired_executors = ['AWK', 'BF', 'C', 'CPP03', 'CPP11', 'C... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot signal figure.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nA script to plot signals\n\"\"\"\nimport sys\nimport os\nimport getopt\nimport json\nimport matplotlib.pyplot as plt\nCMD_USAGE = \"\"\"\n\n\"\"\"\nMAX_PLOT_SIZE = 5000\n\n\ndef plot_signal(si... | python | chosen |
[
{
"from": "human",
"value": "Add simple example web cralwer\n"
},
{
"from": "gpt",
"value": "import guv\n\nguv.monkey_patch()\nimport requests\n\ndef get_url(url):\n print('get_url()')\n return requests.get(url)\n\ndef main():\n urls = ['http://httpbin.org/delay/1'] * 10\n\n pool = g... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights is IPv4 address problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Is IPv4 Address Problem\n\n\ndef isIPv4Address(inputString):\n import re\n pattern = re.compile(r'^\\d{1,3}(?:\\.\\d{1,3}){3}$')\n match = re.se... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the util getParentAndBase method\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.append(\"../\")\n\nimport unittest\n\nimport Algorithmia\nfrom Algorithmia.util import getParentAndBase\n\nclass UtilTest(unittest.TestCase):\n def test_getPa... | python | chosen |
[
{
"from": "system",
"value": "Update \"Programming Language\" Tag to Indicate Python3 Support\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\nimport plaid\n\n\nurl = 'https://github.com/plaid/plaid-python'\n\nsetup(\n name='plaid-python',\n version=plaid.__v... | python | chosen |
[
{
"from": "human",
"value": "Add simple python server for recording code completion timings.\n\ngit-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@101327 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\nfrom socket import *\nfrom time imp... | python | chosen |
[
{
"from": "human",
"value": "Add download/forward tests for imagenet pretrainedmodels\n"
},
{
"from": "gpt",
"value": "import pytest\nimport torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\nimport pretrainedmodels as pm\nimport pretrainedmodels.utils as utils\n\npm_args = []\nf... | python | chosen |
[
{
"from": "human",
"value": "Build and revision number script\n"
},
{
"from": "gpt",
"value": "import sys\r\nfrom time import gmtime\r\nyear, mon, mday, hour, min, sec, wday, yday, isdst = gmtime()\r\nbld = ((year - 2000) * 12 + mon - 1) * 100 + mday\r\nrev = hour * 100 + min\r\nprint 'Your buil... | python | chosen |
[
{
"from": "human",
"value": "Add first integration test for SQS\n"
},
{
"from": "gpt",
"value": "import os\nfrom asyncaws import SQS\nfrom tornado.testing import AsyncTestCase, gen_test\n\naws_key_id = os.environ['AWS_ACCESS_KEY_ID']\naws_key_secret = os.environ['AWS_SECRET_ACCESS_KEY']\naws_reg... | python | chosen |
[
{
"from": "human",
"value": "Write a tornado server that responds to POST requests.\n"
},
{
"from": "gpt",
"value": "import json\n\nimport tornado.ioloop\nimport tornado.web\n\nclass MainHandler(tornado.web.RequestHandler):\n \"\"\"Handles post requests by responding with a JSON file.\"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Test if light curves are extracted correctly\n"
},
{
"from": "gpt",
"value": "from __future__ import division, print_function\nimport cPickle as pickle\nimport sys\nimport matplotlib.pyplot as plt\n\nprint('Loading lc file...')\nlcdata = pickle.load(open(sys.argv[1])... | python | chosen |
[
{
"from": "human",
"value": "Add management command to check who gets email notifications\n"
},
{
"from": "gpt",
"value": "\"\"\"\nsentry.management.commands.check_notifications\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more detai... | python | chosen |
[
{
"from": "human",
"value": "Add spec patch for AppFlow\n"
},
{
"from": "gpt",
"value": "patches = [\n {\n \"op\": \"add\",\n \"path\": \"/PropertyTypes/AWS::AppFlow::ConnectorProfile.CustomAuthCredentials/Properties/CredentialsMap/PrimitiveType\",\n \"value\": \"Json\",\... | python | chosen |
[
{
"from": "human",
"value": "Add a test that exercises the abstract base class checking\n\nThe test simply tries to instantiate each class exposed as part of the\nTOOLCHAIN_CLASSES map. This is a test that each toolchain class\nimplements the required API, as the mbedToolchain will not allow the\ninstantiat... | python | chosen |
[
{
"from": "human",
"value": "Add rudimentary tests for `fetch_users_to_sync`\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache License, Version 2.0. See th... | python | chosen |
[
{
"from": "human",
"value": "Add test for license reading with dpkg_lowpkg\n"
},
{
"from": "gpt",
"value": "import os\n\nimport salt.modules.dpkg_lowpkg as dpkg\nfrom tests.support.mock import MagicMock, mock_open, patch\n\n\ndef test_get_pkg_license():\n \"\"\"\n Test _get_pkg_license for... | python | chosen |
[
{
"from": "human",
"value": "Test added for login/logout pwd\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# FOGLAMP_BEGIN\n# See: http://foglamp.readthedocs.io/\n# FOGLAMP_END\n\n\"\"\" Test authentication REST API \"\"\"\n\nimport http.client\nimport json\nimport time\nimport pyt... | python | chosen |
[
{
"from": "human",
"value": "Add has avatar column to project table\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 3d5c93bafb9d\nRevises: 7dc79d4ed7cd\nCreate Date: 2018-05-30 20:04:38.461178\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\nimport sqlalchemy_util... | python | chosen |
[
{
"from": "human",
"value": "Build a tree from inorder and preorder traversals\n"
},
{
"from": "gpt",
"value": "import unittest\n\"\"\"\nConstruct tree from given inorder and preorder traversals.\nInput:\nInorder: D B E A F C\nPreorder: A B D E C F\nIn a preorder sequence, leftmost element is ro... | python | chosen |
[
{
"from": "human",
"value": "Add command line test for cosym.py\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function\n\nimport os\nimport pytest\nimport procrunner\n\ndef test_cosym(regression_data, run_in_tmpdir):\n\n reg_path = regression_data(\"mu... | python | chosen |
[
{
"from": "human",
"value": "Add unit test module template for 'config' module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"\nUnit testing suite for config module.\n\"\"\"\n# --------------------------------- MODULES -----------------------------------\nimport unittest\n\n# A... | python | chosen |
[
{
"from": "human",
"value": "Add test for GNU/Linux CPU logical cores\n"
},
{
"from": "gpt",
"value": "'''\nTestCPU\n=======\n\nTested platforms:\n\n* Linux - nproc\n'''\n\nimport unittest\n\nfrom plyer.tests.common import PlatformTest, platform_import\n\n\nclass MockedNProc(object):\n '''\n ... | python | chosen |
[
{
"from": "human",
"value": "Return intersection of two sorted arrays\n"
},
{
"from": "gpt",
"value": "'''\nIn this module, we implement a function which gets the intersection\nof two sorted arrays. \n\n'''\n\ndef intersection_sorted_arrays(arr_1, arr_2):\n\t'''\n\tReturn the intersection of two... | python | chosen |
[
{
"from": "human",
"value": "Add N0Q check for iem21 to run"
},
{
"from": "gpt",
"value": "\"\"\"\nCheck the production of N0Q data!\n\"\"\"\nimport json\nimport datetime\nimport sys\n\nj = json.load( open('/home/ldm/data/gis/images/4326/USCOMP/n0q_0.json') )\nprodtime = datetime.datetime.strpti... | python | chosen |
[
{
"from": "human",
"value": "Add a convenience way to have a context key to cycle between values\n"
},
{
"from": "gpt",
"value": "import sublime, sublime_plugin\n\nvalues = {}\n\nclass CycleContextTracker(sublime_plugin.EventListener):\n def on_query_context(self, view, key, operator, operand... | python | chosen |
[
{
"from": "human",
"value": "Add command for resyncing cases for messaging\n"
},
{
"from": "gpt",
"value": "from corehq.form_processor.interfaces.dbaccessors import CaseAccessors\nfrom corehq.messaging.tasks import sync_case_for_messaging\nfrom corehq.util.log import with_progress_bar\nfrom djan... | python | chosen |
[
{
"from": "human",
"value": "Test sentiment analysis with Stanford NLP\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport re\nimport os\nimport time\nimport subprocess as s\n\ntweet_file = \"../tweets.csv\"\n\n# Change it!!!\nstanford_nlp_dir = \"/home/tonyo/EPFL/big_data/sentimen... | python | chosen |
[
{
"from": "human",
"value": "Add tests for custom headers\n\n"
},
{
"from": "gpt",
"value": "import httpretty\n\nfrom zipa import test_com as t\n\n\ndef test_config_zipa():\n t.config.host = 'random'\n t.config.prefix = 'prefix'\n t.config.append_slash = True\n t.config.secure = Fals... | python | chosen |
[
{
"from": "system",
"value": "tests: Add simple tests for burndown, calendar and ghistory commands\n"
},
{
"from": "human",
"value": "from tests.base import IntegrationTest\n\n\nclass TestBurndown(IntegrationTest):\n\n def execute(self):\n self.command(\"TaskWikiBurndownDaily\")\n ... | python | chosen |
[
{
"from": "human",
"value": "Create file - reverse in place, binary search"
},
{
"from": "gpt",
"value": "def reverse_array(input_array):\n left = 0\n right = len(input_array) - 1 # Array is 0 indexed\n tmp_array = input_array\n\n while right > left:\n tmp_array[left], tmp_a... | python | chosen |
[
{
"from": "human",
"value": "Add utility for clearing out redis keys from tests.\n"
},
{
"from": "gpt",
"value": "\"\"\"Utility for clearing all keys out of redis -- do not use in production!\"\"\"\n\nimport sys\nfrom optparse import OptionParser\n\nimport redis\n\n\ndef option_parser():\n pa... | python | chosen |
[
{
"from": "human",
"value": "Add a script to extract a minidump from a crash dump\n\nminidump_stackwalk doesn't know how to read dmp files generated by our\nbreakpad implementation. This tool makes it easier to analyze local\ncrashes.\n\nBUG=247431\nR=bauerb@chromium.org\nNOTRY=true\n\nReview URL: https://c... | python | chosen |
[
{
"from": "human",
"value": "Add test file with tests using unittest module\n\nTest calcWorkTime method. Test calculateDay method.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport PunchCard\n\n\nclass CaclWorkTimeTests(unittest.TestCase):\n\n def test_returnsTwo_givenEightAndTenOclock... | python | chosen |
[
{
"from": "human",
"value": "Add script to check if cluster jobs are finished.\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\n\n\ndef check_finished(sim_dir, file_name='lammps_out.txt'):\n dir_list = os.listdir(sim_dir)\n if file_name in dir_list:\n with open(os.path.join(s... | python | chosen |
[
{
"from": "human",
"value": "Test file for created package\n"
},
{
"from": "gpt",
"value": "from fake_webapp import EXAMPLE_APP\nfrom nose.tools import assert_equals\nfrom splinter.request_handler.request_handler import RequestHandler\n\nclass RequestHandlerTest(object):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to plot runtimes with matplotlib\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn\n\nmandelbrot_runtime = (38.6, 18.4)\nfactor_runtime = (16.5, 6.7)\n\nN = len(mandelbrot_runtime)\n\nind = np.arange(N) ... | python | chosen |
[
{
"from": "human",
"value": "Save data in an MS into a numpy file\n"
},
{
"from": "gpt",
"value": "\nimport numpy as np\nfrom taskinit import mstool\n\n\ndef extract_ms_data(vis, columns, field=\"\", **kwargs):\n '''\n Extract data points from an MS.\n '''\n\n myms = mstool()\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for salting the existing passwords\n"
},
{
"from": "gpt",
"value": "\"\"\"Salt passwords\n\nRevision ID: 542cdf68faa5\nRevises: 26745016c3ce\nCreate Date: 2014-04-16 15:15:05.393213\n\n\"\"\"\n\nimport string\nimport random\nfrom hashlib import new as new_... | python | chosen |
[
{
"from": "human",
"value": "Add case insensitive dict implementation into utils package.\n"
},
{
"from": "gpt",
"value": "import collections\n\n\nclass CaseInsensitiveDict(collections.MutableMapping):\n \"\"\"\n A case-insensitive ``dict``-like object.\n\n Implements all methods and op... | python | chosen |
[
{
"from": "human",
"value": "Add Chuanping Yu's solutions to Problem05"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"This script is written by Chuanping Yu, on Jul 24, 2017,\nfor the Assignment#1 in IDEaS workshop\"\"\"\n\n#Problem 5\nfrom fractions import gcd\ndef lcm(int1, int... | python | chosen |
[
{
"from": "human",
"value": "Add tests for st2common.transport.utils._get_ssl_kwargs function.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional ... | python | chosen |
[
{
"from": "human",
"value": "Add a test case to verify Multiplexed server/client functionality\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2014, Facebook, Inc. All rights reserved.\n#\n# This source code is licensed under the BSD-style license found in the\n# LICENSE file in the root direc... | python | chosen |
[
{
"from": "human",
"value": "Add python script for finding licenses.\n"
},
{
"from": "gpt",
"value": "\nimport os\nfor dirpath, dirnames, filenames in os.walk('./opensim'):\n for fname in filenames:\n if fname.endswith('.java'):\n fpath = os.path.join(dirpath, fname)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton of Patient dump command\n"
},
{
"from": "gpt",
"value": "import csv\nfrom django.core.management.base import BaseCommand\nfrom corehq.apps.locations.models import SQLLocation\nfrom corehq.util.log import with_progress_bar\nfrom corehq.form_processor.inte... | python | chosen |
[
{
"from": "human",
"value": "Create new database table: Ledger\n"
},
{
"from": "gpt",
"value": "# stdlib\nfrom typing import Any\n\n# third party\nfrom sqlalchemy import Column\nfrom sqlalchemy import LargeBinary\nfrom sqlalchemy import String\nfrom sqlalchemy import Float\n\n# syft absolute\nfr... | python | chosen |
[
{
"from": "human",
"value": "Test whether or not the tablet is connected to the teensy.\n"
},
{
"from": "gpt",
"value": "from tamproxy import Sketch, Timer\n\nclass SerialConnect(Sketch):\n\n def setup(self):\n self.timer = Timer()\n\n def loop(self):\n if (self.timer.millis(... | python | chosen |
[
{
"from": "human",
"value": "Add migration for slug and parent removal\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 ('rout... | python | chosen |
[
{
"from": "human",
"value": "Add communication layer with Slack API\n\n- New class SlackChannel : Allows to send message on a specific channel using\n Slack Web API\n- New method : Wraps SlackChannel objets and generates a Cineapp notification\n which sends a notification containing the movie, the mark an... | python | chosen |
[
{
"from": "human",
"value": "Add preliminary btn search plugin\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, division, absolute_import\nimport logging\n\nfrom flexget import validator\nfrom flexget.entry import Entry\nfrom flexget.plugin import register_plugin\nfrom f... | python | chosen |
[
{
"from": "human",
"value": "Add Hough Transform example script.\n"
},
{
"from": "gpt",
"value": "# Hough Transform Example:\n#\n# This example demonstrates using the Hough transform to find lines in an image.\nimport sensor, image, time\n\nkernel_size = 1 # kernel width = (size*2)+1, kernel hei... | python | chosen |
[
{
"from": "human",
"value": "Create starting scripts for the baxter\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom baxter_myo.ArmController import ArmController\n\n\ndef main():\n s = ArmController()\n s.loop()\n\nif __name__ == \"__main__\":\n main()\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights different squares problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Different D Problem\n\n\ndef differentSquares(matrix):\n rows, cols = len(matrix), len(matrix[0])\n if rows < 2 or cols < 2:\n return 0\n ... | python | chosen |
[
{
"from": "human",
"value": "Clear old Pollination Mapper results\n\nSince we upgraded to the 2017 CDL in #410 and 598ed284,\nthe current stored results in the database are out of date.\nBy clearing them out, we ensure they will be recalculated\nwhen those scenarios are revisited.\n"
},
{
"from": "g... | python | chosen |
[
{
"from": "human",
"value": "Add management command to rerun last analysis for testing\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nimport logging\n\nfrom django.core.management.base import BaseCommand\n\nfrom realtime.models.ash import Ash\nfrom realtime.models.earthquake import Earthquake\... | python | chosen |
[
{
"from": "human",
"value": "Add the beginnings of app.py tests\n\nThis doesn't test everything in app.py but it's a start.\n"
},
{
"from": "gpt",
"value": "from unittest import mock\n\nimport pytest\nfrom pyramid.config import Configurator\n\nfrom bouncer.app import app\n\n\ndef test_the_defaul... | python | chosen |
[
{
"from": "human",
"value": "Add script detection of long parameters files' paths"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport os\n\nPARENT_DIRECTORY = os.path.realpath('../..')\nPATH_LENGTH_TO_IGNORE = len(PARENT_DIRECTORY)\n\nPARAMETERS_DIRECTORY = os.path.join(PARENT_DIREC... | python | chosen |
[
{
"from": "human",
"value": "Add wordcount example from spark\n"
},
{
"from": "gpt",
"value": "#! /usr/env python\n\"\"\" a recreation of spark-streaming's network_wordcount\n\nhttps://spark.apache.org/docs/2.2.0/streaming-programming-guide.html#a-quick-example\n\nRun this within an interactive ... | python | chosen |
[
{
"from": "human",
"value": "Add data migration so preprints can be added to existing collections.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2018-11-08 16:56\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom osf.mo... | python | chosen |
[
{
"from": "human",
"value": "Add test for approximate estimator of dependence probability by MI.\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 (the \"License\");\... | python | chosen |
[
{
"from": "human",
"value": "Add LastWord DB tranformation until\n\nThis is useful when used as an annotation, for example:\n\n`qs.annotate(last_name=LastWord('full_name')).order_by('last_name')`\n"
},
{
"from": "gpt",
"value": "from django.db.models import Transform\n\n\nclass LastWord(Transfor... | python | chosen |
[
{
"from": "human",
"value": "Add BBN digital attenuator driver\n\n--CAR and GER\n"
},
{
"from": "gpt",
"value": "from .instrument import Instrument, VisaInterface\nfrom types import MethodType\n\nclass Attenuator(Instrument):\n NUM_CHANNELS = 3\n\n \"\"\"BBN 3 Channel Instrument\"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem A3\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*- \n\n# Copyright 2014 Fabian M.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ... | python | chosen |
[
{
"from": "human",
"value": "Add spider for Ernst & Young\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport json\nimport re\n\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\nfrom locations.hours import OpeningHours\n\n\nclass EySpider(scrapy.Spider):\n name = \"... | python | chosen |
[
{
"from": "human",
"value": "Add an example showing how to create a minimap\n\nDiscussed here: https://github.com/altair-viz/altair/issues/2037\n"
},
{
"from": "gpt",
"value": "\"\"\"\nScatter Plot with Minimap\n-------------------------\nThis example shows how to create a miniature version of a... | python | chosen |
[
{
"from": "human",
"value": "Add python script that returns string with PVs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sirius\n\nrecord_names = sirius.si.record_names.get_record_names()\npvs_list = list(record_names.keys())\npvs_string = ' '.join(pvs_list)\nprint(pvs_strin... | python | chosen |
[
{
"from": "human",
"value": "Write scraper script for Physicsforum forum\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport os.path\n\nfrom bs4 import BeautifulSoup\nimport requests\n\n\ndef post_filter(tag):\n if tag.name != 'blockquote':\n re... | python | chosen |
[
{
"from": "human",
"value": "Add utility library to do port forwarding\n\nThis will be useful for creating forwarding for\nusers.\n"
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2017 Lenovo\n#\n# Licensed under the Apache License, Version 2.0 (the \"Li... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.