conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to fix up wheel tag to manylinux\n\nWe use this instead of auditwheel directly because we have taken\ncare of the RPATH and auditwheel get confused.\n\nSigned-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Make flake8 happy (long lines)\n"
},
{
"from": "gpt",
"value": "##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Labora... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add tasks and views to existing projects\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrations, models\n\n\ndef run_data_migration(apps, schema_editor):\n Pro... | python | chosen |
[
{
"from": "human",
"value": "Verify String is edited only one time\n"
},
{
"from": "gpt",
"value": "def isEditedOnce(stringOne,stringTwo):\n stringOneLength = len(stringOne)\n stringTwoLength = len(stringTwo)\n totalChanges = 0\n if abs(stringOneLength - stringTwoLength) > 1:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add ROI extraction code for use w/ xarray\n"
},
{
"from": "gpt",
"value": "\"\"\" Utilities for extracting training data from region of interests (ROI)\n\"\"\"\nimport numpy as np\nfrom rasterio.features import rasterize\nfrom shapely.geometry import shape as geom_sh... | python | chosen |
[
{
"from": "human",
"value": "PUBDEV-8455: Add test to show GAM metrics are correct\n\nWe compare training metrics calculated in training and user-calculated\nmetrics.\n"
},
{
"from": "gpt",
"value": "from __future__ import division\nfrom __future__ import print_function\nimport sys\nsys.path.ins... | python | chosen |
[
{
"from": "human",
"value": "Add `url` and `reference_url` columns to risk object\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: urban@r... | python | chosen |
[
{
"from": "human",
"value": "scripts/image_signing: Add general security test script\n\nThis commit adds a general security test script. This allows\nsome logic to be moved out of the signer as well as providing a single\nentry point for the security tests run by the signer.\n\nBRANCH=none\nBUG=b:202397678\... | python | chosen |
[
{
"from": "human",
"value": "Add vcf writer preliminary test\n"
},
{
"from": "gpt",
"value": "'''\nCreated on 05/03/2010\n\n@author: peio\n'''\nimport unittest\nfrom franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq\nfrom Bio.SeqFeature import FeatureLocation\nfrom franklin.snv.snv_annot... | python | chosen |
[
{
"from": "human",
"value": "Add thin client tests. They don't work yet - they just kind of hang there.\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\nfrom pythinclient.client import *\nfrom pythinclient.server import *\nimport time\n\n\n__author__ = 'Alek Ratzloff <alekratz@gma... | python | chosen |
[
{
"from": "human",
"value": "Add script to view mass spec images\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nimport numpy as np\nimport napari\nfrom matplotlib.backends.backend_qt5agg import FigureCanvas\nfrom matplotlib.figure import Figure\n\n\n# load the data\ncube = np.load('dat... | python | chosen |
[
{
"from": "system",
"value": "Change suggested payment to flat 5%\n"
},
{
"from": "human",
"value": "from decimal import Decimal as D, ROUND_HALF_EVEN\n\n\ndef suggested_payment(usage):\n if usage >= 500:\n percentage = D('0.02')\n elif usage >= 20:\n percentage = D('0.05')\n... | python | chosen |
[
{
"from": "human",
"value": "Add ephemeral token redis tests\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom libs.redis_db import RedisEphemeralTokens\nfrom tests.utils import BaseTest\n\n\n@pytest.mark.redis_mark\nclass TestRedisEphemeralTokens(BaseTest):\n def test_objects(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add python code for pinging\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProgram will ping the list of website to see if they are online.\nWill give an error message if the website is down.\n\"\"\"\nimport subprocess\n\naddressListA = ['baseness.com',\n 'npr.or... | python | chosen |
[
{
"from": "system",
"value": "Remove dead run_scripthooks example reference."
},
{
"from": "human",
"value": "from mitmproxy import ctx\n\n\ndef request(flow):\n f = ctx.master.state.duplicate_flow(flow)\n f.request.path = \"/changed\"\n ctx.master.replay_request(f, block=True, run_scri... | python | chosen |
[
{
"from": "human",
"value": "Add example for injury class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom tabulate import tabulate\nfrom mlbgame import injury\nimport dateutil.parser\nfrom datetime import datetime\n\nteam_id = 117 # Houston Astros\ni = injury.Injury(team_id)\ninju... | python | chosen |
[
{
"from": "human",
"value": "Add get yara rules script\n"
},
{
"from": "gpt",
"value": "import urllib2\nimport socket\nfrom OTXv2 import OTXv2\nfrom OTXv2 import OTXv2, IndicatorTypes\n\notx = OTXv2('API_KEY')\n\npulses = otx.getall()\n\nfor i in range(0,len(pulses)-1):\n print (\"// https://... | python | chosen |
[
{
"from": "human",
"value": "Add a utility for copying data from one database to another.\n"
},
{
"from": "gpt",
"value": "import pymongo\nimport gridfs\nimport settings\n\ndef copy_data(source_db_name, dest_db_name, query):\n source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate SQL script for STGCD manual readings.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\n\nimport csv\nimport sqlite3\n\nconn = sqlite3.connect(\"twdb.db\")\ncur = conn.cursor()\n\nfile = open('stgcd_manual.csv', 'r')\n\nreader = csv.re... | python | chosen |
[
{
"from": "system",
"value": "Raise exception when script called with wrong args\n\n(instead of just printing)\n"
},
{
"from": "human",
"value": "import sys, os\nargs = sys.argv\n\nif (len(args) <= 1):\n print(\"ERROR: Please provide source url\")\n print(\"Example : python scraper.py url ... | python | chosen |
[
{
"from": "human",
"value": "Convert the raw data to obj file using PyMCubes.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport scipy.misc\nimport mcubes\nimport argparse\nfrom sklearn.neighbors import NearestNeighbors\n\n\nparser = argparse.ArgumentParser(description='Visualise the 3D... | python | chosen |
[
{
"from": "human",
"value": "Add data migration that deletes replaced objects\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.9 on 2020-01-31 08:25\n\nfrom django.db import migrations\n\n\ndef soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for provider name validators\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport services.models\n\n\nclass Migration(migrations.Migration):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a very simple script to export team data from the database as json files.\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nimport json\nfrom math import floor\nimport sys\nimport database as db\nfrom database.model import Team\nfrom geotools ... | python | chosen |
[
{
"from": "human",
"value": "REVE-183: Create On-Campus Learner Coupon Category\n"
},
{
"from": "gpt",
"value": "\"\"\" Add 'On-Campus Learners' to the list of default coupon categories\"\"\"\n\nfrom django.db import migrations\nfrom oscar.apps.catalogue.categories import create_from_breadcrumbs... | python | chosen |
[
{
"from": "human",
"value": "Add an override for create_permissions which batches the lookups\n"
},
{
"from": "gpt",
"value": "from django.db import DEFAULT_DB_ALIAS, router\nfrom django.db.models import get_model, get_models, signals, UnavailableApp\nfrom django.contrib.auth import (models as a... | python | chosen |
[
{
"from": "human",
"value": "Add test to check resource generation files are called\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests deployments.\"\"\"\n\nimport os\nimport re\nfrom tests.BaseTest import BaseTest\n\n\nclass DeploymentTest(BaseTest):\n \"\"\"Tests for deployments.\"\"\"\n\n def... | python | chosen |
[
{
"from": "human",
"value": "Add test for a life connection with a browser to test important code paths.\n"
},
{
"from": "gpt",
"value": "\"\"\" Test a live app connection.\n\"\"\"\n\nfrom flexx import app, react\n\nfrom flexx.util.testing import run_tests_if_main, raises\n\n\ndef runner(cls):\n... | python | chosen |
[
{
"from": "human",
"value": "Add Game of Life for lc\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def gameOfLife(self, board):\n \"\"\"\n :type board: List[List[int]]\n :rtype: void Do not return anything, modify board in-place instead.\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Python script to build all combinations of modules\n"
},
{
"from": "gpt",
"value": "import os\nfrom subprocess import call\nfrom itertools import product, repeat\n\n# To be called from the OpenSpace main folder\nmodules = os.listdir(\"modules\")\nmodules.remove(\... | python | chosen |
[
{
"from": "human",
"value": "Add base class for API Controller\n\nChange-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487\n"
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n#\n# Copyright 2014 Eugene Frolov <eugene@frolov.net.ru>\n#\n# All Rights Reserved.\n#\n# Licens... | python | chosen |
[
{
"from": "human",
"value": "Add user activity types module\n"
},
{
"from": "gpt",
"value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Publish What You Fund\n#\n# This progr... | python | chosen |
[
{
"from": "human",
"value": "Add class file for linked list and binary tree\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\tThis file includes several data structures used in LeetCode question.\n\"\"\"\n# Definition for a list node.\nclass ListNode(object):\n\tdef __init__(self, n):\n\t\tself.val = n... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for file module\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n#\n# Tests for dakota_utils.file.\n#\n# Call with:\n# $ nosetests -sv\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nfrom nose.tools import *\nimport os\nimport tempfile\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add script to annotate conference RSVP spreadsheets.\n\nRequested by @lbanner.\n"
},
{
"from": "gpt",
"value": "\"\"\"Utilities for annotating workshop RSVP data.\n\nExample ::\n\n import pandas as pd\n from scripts import annotate_rsvps\n frame = pd.read_cs... | python | chosen |
[
{
"from": "human",
"value": "Add script to copy a snippet from one party to another\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Copy a snippet (in its latest version) from one party to another.\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE... | python | chosen |
[
{
"from": "human",
"value": "Add Buckinghamshire and Worcestershire letter logos\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0243_another_letter_org\nRevises: 0242_template_folders\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0243_another_letter_org... | python | chosen |
[
{
"from": "human",
"value": "Add script to update names\n"
},
{
"from": "gpt",
"value": "from accounts.models import TimtecUser\nimport re\n\ncont = 0\nfor user in TimtecUser.objects.all():\n complete_name = user.first_name + \" \" + user.last_name\n complete_name = re.sub(' +',' ', comple... | python | chosen |
[
{
"from": "system",
"value": "Swap out modules in py2 mode in a cleaner fashion.\n\nPiperOrigin-RevId: 288526813\nChange-Id: I86efd4d804c0c873856307cf4a969270eb7bbae8\n"
},
{
"from": "human",
"value": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache ... | python | chosen |
[
{
"from": "human",
"value": "Add script for fixing SRT subtitle files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport optparse\nimport sys\n\ndef main():\n empty_subtitle = '''1\n00:00:00,000 --> 00:00:00,001\n\n'''\n\n parser, infile_name, outfile_name = parse_options()\n... | python | chosen |
[
{
"from": "human",
"value": "Add an admin command to fix party membership position end_dates\n\nThis is a fix for issue #550 - some party membership positions\nwere set to 2012, so they no longer appear as current\nparty memberships. Instead, we should set these to 'future'.\n\nWe will shortly be importing... | python | chosen |
[
{
"from": "human",
"value": "Add factory for text messages\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport factory\nfrom smsgateway.models import SMS\n\n\nclass SMSFactory(factory.DjangoModelFactory):\n FACTORY_FOR = SMS\n\n conte... | python | chosen |
[
{
"from": "human",
"value": "Add basic test to prove the concept\n"
},
{
"from": "gpt",
"value": "import unittest\nimport importlib\n\nimport sublime\nfrom SublimeLinter.lint.linter import get_linter_settings\n\nfrom SublimeLinter.tests.parameterized import parameterized as p\n\n\nLinterModule =... | python | chosen |
[
{
"from": "human",
"value": "Add admin committee view test\n"
},
{
"from": "gpt",
"value": "from tests import PMGLiveServerTestCase\nfrom pmg.models import db\nfrom tests.fixtures import (\n dbfixture, UserData, CommitteeData, MembershipData\n)\n\n\nclass TestAdminCommitteePage(PMGLiveServerT... | python | chosen |
[
{
"from": "human",
"value": "Add DB migration for previous URL field changes.\n\nSee #214.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2018-01-16 21:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Mi... | python | chosen |
[
{
"from": "human",
"value": "Add IKEA OTA download script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nSnipped to dowload current IKEA ZLL OTA files into ~/otau\nRequires python 2.7, not compatible with python 3.\n\"\"\"\n\nimport os\nimport json\nimport urllib\n\nf = urllib.u... | python | chosen |
[
{
"from": "human",
"value": "Add solution for Reverse String problem\n"
},
{
"from": "gpt",
"value": "\"\"\"\n# Problem statement\n\nhttps://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/\n\n## Algorithm description\n\nTraverse the given input until the middle ... | python | chosen |
[
{
"from": "human",
"value": "Add command to revoke tokens\n\nSigned-off-by: Cristian Vargas <87b43435284539b2f7f4e4dcab5e78251c243226@swapps.co>\n"
},
{
"from": "gpt",
"value": "# Django\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.contrib.auth.models import Us... | python | chosen |
[
{
"from": "human",
"value": "Add a quick script to dump transcript to stdout.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport argparse\nimport getpass\nimport sys\nimport StringIO\n\nimport mcgill\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(\n description='... | python | chosen |
[
{
"from": "human",
"value": "Add custom PhoneNumberField for use in NurseConnect\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\nfrom django.utils.encoding import force_text\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom phonenumber_field.fo... | python | chosen |
[
{
"from": "human",
"value": "Add solution and unit tests for problem 5\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProject Euler Problem 5\n=======================\n\n2520 is the smallest number that can be divided by each of the numbers\nfrom 1 to 10 without any remainder.\n\nWhat is the smallest ... | python | chosen |
[
{
"from": "human",
"value": "Make a 17B HI cube matched to the 30-m IRAM cube\n"
},
{
"from": "gpt",
"value": "\n'''\nCreate a cube that is spatially-matched and convolved to the IRAM 30-m\nCO(2-1) cube.\n'''\n\nimport os\nfrom os.path import join as osjoin\n\nfrom cube_analysis.reprojection imp... | python | chosen |
[
{
"from": "human",
"value": "Set up mongodb addon to heroku app; created a test python script to connect to db\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Documentation: http://api.mongodb.org/python/\n# A python script connecting to a MongoDB given a MongoDB Connection URI.\n\nimpor... | python | chosen |
[
{
"from": "human",
"value": "Test using bezier going through 4 specific points\n\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nimport sys\nimport os\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))\n#\n\n\nimport cocos\nfrom cocos.director import director\... | python | chosen |
[
{
"from": "system",
"value": "Test library fallback is overridden by setting a library\n"
},
{
"from": "human",
"value": "from mock import patch\nfrom pytest import raises\n\nfrom tvrenamr.errors import NoMoreLibrariesException\nfrom tvrenamr.main import Episode\n\nfrom .base import BaseTest\nfr... | python | chosen |
[
{
"from": "human",
"value": "[utils] Add a script for picking up all .remap files in a directory and applying the edits therein.\n\nSwift SVN r31773\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#\n#\n# Th... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 543. Diameter of Binary Tree\n\n543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 347. Top K Frequent Elements\n\n347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/\n"
},
{
"from": "gpt",
"value": "import heapq\nfrom operator import itemgetter\nfrom collections import Counter\nclass Solution(ob... | python | chosen |
[
{
"from": "human",
"value": "Add command to add tags to Election model\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom django.contrib.gis.gdal import DataSource\nfrom django.core.management import BaseCommand\nfrom django.db.models import Value\n\nfrom core.mixins import ReadFromFileMixin\n... | python | chosen |
[
{
"from": "human",
"value": "Add a small kiwi list example"
},
{
"from": "gpt",
"value": "import gtk\n\nfrom kiwi.ui.widgets.list import Column, List, SequentialColumn\n\nclass Person:\n \"\"\"The parameters need to be of the same name of the column headers\"\"\"\n def __init__(self, name,... | python | chosen |
[
{
"from": "human",
"value": "MP3: Add script to scrape tracklist from URL\n\nI didn't do this in separate commits because I had such a rough time\nextracting the div I needed from the page.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n# sudo apt-get install python3-pip\n# pip3 install ... | python | chosen |
[
{
"from": "human",
"value": "Add TvZ Human vs AI example\n"
},
{
"from": "gpt",
"value": "import sc2\nfrom sc2 import Race\nfrom sc2.player import Human, Bot\n\nfrom zerg_rush import ZergRushBot\n\ndef main():\n sc2.run_game(sc2.maps.get(\"Abyssal Reef LE\"), [\n Human(Race.Terran),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script for fingind cacheable responses and setting their delays to 0\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# TODO(cs): make cache hit ratio tunable.\n# TODO(cs): two analyses: perfect cachability at proxy, and perfect\n# cachability in brows... | python | chosen |
[
{
"from": "human",
"value": "Add script to identify unpinned repos\n"
},
{
"from": "gpt",
"value": "import yaml\nimport glob\nfor file in glob.glob(\"*.yaml\"):\n print(\"Processing %s\" % file)\n with open(file, 'r') as handle:\n w = yaml.load(handle)\n\n for tool in w['tools']:... | python | chosen |
[
{
"from": "human",
"value": "Add script to automatically save py file in jupyter.\n"
},
{
"from": "gpt",
"value": "# Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst\n\nimport io\nimport os\nfrom notebook.utils import to_api_path\n\n_script_exporte... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 447. Number of Boomerangs\n\n447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def numberOfBoomerangs(self, points):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add initial db migration for HouseSales\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 ]\n\n ope... | python | chosen |
[
{
"from": "human",
"value": "Work begun on neural network class.\n"
},
{
"from": "gpt",
"value": "\n\nimport numpy as np\n\n\nclass NeuralNEt(object):\n\n def __init__(self, inputs, outputs, *hiddens):\n \n self.shape = [inputs] + list(hiddens) + [outputs]\n self.layers =... | python | chosen |
[
{
"from": "human",
"value": "Add one-way migration from core to bookmarks\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('bookmarks', '0004_auto_20160901_2322'),\n ]\n\n operations = [\n ... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights spiral numbers problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Spiral Numbers Problem\n\n\ndef spiralNumbers(n):\n r, c = 0, 0 # Starting location\n # Delta for row or column increments: first direction is left... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights is beautiful string problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Is Beautiful String Problem\n\nimport string\n\n\ndef isBeautifulString(inputString):\n keys = string.ascii_lowercase\n for i in range(1, len(k... | python | chosen |
[
{
"from": "human",
"value": "Add test for hdfs handler\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom unittest.mock import MagicMock, patch\n\nfrom ..iorw import HDFSHandler\n\n\nclass MockHadoopFileSystem(MagicMock):\n def ls(self, path):\n return ['test1.ipynb', 'test2.ipynb'... | python | chosen |
[
{
"from": "human",
"value": "Add prototype and incomplete REST interface"
},
{
"from": "gpt",
"value": "import md5, urllib\nfrom twisted.internet import defer\nfrom twisted.web import client\nfrom elementtree import ElementTree\n\nclass FlickREST:\n endpoint = \"http://api.flickr.com/services... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for loading gsas data\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function\nimport unittest\nimport os\n\nfrom addie.addiedriver import AddieDriver\nfrom tests import DATA_DIR\n\nTOF = 'TOF'\nD_SPACING = 'dSpacing'\nQ... | python | chosen |
[
{
"from": "human",
"value": "Add babel translation string extractor function\n\nhaml.util.extract_haml adds ability for babel to\nrecognize and extract gettext translation tokens from haml files\n"
},
{
"from": "gpt",
"value": "\n\ndef extract_haml(fileobj, keywords, comment_tags, options):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add file to create all files to secex.\n"
},
{
"from": "gpt",
"value": "import os\nimport commands\nimport time\nimport logging\nimport sys\n\nif len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):\n print \"ERROR! Use:\\n python scripts/data_download/sec... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for CDH plugin versionfactory\n\nChanges:\n* add test cases for CDH plugin versionfactory\n* add a function to get supported versions into utils\n\npartially implements bp: cdh-plugin-refactoring\n\nChange-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Fix discover command failed to read extension list issue\n\nFix the key error which caused discover command failed to read the\nresponse body of extension list result. This change also added test\ncases to cover the use case of generic client extension discovery.\n\nChange-Id: I... | python | chosen |
[
{
"from": "human",
"value": "Create a py.test fixture to use the new stories.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport pytest\nimport os\nimport json\n\n@pytest.fixture(scope=\"class\",\n params=os.listdir('test_fixtures'))\ndef story(request):\n \"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate HR bic code registry\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport json\nimport xlrd\nimport requests\n\nURL = (\n \"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/\"\n \"06982c63-13e3-4aa0-846d-af... | python | chosen |
[
{
"from": "human",
"value": "Cover \"lib\" commands with tests\n"
},
{
"from": "gpt",
"value": "# Copyright (C) Ivan Kravets <me@ikravets.com>\n# See LICENSE for details.\n\nfrom os import listdir\nfrom os.path import isdir, isfile, join\n\nimport re\n\nfrom click.testing import CliRunner\n\nfro... | python | chosen |
[
{
"from": "human",
"value": "tests: Add local test for over limit check\n\nSigned-off-by: Xuanwo <60f7302bde66b4a81d2f70acbeb96280e4013e10@gmail.com>\n"
},
{
"from": "gpt",
"value": "# MIT licensed\n# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.\n\nimport os\nimport pytest\nimpo... | python | chosen |
[
{
"from": "human",
"value": "Add required field data for the initial project\n\nThe permalink_prefix field has been add to the Repository object and\nmade required, but we never added a data migration to populate it for\nthe initial project (Pontoon Intro). So let's do this now.\n"
},
{
"from": "gpt... | python | chosen |
[
{
"from": "human",
"value": "Add module with BYCEPS-specific types for PEP 484 type hints\n"
},
{
"from": "gpt",
"value": "\"\"\"\nbyceps.typing\n~~~~~~~~~~~~~\n\nBYCEPS-specific type aliases for PEP 484 type hints\n\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENS... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for provisioning instance with floating IP (NC-1470)\n"
},
{
"from": "gpt",
"value": "from rest_framework import status, test\n\nfrom nodeconductor.structure.models import CustomerRole\nfrom nodeconductor.structure.tests import factories as structure_f... | python | chosen |
[
{
"from": "human",
"value": "Add migration script to register runners\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# 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 in... | python | chosen |
[
{
"from": "human",
"value": "Add usage example for timer feature\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nexamples.timer_spinner\n~~~~~~~~~~~~~~~~~~~~~~\n\nShow elapsed time at the end of the line.\n\"\"\"\n\nimport time\n\nfrom yaspin import yaspin\n\n\ndef main():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for our consumer quickstart\n"
},
{
"from": "gpt",
"value": "import inspect\nimport pkg_resources\n\nfrom datetime import timedelta\n\nfrom moksha.api.hub import Consumer\nfrom moksha.pastetemplate import MokshaConsumerTemplate\n\nfrom base import Quic... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating upload request stream\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport fileinput\nimport hashlib\nimport itertools\nimport random\nimport re\nimport sys\nimport timer\nimport utils\n\n\"\"\"\nGenerates an upload request stre... | python | chosen |
[
{
"from": "human",
"value": "Add first unit test using py.test\n\nTests Cardinal's decorators\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport decorators\n\ndef test_command():\n # ensure commands is a list with foo added\n @decorators.command('foo')\n def foo():\n pass\n... | python | chosen |
[
{
"from": "human",
"value": "Write an Alembic migration script\n"
},
{
"from": "gpt",
"value": "\"\"\"Add checkpoint_evaluation table\n\nRevision ID: 14ef1fe33bd\nRevises: 3d0a468b38f\nCreate Date: 2015-07-10 02:35:06.655075\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '14ef... | python | chosen |
[
{
"from": "human",
"value": "Select features using l1 regularization\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport pandas as pd\n\nfrom sklearn.linear_model import Lasso\n\nfrom sklearn.preprocessing import StandardScaler\n\n\n\t\n\ndf = pd.read_csv(\"NABIL.csv\")\ndf.drop(df.colum... | python | chosen |
[
{
"from": "human",
"value": "Implement a post gen hook to rename mkdocs files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger('post_gen_project')\n\nimport shutil\nimport os\n\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for commands module\n"
},
{
"from": "gpt",
"value": "import json\nimport datetime\n\nfrom simplekv import fs\n\nfrom test.base import ApiTestCase\n\nfrom zou.app.utils import commands\n\n\ndef totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):\n td = ... | python | chosen |
[
{
"from": "human",
"value": "Particle: Add test to verify timestepping and endtimes after execute\n"
},
{
"from": "gpt",
"value": "from parcels import Grid, ScipyParticle, JITParticle, KernelOp\nimport numpy as np\nimport pytest\n\n\nptype = {'scipy': ScipyParticle, 'jit': JITParticle}\n\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015, MIT Probabilistic Computing Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice... | python | chosen |
[
{
"from": "human",
"value": "Add Longest Common Subsequent implementation\n"
},
{
"from": "gpt",
"value": "def lcslen(x, y):\n # Allocate extra row and column for the empty sequence case.\n # Extra row and column is appended to the end and exploit\n # Python's ability of negative indice... | python | chosen |
[
{
"from": "human",
"value": "Add the method for finding names using regular expression matching.\n"
},
{
"from": "gpt",
"value": "import re\n\ndef find_memtions(content):\n regex = re.compile(r\"@(?P<username>)(\\s|$)\", re.I)\n return [m.group(\"username\") for m in regex.finditer(content... | python | chosen |
[
{
"from": "human",
"value": "[Chore] Migrate: Remove tags field from user Model\n"
},
{
"from": "gpt",
"value": "\"\"\"Remove tag table\n\nRevision ID: ebcc92fc4d27\nRevises: 444c69da7c45\nCreate Date: 2017-05-08 01:01:48.865909\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# r... | python | chosen |
[
{
"from": "human",
"value": "Add tests for utils module.\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\nimport pprint\n\nfrom xoinvader.utils import create_logger\nfrom xoinvader.utils import InfiniteList\nfrom xoinvader.utils import Point\n\n\nclass TestUtils(unittest.TestCase):\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.