conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add tool to find users for compromised keys on aws\n"
},
{
"from": "gpt",
"value": "import boto.iam\nimport sys\n\nTARGET_ACCESS_KEY = sys.argv[1]\n\niam = boto.connect_iam()\n\nusers = iam.get_all_users('/')['list_users_response']['list_users_result']['users']\n\nde... | python | chosen |
[
{
"from": "system",
"value": "Make zaatari import from azraq\n"
},
{
"from": "human",
"value": "\"\"\"Ideaxbox for Zaatari, Jordan\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_PLACE_NAME = _(\"city\")\nCOUNTRIES_FIRST = ['SY', 'JO']\nTIM... | python | chosen |
[
{
"from": "human",
"value": "Add a spherical harmonics example\n"
},
{
"from": "gpt",
"value": "\nfrom enthought.mayavi import mlab\nimport numpy as np\nfrom scipy.special import sph_harm\n\n# Create a sphere\nr = 0.3\npi = np.pi\ncos = np.cos\nsin = np.sin\nphi, theta = np.mgrid[0:pi:101j, 0:2*... | python | chosen |
[
{
"from": "human",
"value": "Add tests for numpy array manipulation\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport unittest\nimport numpy as np\nfrom numba.compiler import compile_isolated, Flags\nfrom numba import types, utils\nfrom numba.tests import usecases\n\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for numpy array creation\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport unittest\nimport numpy as np\nfrom numba.compiler import compile_isolated, Flags\nfrom numba import types, utils\nfrom numba.tests import usecases\n\nena... | python | chosen |
[
{
"from": "human",
"value": "Add a time-based example for the functionality that exists so far.\n"
},
{
"from": "gpt",
"value": "import random\nimport transaction\n\nfrom inevitable.core import Reactor\n\n\ndef callback():\n for i in xrange(10000):\n answer = i ** 3\n if random.rand... | python | chosen |
[
{
"from": "human",
"value": "Add Jinja2 template loader for Django.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\n A Jinja2 template loader for Django 1.2+\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n Add the following to your settings.py file. (The comma is important!) \n\n ... | python | chosen |
[
{
"from": "human",
"value": "Test cases for beacon requests\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom solvebio.resource import Dataset\n\nfrom .helper import SolveBioTestCase\n\n\nclass BeaconTests(SolveBioTestCase):\n\n def test_beacon_request(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Load phosphosite data from dataset .tsv file\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nfrom os.path import dirname, abspath, join\nfrom collections import namedtuple, def... | python | chosen |
[
{
"from": "human",
"value": "Implement an object-oriented lambda calculus AST\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: UTF-8 -*-\n\n\"\"\"\nlexer.py\n\n@author ejnp\n\"\"\"\n\n\nclass Expression(object):\n \"\"\"Abstract class for any lambda calculus expression.\"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add a basic test for RCNNTarget\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nimport numpy as np\n\nfrom easydict import EasyDict\nfrom luminoth.models.fasterrcnn.rcnn_target import RCNNTarget\n\n\nclass RCNNTargetTest(tf.test.TestCase):\n\n def setUp(... | python | chosen |
[
{
"from": "human",
"value": "Check if nailgun's requirements do not conflict\n\nAdded simple test that will try to parse nailgun's\nrequirements and see if there are any problems with them.\n\nChange-Id: I342eda0a3b019780e0d452455734591aab91f6e9\nCloses-Bug: #1462281\n"
},
{
"from": "gpt",
"valu... | python | chosen |
[
{
"from": "human",
"value": "Add util script for dumping Access tables to .csv\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# AccessDump.py\n# A simple script to dump the contents of a Microsoft Access Database.\n# It depends upon the mdbtools suite:\n# http://sourceforge.net/pro... | python | chosen |
[
{
"from": "system",
"value": "[Fix] Fix CamelCase on PEC module\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyright (C) 2004-2010 Tiny SPRL (<h... | python | chosen |
[
{
"from": "human",
"value": "Add unique constraint to vendor slug\n"
},
{
"from": "gpt",
"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@reciprocitylabs.co... | python | chosen |
[
{
"from": "human",
"value": "FIX prd_classif: set taxes on all companies sharing classif\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2020 David BEAL @ Akretion\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\nfrom odoo.tests.common import TransactionCase\n\n\nclass M... | python | chosen |
[
{
"from": "human",
"value": "Mark all implausibly large responses as having errors.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom south.v2 import DataMigration\nfrom education.models import Response\n\n\nclass Migration(DataMigration):\n\n def forwards(self, orm):\n im... | python | chosen |
[
{
"from": "human",
"value": "Validate mariadb config on the overcloud controller\n\nThe script is meant to grow to validate more settings on the overcloud\ncontroller.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport ConfigParser\n\nMARIADB_MAX_CONNECTIONS_MIN = 4096\n... | python | chosen |
[
{
"from": "human",
"value": "Add create graph class based on parallel preprocess\n"
},
{
"from": "gpt",
"value": "from pygraphc.preprocess.ParallelPreprocess import ParallelPreprocess\nfrom pygraphc.similarity.JaroWinkler import JaroWinkler\nimport networkx as nx\nfrom time import time\n\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Set up a proof of concept for the module API\n"
},
{
"from": "gpt",
"value": "from pyheufybot.message import IRCMessage\nfrom pyheufybot.serverinfo import ServerInfo\nfrom pyheufybot.heufybot import HeufyBot\n\nclass Module(object):\n def __init__(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add some more use of raw_id_fields for user bans, and more filter options.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom users.models import UserBan\n\n\nclass UserBanAdmin(admin.ModelAdmin):\n fields = ('user', 'by', 'reason', 'is_a... | python | chosen |
[
{
"from": "human",
"value": "Test case for JSON serializer\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. You may obtain\n# a copy of the License at\n#\n# http://www.... | python | chosen |
[
{
"from": "human",
"value": "Add test for itanium mangler\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import\n\nfrom numba import unittest_support as unittest\nfrom numba import itanium_mangler\nfrom numba import int32, int64, uint32, uint64, float32, float64... | python | chosen |
[
{
"from": "human",
"value": "Trim the package before it is turned into a .dmg file\n"
},
{
"from": "gpt",
"value": "import shutil\nimport os\n\n\"\"\"\nInstructions\n------------\n# Build the app\n# Look at the timestamps in the generated app directory\n# Wait a bit\n\npushd pai/dist/Content/Mac... | python | chosen |
[
{
"from": "human",
"value": "Add utils for generating, reading and writing signing keys\n"
},
{
"from": "gpt",
"value": "from syutil.base64util import encode_base64, decode_base64\nimport nacl.signing\n\nNACL_ED25519 = \"ed25519\"\n\ndef generate_singing_key(version):\n \"\"\"Generate a new s... | python | chosen |
[
{
"from": "human",
"value": "Add solution to challenge 1.\n"
},
{
"from": "gpt",
"value": "import base64\n\ndef hex_to_base64(hex_string):\n return base64.b64encode(base64.b16decode(hex_string, True))\n\nif __name__ == '__main__':\n hex_string = raw_input(\"> \")\n print hex_to_base64(h... | python | chosen |
[
{
"from": "human",
"value": "Add a smoke testing script (incomplete)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport urllib2\n\nUSER_AGENTS={\n \n # iPhone 3 - gets smart styling\n 'smart': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) App... | python | chosen |
[
{
"from": "human",
"value": "Add get/set for Tags, and test\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom appname.models import db, Tag\n\n@pytest.mark.usefixtures(\"testapp\")\nclass TestModels:\n\tdef test_Tag(self, testapp):\n\t\tt = Tag('tagName')\n\t\tassert t.namex == 'tagName'\t\... | python | chosen |
[
{
"from": "human",
"value": "[py] Add WPEWebKit options test case\n"
},
{
"from": "gpt",
"value": "# Licensed to the Software Freedom Conservancy (SFC) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding ... | python | chosen |
[
{
"from": "human",
"value": "Add script for getting top subreddits.\n"
},
{
"from": "gpt",
"value": "\"\"\"Small tool for scraping http://redditlist.com/\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport sys\n\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add reverb_variable_container as a module.\n\nPiperOrigin-RevId: 332960465\nChange-Id: I5ab58ad8529db359891f3296274176a002791436\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n# Copyright 2018 The TF-Agents Authors.\n#\n# Licensed under the Apache License, Version ... | python | chosen |
[
{
"from": "human",
"value": "Read results and write to a txt file\n"
},
{
"from": "gpt",
"value": "\ndef read(filename):\n f = open(filename)\n line = f.readline()\n print(line)\n folds_res = line.split(',')\n f.close()\n return folds_res[1:11]\n\n\nfor i in range(1, 13):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a simple unittest for logging support\n"
},
{
"from": "gpt",
"value": "pytest_plugins = \"logwatch\"\n\n\ndef test_logwatch_source(testdir):\n testdir.makeconftest(\"\"\"\n import mock\n import pytest\n\n pytest_plugins = 'logwatch'\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to message PRs in a range\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCommand-line script message pull requests in a range\n\"\"\"\nfrom os import path\nimport sys\nimport logging\nimport click\n\n# Add top-level module path to sys.path before importing tubul... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for custom objects scope."
},
{
"from": "gpt",
"value": "import pytest\nfrom keras.utils.generic_utils import custom_object_scope\nfrom keras import activations\nfrom keras import regularizers\n\n\ndef test_custom_objects_scope():\n\n def custom_fn()... | python | chosen |
[
{
"from": "human",
"value": "Add migration for content defaults.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2018-07-24 22:43\nfrom __future__ import unicode_literals\n\nimport django.contrib.postgres.fields.jsonb\nfrom django.db import migrations\n\... | python | chosen |
[
{
"from": "human",
"value": "Allow app to be bound to CMS pages\n"
},
{
"from": "gpt",
"value": "from cms.app_base import CMSApp\nfrom cms.apphook_pool import apphook_pool\nfrom django.utils.translation import ugettext_lazy as _\n\nclass JobsAppHook(CMSApp):\n name = _(\"Jobs\")\n urls = [... | python | chosen |
[
{
"from": "human",
"value": "Add solution to exercise 15.1.\n"
},
{
"from": "gpt",
"value": "# 15-1. Cubes\n\nimport matplotlib.pyplot as plt\n\ndef plot_cubes(min_x, max_x):\n\t\"\"\"Plots the cube of range of numbers\"\"\"\n\tx_values = list(range(min_x, max_x))\n\ty_values = [x**3 for x in x_... | python | chosen |
[
{
"from": "human",
"value": "Add a tcp client to read from tcp\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# This script was read data from a serial port forwarded to tcp with\n# socat with the following command:\n# sudo socat tcp-l:1234,reuseaddr,fork file:/dev/ttyACM0,nonblock,raw,... | python | chosen |
[
{
"from": "human",
"value": "Add example for alternate axes scale.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nScatter Plots with alternate Y axis scale\n---------------------------------\nA few examples that make use of alternate Y axis scales.\n\"\"\"\n# category: simple charts\n\nimport altair a... | python | chosen |
[
{
"from": "system",
"value": "Add a failing test (for a usability issue)\n"
},
{
"from": "human",
"value": "import django.test\nfrom search.models import Project\n\nclass NonJavascriptSearch(django.test.TestCase):\n fixtures = ['bugs-for-two-projects.json']\n\n def testSearch(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to display stock for conky.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\nfrom __future__ import print_function\nfrom grs import RealtimeTWSE\n\ndef main():\n stock = RealtimeTWSE('0050')\n data = stock.data['0050... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration w.r.t. health check frequency.\n\nChange-Id: Ic6a40780bfe73245593fcb5f8cfbb8a6eb4d8dd6\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-03-02 04:04\nfrom __future__ import unicode_literals\n\nfrom dja... | python | chosen |
[
{
"from": "human",
"value": "Add new tests for update from vector\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import assert_allclose\nfrom pybug.image import *\nfrom nose.tools import raises\n\n\ndef update_im_from_vector(im):\n new_values = np.random.random(im.pix... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for elsewhere public.json\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, unicode_literals\n\nimport json\n#import datetime\n\n#import pytz\nfrom gittip.testing import Harness\n\n\nclass Tests(Harness):\n\n def test_returns_j... | python | chosen |
[
{
"from": "human",
"value": "Add a script to save trained cls and bbox weights.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os.path as osp\nthis_dir = osp.dirname(__file__)\nsys.path.insert(0, osp.join(this_dir, '../../external/caffe-mpi/build/install/python/'))\... | python | chosen |
[
{
"from": "human",
"value": "Add test for spin-orbital Hartree-Fock theory\n\nThe actual value is not tested, which will be added when the\nsubstitution facility is ready.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the general many-body problem.\"\"\"\n\nimport pytest\nfrom sympy import In... | python | chosen |
[
{
"from": "human",
"value": "ADD unit test for jieba\n"
},
{
"from": "gpt",
"value": "# encoding=utf-8\nimport unittest\n\nimport jieba\n\n\nclass TestJieba(unittest.TestCase):\n def test_text_split(self):\n sentence = \"我爱北京天安门\"\n seg_list = jieba.cut(sentence)"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add tests for share view functions\n"
},
{
"from": "gpt",
"value": "from nose.tools import * # PEP8 asserts\nfrom mock import patch\nfrom tests.base import OsfTestCase\n\nfrom website.search import share_search\n\n\nclass TestShareSearch(OsfTestCase):\n\n @patch.... | python | chosen |
[
{
"from": "human",
"value": "Add tests for helper functions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n Tests for helper and utility methods\n TODO: move integration tests (e.g. all that test a full request cycle)\n into smaller, broken-up unit tests to simplify t... | python | chosen |
[
{
"from": "human",
"value": "Add tests for nuclear QN accessors and dummies\n\nHere we just test the most basic printing and assumptions.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for special utilities related to nuclear problems.\"\"\"\n\nimport pytest\nfrom sympy import Symbol, simplify, la... | python | chosen |
[
{
"from": "human",
"value": "Update 'enabled' services to 'published'\n\nThe previous migration that added the 'status' field set all G6 services to 'enabled'. This was wrong - they should be 'published', as they are visible to everyone ('enabled' will be visible only to admin and the supplier of the servic... | python | chosen |
[
{
"from": "human",
"value": "Add migrations file from server, after inventory update.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2017-11-07 21:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migratio... | python | chosen |
[
{
"from": "human",
"value": "feat: Add scripts which define a function that takes an image, a color space, and a new image size and returns a feature vector\n"
},
{
"from": "gpt",
"value": "# Code given by Udacity, complete by Andres Guijarro\n# Define a function that takes an image, a color spa... | python | chosen |
[
{
"from": "system",
"value": "Fix users count for unit test\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# coding=utf-8\n################################################################################\n\nfrom test import CollectorTestCase\nfrom test import get_collector_config\nfrom te... | python | chosen |
[
{
"from": "human",
"value": "Add an example for computing sparse codes using RICA.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport theanets\n\nfrom utils import load_mnist, plot_layers, plot_images\n\n\nclass RICA(theanets.Aut... | python | chosen |
[
{
"from": "system",
"value": "Expand dynamic slice-fetch example to show fallback\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8\nimport Ice, IcePy, sys, tempfile\n\nice = Ice.initialize(sys.argv)\n\nproxy = ice.stringToProxy('Meta:tcp -h 127.0.0.1 -p 6502')\nslic... | python | chosen |
[
{
"from": "human",
"value": "Test logging of Sense data to mongodb\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom sense_hat import SenseHat\nfrom pymongo import MongoClient\nimport time\nimport datetime\n\nsense = SenseHat()\nsense.clear()\n\nclient = MongoClient('localhost:2701... | python | chosen |
[
{
"from": "human",
"value": "Add a script to import new constituency office locations.\n\nPMG are conducting an exercise to go to all the constituency offices\nand get accurate locations for them and photographs. The data they\ncollect is available as a CSV, and this new management command\nprocesses that C... | python | chosen |
[
{
"from": "human",
"value": "Add script to sync rules\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport os\nimport shutil\nimport argparse\nimport logging\nfrom snakemake_rules import SNAKEMAKE_RULES_PATH\nfrom snakemake.workflow import Workflow\nfrom snakemake.exceptions import pr... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate download links used on simpleitk.org\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#=========================================================================\n#\n# Copyright Insight Software Consortium\n#\n# Licensed under the Apach... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for prime numbers generator\n"
},
{
"from": "gpt",
"value": "#prime numbers function test cases\nimport unittest\nfrom prime import prime_numbers\n\nclass PrimeTest(unittest.TestCase):\n def test_returns_prime_numbers(self):\n self.assertList... | python | chosen |
[
{
"from": "human",
"value": "Add test for recently added helper\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2019 Tobias Gruetzmacher\n\nfrom __future__ import absolute_import, division, print_function\n\nimport pytest\nimport re\nfrom dosagelib.helpers import joinPa... | python | chosen |
[
{
"from": "human",
"value": "Make vrt.h include <stddef.h> and <stdint.h>\n\nOriginally we decided that the output of VCC should be 100%\nstand-alone and therefore contain no #includes at all. This\nwas hoped to avoid unspecified trouble with C-compilers at runtime.\n\nBut C99 is old enough to drink now, s... | python | chosen |
[
{
"from": "human",
"value": "Duplicate SCAD ID in civi\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\r\n\r\nfrom reporter.reports import Report\r\nfrom reporter import (\r\n get_contact_id_search_link, RECIPIENT_SCAD_ADMIN\r\n)\r\n\r\n\r\nclass DuplicateScadIdInCivi(Report):\r\n ... | python | chosen |
[
{
"from": "human",
"value": "[AC-9512] Merge remote-tracking branch 'origin' into AC-9512\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.10 on 2021-11-24 16:41\nimport swapper\nfrom django.db import migrations\n\n\ndef add_startup_profile_top_nav(apps, schema_editor):\n NavTreeIte... | python | chosen |
[
{
"from": "human",
"value": "Add class represents terminal symbol\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\n\nclass Terminal:\n def __init__(self, symbol, grammar):\n ... | python | chosen |
[
{
"from": "human",
"value": "Read stdout immediately adn stderr too\n"
},
{
"from": "gpt",
"value": "import logging\n\ndef execute(remote, command):\n logging.debug(\"Executing command: '%s'\" % command.rstrip())\n chan = remote._ssh.get_transport().open_session()\n stdin = chan.makefil... | python | chosen |
[
{
"from": "human",
"value": "Add new SMS rate for April 1 2021.\n\nDowngrade script isn't necessary.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID: 0350_update_rates\nRevises: 0349_add_ft_processing_time\nCreate Date: 2021-04-01 08:00:24.775338\n\n\"\"\"\nimport uuid\n\nfrom alembic imp... | python | chosen |
[
{
"from": "human",
"value": "Add a script that exports OTP counters from privacyIDEA\n\nJust for sake of completeness I add this script\nthat helped in different migration scenarios.\nIt exports only the counter values from all tokens\nin the database. (relevant for HOTP and TOTP)\n"
},
{
"from": "g... | python | chosen |
[
{
"from": "human",
"value": "Add 1 more missing file\n"
},
{
"from": "gpt",
"value": "d1 = {42 : 100}\r\nd2 = {'abc' : 'foo'}\r\n\r\ns = set([frozenset([2,3,4])])\r\nclass C(object):\r\n abc = 42\r\n\r\n def f(self): pass\r\n\r\ncinst = C()\r\n\r\nclass C2(object):\r\n abc = 42\r\n d... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 600. Non-negative Integers without Consecutive Ones\n\n600. Non-negative Integers without Consecutive Ones: https://leetcode.com/problems/non-negative-integers-without-consecutive-ones/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add subscriptions for all memberships\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.5 on 2017-11-02 09:45\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.db.transaction import atomic\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for senlin-dashboard rest api\n\nChange-Id: Id0372305d71063b0ef029c1c7fb1dac516ef088f\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... | python | chosen |
[
{
"from": "human",
"value": "Add db migration: expiration/expiring choices for mailer\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 = [\... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for diffiehellman\n"
},
{
"from": "gpt",
"value": "#/usr/bin/python3\n# -*- coding: utf-8 -*-\n# Run from Cryptchat\n# python3 -m cryptchat.test.test_diffiehellman\n\nimport unittest\nfrom ..crypto.diffiehellman import DiffieHellman\n\n\nclass testDiff... | python | chosen |
[
{
"from": "human",
"value": "Add tests for children method.\n\n- all children are returned\n- filter by tag\n- filter by id\n- filter by class\n- negate filter (exclude)\n"
},
{
"from": "gpt",
"value": "# coding: pyxl\n\nfrom pyxl import html\n\ndef test_no_filter():\n children = <div><p>One<... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 525. Contiguous Array\n\n525. Contiguous Array: https://leetcode.com/problems/contiguous-array/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findMaxLength(self, nums):\n \"\"\"\n :type nums: List[int]\n :r... | python | chosen |
[
{
"from": "human",
"value": "Add test case for sscanf\n"
},
{
"from": "gpt",
"value": "import nose\nimport angr\nimport subprocess\n\nimport logging\nl = logging.getLogger('angr.tests.sscanf')\n\nimport os\ntest_location = str(os.path.dirname(os.path.realpath(__file__)))\n\n\ndef run_sscanf(thre... | python | chosen |
[
{
"from": "human",
"value": "Add a migration to fix bad event_id values\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import *\nfrom migrate import *\n\ndef upgrade(migrate_engine):\n # Upgrade operations go here. Don't create your own engine; bind migrate_engine\n # to your metadata\n\... | python | chosen |
[
{
"from": "human",
"value": "Add migration for camino shutdown\n"
},
{
"from": "gpt",
"value": "\"\"\"bug 878109 shut camino down\n\nRevision ID: 54e898dc3251\nRevises: 471c6efadde\nCreate Date: 2013-07-03 09:21:07.627571\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '54e898d... | python | chosen |
[
{
"from": "human",
"value": "Add a tool for determining active SVN committers.\n"
},
{
"from": "gpt",
"value": "\n# Run svn log -l <some number>\n\nimport re\nimport numpy as np\nimport os\n\nnames = re.compile(r'r\\d+\\s[|]\\s(.*)\\s[|]\\s200')\n\ndef get_count(filename, repo):\n mystr = ope... | python | chosen |
[
{
"from": "human",
"value": "examples: Add very simple loaders python example.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\n\nimport gfxprim.core as core\nimport gfxprim.loaders as loaders\nimport gfxprim.filters as filters\n\ndef main():\n if len(sys.argv) != 2:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for test_question_section_is_empty\n\nChange-Id: Ic83098dbb5527ef1430bdb8f1159802344ca1d97\n"
},
{
"from": "gpt",
"value": "# Copyright 2019 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 343. Integer Break\n\n343. Integer Break: https://leetcode.com/problems/integer-break/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def integerBreak(self, n):\n \"\"\"\n :type n: int\n :rtype: int\n \"\... | python | chosen |
[
{
"from": "human",
"value": "Write a few tests for models\n\nWrote these tests while investigating a problem I had while writing a\ncustom backend.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8\nfrom __future__ import unicode_literals, absolute_import\n\nfrom django.contrib.auth import ge... | python | chosen |
[
{
"from": "human",
"value": "Add tests for jupyter notebooks\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\nimport tempfile\nimport nbformat\n\n\nclass TestExamples:\n\n def _notebook_run(self, path):\n \"\"\"\n Execute a notebook via nbconvert and collect output... | python | chosen |
[
{
"from": "human",
"value": "KE: Add a comment to dump petition and senate comments data\n\nThis is needed both for analysis by MIT and to forward the comments on\nto the senate.\n"
},
{
"from": "gpt",
"value": "import json\nfrom optparse import make_option\nimport re\n\nfrom django.core.managem... | python | chosen |
[
{
"from": "human",
"value": "Add a simple example using asyncio: something that could be used to emulate physical nodes.\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport time\nimport random\nimport string\n\nclass ASyncDHash(object):\n\tdef __init__(self):\n\t\tself.nodes = [ASyncNodes('#... | python | chosen |
[
{
"from": "human",
"value": "Add presubmit check to lint test files.\n\nBUG=5339\nTEST=report error by \"gcl presubmit\" with bad test_expectations.txt.\n\nReview URL: http://codereview.chromium.org/160442\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@22456 0039d316-1c4b-4281-b951-d872f2087c98\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add module for global debug variables.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Tue Feb 03 10:28:37 2015\r\n\r\n@author: Jens von der Linden\r\n\r\nglobal variables all_f and all_g save value of f,g and r each time an f_func, o... | python | chosen |
[
{
"from": "human",
"value": "Add fabric.py helper script back\n"
},
{
"from": "gpt",
"value": "from fabric.api import *\n\n\"\"\" \n Overview\n ========\n\n This fabric file automates the process of pip packaging and\n deploying your new pip package to our private pip repository.\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test case to driller\n"
},
{
"from": "gpt",
"value": "import nose\nimport driller\n\nimport logging\nl = logging.getLogger(\"driller.tests.test_driller\")\n\nimport os\nbin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../b... | python | chosen |
[
{
"from": "human",
"value": "Add script to load peaks from csv\n"
},
{
"from": "gpt",
"value": "#!./venv/bin/python\n\nimport argparse\nimport csv\nimport datetime\nimport sys\nimport re\nfrom collections import namedtuple\n\nfrom blag import create_app, db\nfrom blag.models import HikeDestinati... | python | chosen |
[
{
"from": "human",
"value": "Add quick script to get history of wc.\n"
},
{
"from": "gpt",
"value": "import subprocess\n\n# Get history of linecount by date.\n\nrepo_dir = '/Users/visualstudio/dev/bf-count-lines'\n\ndef get_num_lines():\n # find_cmd = 'find inc src test tools -name \"*.cpp\" ... | python | chosen |
[
{
"from": "human",
"value": "Add tiny experimental color library.\n\nRe #101.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFunctions for wrapping strings in ANSI color codes.\n\"\"\"\n\ndef _wrap_with(code):\n def inner(s, bold=False):\n c = code\n if bold:\n c = \"1;%s\"... | python | chosen |
[
{
"from": "human",
"value": "Add notifications for all existing objects\n\nWe assume that the past notifications have not been sent, so we need to\nadd notifications for all future cycle starts and task due dates.\n"
},
{
"from": "gpt",
"value": "\n\"\"\"add notification entries for existng work... | python | chosen |
[
{
"from": "human",
"value": "Add an integration test for the vim machine.\n"
},
{
"from": "gpt",
"value": "import subprocess\n\nfrom vim_turing_machine.machines.merge_overlapping_intervals.decode_intervals import decode_intervals\nfrom vim_turing_machine.machines.merge_overlapping_intervals.enco... | python | chosen |
[
{
"from": "system",
"value": "Disable failing testSmoke on cros.\n\nBUG=386416\nTEST=bots\n\nReview URL: https://codereview.chromium.org/336953004\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@280661 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "human",
"value": "# Copyright 20... | python | chosen |
[
{
"from": "human",
"value": "Add a11y test for lms student dashboard\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAccessibility tests for LMS dashboard page.\n\nRun just this test with:\nSELENIUM_BROWSER=phantomjs paver test_bokchoy -d accessibility -t test_lms_dashboard_axs.py\n\"\"\"\nfrom ..tests... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.