conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add start of processed package\n"
},
{
"from": "gpt",
"value": "from ..errors import InconsistentFields, NonUnique\n\n\ndef greedy_set_cover(data, exclude=None):\n \"\"\"Find unique set of attributes that uniquely identifies each element in ``data``.\n\n Featur... | python | chosen |
[
{
"from": "human",
"value": "Add script to self generate docs for recurring data types\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n#\n# This script is to be used to automagically generate the recurring data types\n# documentation based on the API specification.\n#\n# to run it ju... | python | chosen |
[
{
"from": "human",
"value": "Add tests for converter.Line and converter.Generator.\n\nSigned-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polytechnique.org>\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n# Copyright (c) 2010-2012 Raphaël Barrois\n\nimport unittest\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add hbase consistency check throw hbase hbck command, easily can be added some checks like backups servers or region servers\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# vim: ts=4:sw=4:et:sts=4:ai:tw=80\nfrom utils import krb_wrapper,StringContext\nimpor... | python | chosen |
[
{
"from": "human",
"value": "Create solution to swap odd even characters\n"
},
{
"from": "gpt",
"value": "#Python3\nword = list(input().strip())\n\nfor i in range(0,len(word),2):\n\tif(i+1>=len(word)):\n\t\tbreak\n\tword[i],word[i+1] = word[i+1],word[i]\n\nprint(''.join(word))"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add stupid CSV export example\n\nFixes #53\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport os\nimport csv\n\nimport sys\nsys.path.append('../pynipap')\nimport pynipap\n\nclass Export:\n\tdef __init__(self, xmlrpc_uri):\n\t\tself.xmlrpc_uri = xmlrpc_uri\n... | python | chosen |
[
{
"from": "system",
"value": "Store registered refs as plugin metadata\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nfrom marshmallow.compat import iteritems\nfrom marshmallow import class_registry\n\nfrom smore import swagger\nfrom smore.a... | python | chosen |
[
{
"from": "human",
"value": "Add a script to convert from rst style files to markdown\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport os\nimport re\nimport shutil\nfrom optparse import OptionParser\n\ndef main():\n parser = OptionParser(usage=\"usage: %prog [options]\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add data for integration testing of basic csv and crosstab formats\n"
},
{
"from": "gpt",
"value": "\"\"\"Integrations tests for EcoData Retriever\"\"\"\n\nimport os\nimport shutil\nfrom retriever import HOME_DIR\n\nsimple_csv = {'name': 'simple_csv',\n ... | python | chosen |
[
{
"from": "human",
"value": "[XLA:Python] Make JAX CompiledFunction objects pickle-able.\n\nPiperOrigin-RevId: 388814246\n"
},
{
"from": "gpt",
"value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in com... | python | chosen |
[
{
"from": "human",
"value": "Create new monthly violence polls\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand\nimport traceback\n\nfrom poll.models import Poll\nfrom unregister.models import Blacklist\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "Add evaluation using random forest"
},
{
"from": "gpt",
"value": "import numpy as np\n# import pandas as pd\n# import sys\nfrom scipy.special import expit\nfrom sklearn import ensemble\n\ndef get_activations(exp_data, w, b):\n exp_data = np.transpose(exp_data)\n ... | python | chosen |
[
{
"from": "human",
"value": "Convert blogger to simple xml\n"
},
{
"from": "gpt",
"value": "from bs4 import BeautifulSoup\nimport io\nimport markdown2\nimport time\nimport codecs\n\nfile = io.open(\"Import/blog-03-03-2013.xml\")\nfile_contents = file.read(-1)\n\n#lxml xpath doesn't seem to under... | python | chosen |
[
{
"from": "human",
"value": "Codewars: Delete occurrences of an element if it occurs more than n times\n"
},
{
"from": "gpt",
"value": "# implemented with list comprehension with side-effects and a global variable\n# there's a simpler way to do it with list appends that's probably no less effici... | python | chosen |
[
{
"from": "human",
"value": "Add test on update document title\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Integration tests for Document\"\"\"\n\nfrom ggrc.models import all_models\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add initialization functions for database connection\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\nfrom contextlib import contextmanager\n\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm.session import sess... | python | chosen |
[
{
"from": "human",
"value": "Add live test for session\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport unittest\nimport getpass\nfrom logger import TestLogger\n\nsys.path.insert(0, '.')\nsys.path.insert(0, '../')\nsys.path.insert(0, '../../')\n\nfrom LendingClub impo... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the version string parsing code"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for turning simple version strings into twisted.python.versions.Version\nobjects.\n\n\"\"\"\nfrom epsilon import asTwistedVersion\nfrom twisted.trial.unittest import Synchrono... | python | chosen |
[
{
"from": "human",
"value": "Add cost tracking file to openstack\n\n - saas-951\n"
},
{
"from": "gpt",
"value": "from . import models\nfrom nodeconductor.cost_tracking import CostTrackingBackend\n\n\nclass OpenStackCostTrackingBackend(CostTrackingBackend):\n\n @classmethod\n def get_monthl... | python | chosen |
[
{
"from": "human",
"value": "Add tests of table and column pickling\n"
},
{
"from": "gpt",
"value": "import cPickle as pickle\n\nimport numpy as np\nimport pytest\n\nfrom ...table import Table, Column, MaskedColumn\n\n\n@pytest.fixture(params=[0, 1, -1])\ndef protocol(request):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Load the simul module and run a simulation\n"
},
{
"from": "gpt",
"value": "from simul import *\n\nif __name__ == '__main__':\n # create a new simulation\n s = Simulation(Re=5)\n\n # initial conditions psi(0) = 0, Omega(0) = 0\n s.psi.initial(\"null\")\n ... | python | chosen |
[
{
"from": "human",
"value": "Add index to cover testgroup_details (previous runs)\n"
},
{
"from": "gpt",
"value": "\"\"\"Index Job(project_id, status, date_created) where patch_id IS NULL\n\nRevision ID: 3042d0ca43bf\nRevises: 3a3366fb7822\nCreate Date: 2014-01-03 15:24:39.947813\n\n\"\"\"\n\n# ... | python | chosen |
[
{
"from": "system",
"value": "Add Config.get() to skip KeyErrors\n\nAdds common `dict.get()` pattern to our own Config class, to enable\nuse of fallbacks or `None`, as appropriate."
},
{
"from": "human",
"value": "#! /usr/bin/env python\n\nimport os\nimport warnings\nimport yaml\n\n\nclass Confi... | python | chosen |
[
{
"from": "human",
"value": "Add python class for writing out xyz files of trajectory coordinates\n\n\nFormer-commit-id: cecdece306ef516acf87bde03bbd04cb7f0c761b"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport numpy\n\nclass TrajWriter(object):\n '''\n A class for writing out ... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for the logger\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logbook\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add example for cluster centroids method\n"
},
{
"from": "gpt",
"value": "\"\"\"\n=================\nCluster centroids\n=================\n\nAn illustration of the cluster centroids method.\n\n\"\"\"\n\nprint(__doc__)\n\nimport matplotlib.pyplot as plt\nimport seabor... | python | chosen |
[
{
"from": "human",
"value": "Add functions to paint game of life to screen\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom curses import wrapper\nfrom time import sleep\n\ndef enumerate_lines(matrix):\n on = '*'\n off = ' '\n for i, row in enumerate(matrix):\n yield ... | python | chosen |
[
{
"from": "human",
"value": "Add a script that scrapes the Socrata catalog, just in case we need that in another format\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n\"\"\"\nThis is a basic script that downloads the catalog data from the smcgov.org\nwebsite and pulls out information abo... | python | chosen |
[
{
"from": "human",
"value": "Add new command to notify New Relic of deployment\n"
},
{
"from": "gpt",
"value": "\"\"\"\nManagement command to enable New Relic notification of deployments\n\n.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>\n\n\"\"\"\n\nimport pwd\ni... | python | chosen |
[
{
"from": "human",
"value": "Test case for wordaxe bug\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom reportlab.platypus import SimpleDocTemplate\nfrom reportlab.platypus.paragraph import Paragraph\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom report... | python | chosen |
[
{
"from": "human",
"value": "Add decoder ida fields name\n"
},
{
"from": "gpt",
"value": "def decode_name_fields(ida_fields):\n i = -1\n stop = len(ida_fields)\n while True:\n i += 1\n if i == stop:\n break\n\n count = ord(ida_fields[i]) - 1\n if c... | python | chosen |
[
{
"from": "human",
"value": "Add trivial test for ECO fetching\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in ... | python | chosen |
[
{
"from": "human",
"value": "Add a wrapper for ChromeOS to call into telemetry.\n\nR=dtu@chromium.org, achuith@chromium.org\nBUG=402172, 388256\n\nReview URL: https://codereview.chromium.org/682953002\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#301557}\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Set default branding for all organisations\n\nCurrently when someone creates a service we match them to an\norganisation. Then if the organisation has a default branding set, their\nservice gets that branding.\n\nHowever none of the organisations yet have a default branding set ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for plagiarism filter command\n"
},
{
"from": "gpt",
"value": "import csv\n\nfrom io import StringIO\nfrom unittest.mock import call, MagicMock, patch\n\nfrom django.test import TestCase\n\nfrom ....views.plagiarism import PlagiarismFeedbackView\nfrom ....m... | python | chosen |
[
{
"from": "human",
"value": "Add missing file from last commit\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nfrom .serialize import loads_msgpack, loads_pyarrow, dumps_msgpack, dumps_pyarrow\n\n\"\"\"\nSerialization that has compatibility guarantee (therefore is safe to st... | python | chosen |
[
{
"from": "human",
"value": "Add minimal pygstc example to play a video\n"
},
{
"from": "gpt",
"value": "import time\nimport sys\nfrom pygstc.gstc import *\nfrom pygstc.logger import *\n\n#Create a custom logger with loglevel=DEBUG\ngstd_logger = CustomLogger('simple_pipeline', loglevel='DEBUG')... | python | chosen |
[
{
"from": "human",
"value": "Add utility for sent mail\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n###############################################################################\n#\n# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).\n#\n# This program is fr... | python | chosen |
[
{
"from": "human",
"value": "Add base test for admin endpoints [WAL-883]\n"
},
{
"from": "gpt",
"value": "from django.contrib import admin\nfrom django.contrib.auth import get_user_model\nfrom django.test import TestCase\nfrom django.urls import reverse\n\n\nUser = get_user_model()\n\n\nclass Te... | python | chosen |
[
{
"from": "human",
"value": "Include self contained method for output to a view\n\nThis uses an enhanced version of the code that is currently in the\noverride_audit command file, making it more general purpose.\n\nThe new method can send output to a view, either reusing the one with\nthe same title as is b... | python | chosen |
[
{
"from": "human",
"value": "Create SQLite database and table and insert data from CSV file\n"
},
{
"from": "gpt",
"value": "# Create a database\n\nimport sqlite3\nimport csv\nfrom datetime import datetime\nimport sys \nreload(sys) \nsys.setdefaultencoding('utf8')\n\nclass createDB():\n\n d... | python | chosen |
[
{
"from": "human",
"value": "Build and revision number script\n"
},
{
"from": "gpt",
"value": "import sys\nfrom time import gmtime\nyear, mon, mday, hour, min, sec, wday, yday, isdst = gmtime()\nbld = ((year - 2000) * 12 + mon - 1) * 100 + mday\nrev = hour * 100 + min\nprint 'Your build and revi... | python | chosen |
[
{
"from": "system",
"value": "Test sending headers with end stream.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\ntest_basic_logic\n~~~~~~~~~~~~~~~~\n\nTest the basic logic of the h2 state machines.\n\"\"\"\nimport h2.connection\n\nfrom hyperframe import frame\n\n\nclass Te... | python | chosen |
[
{
"from": "human",
"value": "Add sanity linter to catch future use\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2018 gRPC authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\... | python | chosen |
[
{
"from": "human",
"value": "Add GLib mainllop transport for xmlrpcserver\n"
},
{
"from": "gpt",
"value": "import gobject\n\nimport xmlrpclib\n\nclass XMLRPCDeferred (gobject.GObject):\n \"\"\"Object representing the delayed result of an XML-RPC\n request.\n\n .is_ready: bool\n Tru... | python | chosen |
[
{
"from": "human",
"value": "wsgi: Add nginx+uWSGI for 10% perf improvement over gunicorn\n\nnginx+uWSGI can be a killer performance combination as described here:\n\nhttp://lists.unbit.it/pipermail/uwsgi/2013-September/006431.html\n"
},
{
"from": "gpt",
"value": "import subprocess\nimport multi... | python | chosen |
[
{
"from": "system",
"value": "Fix another broken sc2reader.plugins reference.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, print_function, unicode_literals, division\n\nimport sc2reader\nfrom sc2reader.plugins.replay i... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for `%tensorflow_version`\n\nIn preparation for changes to this file that will additionally configure\nthe `PATH` and `PYTHONPATH` environment variables, which is required for\nproper TensorBoard support.\n\nPiperOrigin-RevId: 259611678\n"
},
{
"from": "gp... | python | chosen |
[
{
"from": "human",
"value": "[tests] Add unit tests for disk module\n"
},
{
"from": "gpt",
"value": "# pylint: disable=C0103,C0111\n\nimport mock\nimport unittest\n\nimport tests.mocks as mocks\n\nfrom bumblebee.input import LEFT_MOUSE\nfrom bumblebee.modules.disk import Module\n\nclass MockVFS(... | python | chosen |
[
{
"from": "human",
"value": "Add test for dotted circles in sample text\n"
},
{
"from": "gpt",
"value": "import uharfbuzz as hb\nimport gflanguages\nimport pytest\n\nlangs = gflanguages.LoadLanguages()\n\n\n@pytest.fixture\ndef hb_font():\n # Persuade Harfbuzz we have a font that supports\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests to product tags\n"
},
{
"from": "gpt",
"value": "from mock import Mock\nfrom saleor.product.templatetags.product_images import get_thumbnail, product_first_image\n\n\ndef test_get_thumbnail():\n instance = Mock()\n cropped_value = Mock(url='crop.jpg')... | python | chosen |
[
{
"from": "human",
"value": "Add a script to check that __all__ in __init__.py is correct"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\nimport re\nimport glob\n\nimport phonenumbers\n\nINTERNAL_FILES = ['phonenumbers/util.py',\n 'phonenumbers/re_util.py',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a data migration tool\n"
},
{
"from": "gpt",
"value": "import argparse, shelve\n\ndef renameDictKeys(storageDict):\n for key in storageDict.iterkeys():\n if isinstance(storageDict[key], dict):\n renameDictKeys(storageDict[key])\n if ke... | python | chosen |
[
{
"from": "human",
"value": "Add the quantity-safe allclose from spectral-cube\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, absolute_import, division\n\nfrom astropy import units as u\n\nfrom numpy.testing import assert_allclose as assert_allclose_numpy, assert_array_e... | python | chosen |
[
{
"from": "human",
"value": "Add initial unit tests for parameter.py (List)\n"
},
{
"from": "gpt",
"value": "import unittest\ntry:\n import spotpy\nexcept ImportError:\n import sys\n sys.path.append(\".\")\n import spotpy\nfrom spotpy import parameter\nimport numpy as np\n\n#https://... | python | chosen |
[
{
"from": "system",
"value": "Add ban for pgp/gpg private key blocks\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nimport argparse\nimport sys\n\nBLACKLIST = [\n b'BEGIN RSA PRIVATE KEY',\n b'BEGIN DSA PRIVATE KEY',\n b'BEGIN EC PRIVATE KEY',\n b'BEGIN O... | python | chosen |
[
{
"from": "human",
"value": "Add retriever object for player draft information\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport re\n\nimport requests\nfrom lxml import html\n\nfrom db.team import Team\nfrom db.player_draft import PlayerDraft\n\nclass Play... | python | chosen |
[
{
"from": "human",
"value": "Add example that mirrors defconfig and oldconfig.\n\nFrom https://github.com/ulfalizer/Kconfiglib/issues/15. Getting the\noutput to match up exactly requires emulating each step, due to Kconfig\nsubtleties related to which symbols have been assigned values by the\nuser. The outp... | python | chosen |
[
{
"from": "human",
"value": "Add female Public Health College and Club\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\ndef add_college(apps, schema_editor):\n Club = apps.get_model('clubs', 'Club'... | python | chosen |
[
{
"from": "human",
"value": "Add an oauth example script.\n"
},
{
"from": "gpt",
"value": "import webbrowser\n\nimport tweepy\n\n\"\"\"\n Query the user for their consumer key/secret\n then attempt to fetch a valid access token.\n\"\"\"\n\nif __name__ == \"__main__\":\n\n consumer_key =... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove broken images.\n"
},
{
"from": "gpt",
"value": "from pathlib import Path\nfrom PIL import Image\nfrom concurrent.futures import ProcessPoolExecutor\nimport os\nimport sys\n\ndef verify_or_delete(filename):\n try:\n Image.open(filename).... | python | chosen |
[
{
"from": "human",
"value": "Add a gmm, currently wrapping sklearn\n"
},
{
"from": "gpt",
"value": "import numpy\n# FIXME: copy the functions here\n\nfrom sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp\n\nclass GMM(object):\n def __init__(self, weights, means, covs):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add default message for list pages\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-02-02 19:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration step dua changes in model\n\nThis should fix #5.\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 dep... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Permission class.\n\nSigned-off-by: Tyler O'Meara <c794bd35db97c1cf0b8edc21ac218cd202f68ca7@TylerOMeara.com>\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom permission import Permission, PERMISSION_DELIMITER\n\n\nclass BasicPermissionTests(unitte... | python | chosen |
[
{
"from": "human",
"value": "Add in script to count duplicates.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rethinkdb as r\n\nconn = r.connect('localhost', 30815, db='materialscommons')\nrql = r.table('datafiles').filter(r.row['usesid'].match(\"^[0-9a-f]\")).pluck('size')\nt... | python | chosen |
[
{
"from": "human",
"value": "Add tool for submitting jobs to AreWeCompressedYet\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport requests\nimport argparse\nimport os\nimport subprocess\nimport sys\n\nif 'DAALA_ROOT' not in os.environ:\n ... | python | chosen |
[
{
"from": "human",
"value": "[manual] Add a manage.py command to import realm filters\n\nThis must be run manually on staging after deployment. Once it has been run,\nit can be deleted. It only needs to be run on staging, not prod.\n\n(imported from commit 79252c23ba8cda93500a18aa7b02575f406dd379)\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Add a parser for plain text\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom io import TextIOWrapper\n\nfrom rest_framework.parser... | python | chosen |
[
{
"from": "human",
"value": "Implement basic active monitoring algorithm\n"
},
{
"from": "gpt",
"value": "import sys\nfrom functools import reduce\n\ntempVmId = -1\n\ndef enhancedActiveVMLoadBalancer(vmStateList, currentAllocationCounts):\n '''\n vmStateList: Dict<vmId, ... | python | chosen |
[
{
"from": "human",
"value": "Add function to solve two pair sum\n"
},
{
"from": "gpt",
"value": "'''\nGiven an integer array, output all pairs that sum up to a specific value k\n\n'''\n\nfrom binary_search import binary_search_iterative\n\ndef pair_sum_sorting(arr, k):\n\t'''\n\tUsing sorting - ... | python | chosen |
[
{
"from": "human",
"value": "Add new script to create a list of words from frequencies\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Spell corrector - http://www.chiodini.org/\n# Copyright © 2015 Luca Chiodini <luca@chiodini.org>\n#\n# This program is free... | python | chosen |
[
{
"from": "human",
"value": "Put the test into the correct directory.\n\n--HG--\nrename : test/xslt/test_inputsource.py => test/lib/test_inputsource.py\n"
},
{
"from": "gpt",
"value": "########################################################################\n# test/xslt/test_inputsource.py\n\nim... | python | chosen |
[
{
"from": "human",
"value": "Add a command for deactivating a generation\n"
},
{
"from": "gpt",
"value": "# This script deactivates a particular generation\n\nfrom optparse import make_option\nfrom django.core.management.base import BaseCommand\nfrom mapit.models import Generation\n\nclass Comma... | python | chosen |
[
{
"from": "human",
"value": "Add test for vendor object creation\n"
},
{
"from": "gpt",
"value": "from django.test import Client, TestCase\n\nfrom .utils import obtain_api_key, create_admin_account\n\n\nclass VendorApiTest(TestCase):\n \"\"\"Test for Vendor API.\"\"\"\n\n def setUp(self):\... | python | chosen |
[
{
"from": "human",
"value": "Add a Laplace equation solving benchmark (from Numpy)\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBenchmark Laplace equation solving.\n\nFrom the Numpy benchmark suite, original code at\nhttps://github.com/yarikoptic/numpy-vbench/commit/a192bfd43043d413cc5d27526a9b28ad3... | python | chosen |
[
{
"from": "human",
"value": "Add test for pandas dataframe loading\n"
},
{
"from": "gpt",
"value": "def test_odtreader_dynamics_example():\n from joommf.sim import Sim\n from joommf.mesh import Mesh\n from joommf.energies.exchange import Exchange\n from joommf.energies.demag import D... | python | chosen |
[
{
"from": "human",
"value": "Implement abstract class for csc and csr matrix\n"
},
{
"from": "gpt",
"value": "from cupy import cusparse\nfrom cupy.sparse import base\nfrom cupy.sparse import data as sparse_data\n\n\nclass _compressed_sparse_matrix(sparse_data._data_matrix):\n\n def __init__(s... | python | chosen |
[
{
"from": "human",
"value": "[modules] Add module for displaying RAM usage\n\nShows free RAM, total RAM, free RAM percentage\n"
},
{
"from": "gpt",
"value": "import bumblebee.module\nimport psutil\n\ndef fmt(num, suffix='B'):\n for unit in [ \"\", \"Ki\", \"Mi\", \"Gi\" ]:\n if num < 1... | python | chosen |
[
{
"from": "human",
"value": "Add command for full daily build process\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUpdate to the latest available CAL-ACCESS snapshot and publish the files to the\nwebsite.\n\"\"\"\nimport logging\nfrom django.core.manag... | python | chosen |
[
{
"from": "human",
"value": "Add closure type inference test\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom numba import *\nfrom numba.tests.test_support import *\n\n@autojit\ndef test_cellvar_promotion(a):\n \"\"\"\n >>> inner = test_cellvar_promotion(10)\n 200.0\n >>> ... | python | chosen |
[
{
"from": "human",
"value": "Add sample playlists for testing features.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\nfrom datetime import datetime\nfrom datetime import timedelta\nimport random\nfrom wuvt.trackman.lib import perdelta\nfrom wuvt import db\nfrom wuvt.trackman.models im... | python | chosen |
[
{
"from": "human",
"value": "Add missing tests file from previous commit.\n"
},
{
"from": "gpt",
"value": "'''Test case for monads and monoidic functions\n'''\nimport unittest\n\nfrom lighty import monads\n\n\nclass MonadTestCase(unittest.TestCase):\n '''Test case for partial template executi... | python | chosen |
[
{
"from": "human",
"value": "Add script to submite jobs again\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport subprocess\n\nright_inputs = False\nif len(sys.argv) > 2 :\n tp = sys.argv[1]\n rms = [int(x) for x in sys.argv[2:]]\n if tp in ['ma', '... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 436. Find Right Interval\n\n436. Find Right Interval: https://leetcode.com/problems/find-right-interval/\n"
},
{
"from": "gpt",
"value": "from operator import itemgetter\n# Definition for an interval.\n# class Interval(object):\n# def __init__... | python | chosen |
[
{
"from": "human",
"value": "Add functional test for version negotiation\n\nthe test attempts to make an unauthenticated request to the Heat API\nroot.\n\nChange-Id: Ib14628927efe561744cda683ca4dcf27b0524e20\nStory: 2002531\nTask: 22077\n"
},
{
"from": "gpt",
"value": "# Licensed under the Ap... | python | chosen |
[
{
"from": "human",
"value": "Add test to execute notebooks\n"
},
{
"from": "gpt",
"value": "import os\nimport glob\nimport contextlib\nimport subprocess\n\nimport pytest\n\nnotebooks = list(glob.glob(\"*.ipynb\", recursive=True))\n\n@contextlib.contextmanager\ndef cleanup(notebook):\n name, _... | python | chosen |
[
{
"from": "human",
"value": "Implement tests for temperature endpoint\n"
},
{
"from": "gpt",
"value": "import json\nfrom rest_framework import status\nfrom django.test import TestCase, Client\nfrom django.urls import reverse\nfrom ..models import Temperature\nfrom ..serializers import Temperatur... | python | chosen |
[
{
"from": "human",
"value": "Add new module for plugin loading\n"
},
{
"from": "gpt",
"value": "from maya import cmds\n\n\nclass Commands(object):\n \"\"\" class name must be 'Commands' \"\"\"\n\n commandDict = {}\n\n def _loadObjPlugin(self):\n if not cmds.pluginInfo(\"objExport... | python | chosen |
[
{
"from": "human",
"value": "test: Add a test case to validate `get_unseen_notes`\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport frappe\nfrom frappe.boot import get_unseen_notes\nfrom frappe.desk.doctype.note.note import mark_as_seen\n\n\nclass TestBootData(unittest.TestCase):\n\tdef... | python | chosen |
[
{
"from": "human",
"value": "Use this enough, might as well add it.\n"
},
{
"from": "gpt",
"value": "# This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow\n# Useful for debugging the scenario independent of the server.\n\nfrom PIL import Image\nfrom PIL.ImageFile import ... | python | chosen |
[
{
"from": "human",
"value": "Add test migration removing ref to old company image\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example using new pytorch backend\n\nSigned-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport numpy.random as rnd\nimport numpy.linalg as la\nimport torch\n\nfrom pymanopt import P... | python | chosen |
[
{
"from": "human",
"value": "Add test to help module\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nimport builtins\nimport types as pytypes\n\nimport numpy as np\n\nfrom numba import types\nfrom .support import TestCase\nfrom numba.help.inspector import inspect_functi... | python | chosen |
[
{
"from": "human",
"value": "Add migration for changing CONTACTED_CHOICES\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 ('a... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for config usb\n"
},
{
"from": "gpt",
"value": "from .util import (DestructiveYubikeyTestCase, ykman_cli)\n\n\nclass TestConfigUSB(DestructiveYubikeyTestCase):\n\n def setUp(self):\n ykman_cli('config', 'usb', '--enable-all', '-f')\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add helper script to generate API keys.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport os\nimport sqlite3\nimport sys\nimport time\n\nif len(sys.argv) < 3:\n raise ValueError('Usage: %s \"Firstnam Lastname\" email@example.com' % sys.argv[0])\n\ndb = ... | python | chosen |
[
{
"from": "human",
"value": "Add a Wordpress+MySQL composed instance functional test case\n\nChange-Id: I6a905b186be59c929e530519414e46d222b4ea08\nSigned-off-by: Steven Dake <8638f3fce5db0278cfbc239bd581dfc00c29ec9d@redhat.com>\n"
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softt... | python | chosen |
[
{
"from": "human",
"value": "Migrate all project contents blocks to activity contents blocks\n\nBB-15606 #resolve\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-11-06 09:41\nfrom __future__ import unicode_literals\n\nfrom django.db import migratio... | python | chosen |
[
{
"from": "human",
"value": "Add example: filtered ensemble average.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport atomic\n\nfrom ensemble_average import time_dependent_power\n\n\nif __name__ == '__main__':\n times = np.logspace(-7, 0, 50)\n t... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.