conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "[Code] Add code to dump features into libsvm file format\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom datetime import datetime\nfrom sklearn.datasets import dump_svmlight_file\nimport os.path as path\n\ndef main():\n cache_path = 'largecache/'\n fe... | python | chosen |
[
{
"from": "human",
"value": "swig: Add a Python Tkinter example showing how to map a scale widget.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport Tkinter\nimport sys\nimport mapper\n\ndef on_gui_change(x):\n# print 'on_gui_change',x,x.__class__\n sig_out.update_scalar(int... | python | chosen |
[
{
"from": "human",
"value": "Add missing noop-migrations for PositiveIntegerField\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2018-03-22 19:56\nfrom __future__ import unicode_literals\n\nimport django.core.validators\nfrom django.db import migrations... | python | chosen |
[
{
"from": "human",
"value": "Implement management command for creating demo records of balance history (NC-842)\n"
},
{
"from": "gpt",
"value": "from datetime import timedelta\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils import timezone\n\nfrom nodeconductor.structur... | python | chosen |
[
{
"from": "human",
"value": "Add External Temperature Probe from OpenWeather\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Get External Temperature from OpenWeatherMap\n# External informations are :\n# - temperature\n# - humidity\n# - pressure\n# - precipitation volume (each 3h)\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Add a simple benchmark script\n"
},
{
"from": "gpt",
"value": "import timeit\n\nnormal_py_sec = timeit.timeit('sum (x*x for x in xrange(1000))',number = 10000)\nnaive_np_sec = timeit.timeit('sum(na*na)',setup='import numpy as np; na=np.arange(1000)', number = 10000)\... | python | chosen |
[
{
"from": "human",
"value": "pandoc-include-clone.py: Add clone of Haskell version\n\nThis at least doesn't require linking against anything, waiting for a\nlong compilation and installation with `cabal`, complaining about the\nPandoc API version in the latest GitHub release as of this writing, or\nusing up... | python | chosen |
[
{
"from": "human",
"value": "Add file to create all files to school census.\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_down... | python | chosen |
[
{
"from": "human",
"value": "Add minimal REST API script based on flask\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom tempfile import NamedTemporaryFile\nimport json\nfrom threading import Lock\n\nimport numpy as np\nfrom flask import Flask, request\nfrom scipy.misc import imre... | python | chosen |
[
{
"from": "human",
"value": "Create pldm related specific constants file.\n\nChange-Id: I3eda08d7ec1c0113931511f2d3539f2c658f7ad0\nSigned-off-by: Sridevi Ramesh <cb5e1f81dd390dfc3a9afc08ab7298b7ab4296f5@in.ibm.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nr\"\"\"\nContains PLDM-rela... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove unpaired fasta entries.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nRemove unpaired reads from a fasta file.\n\nThis script can be used for the case that unpaired reads (e.g. as\nreads were removed during quality trimming) i... | python | chosen |
[
{
"from": "human",
"value": "Set up frontend for longpolling\n"
},
{
"from": "gpt",
"value": "from gevent.event import AsyncResult\n\n_event = AsyncResult()\n\ndef wait():\n \"\"\"\n Gets the New Block work unit to send to clients\n \"\"\"\n return _event.get()\n\ndef trigger(work):\... | python | chosen |
[
{
"from": "human",
"value": "Add modified chart with better values\n"
},
{
"from": "gpt",
"value": "\nfrom brew.utilities import sg_from_dry_basis\n\n\n\"\"\"\nRay Daniels\nDesigning Great Beers\n\nAppendix 2: Course Grind Potential Extract (modified)\n\nNotes:\n The chart appears to have bee... | python | chosen |
[
{
"from": "human",
"value": "Add a check for keystone expired tokens buildup.\n\nMore than 1K is too many when cleaning every 5 minutes, so warn about\nit. The admin may have to go in and more aggressively clean or figure\nout why the cleaning isn't completing as expected.\n\nThis uses a lot of keystone-man... | python | chosen |
[
{
"from": "human",
"value": "Add test for input setup workflow\n"
},
{
"from": "gpt",
"value": "import os\nimport unittest\n\nimport cea.config\nfrom cea.utilities import create_polygon\nfrom cea.datamanagement import zone_helper, surroundings_helper, terrain_helper, streets_helper, data_initial... | python | chosen |
[
{
"from": "human",
"value": "Add datetime to fast cache\n"
},
{
"from": "gpt",
"value": "\"\"\"Add datetime to fastcache\n\nRevision ID: 20860ffde766\nRevises: 471e6f7722a7\nCreate Date: 2015-04-14 07:44:36.507406\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '20860ffde766'\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to count emotional sentences according to LIWC\n\nAdded a script that counts the number of emotional sentences in titles\nin the corpus. A sentence is considered emotional if it contains at\nleast one Posemo or Negemo term. The statistical results are written to\nstan... | python | chosen |
[
{
"from": "human",
"value": "Add basic functionality and regression tests for ACA dark cal module\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBasic functionality and regression tests for ACA dark cal module.\n\"\"\"\n\nimport numpy as np\n\nfrom ..aca_dark import dark_cal\n\n\ndef test_date_to_dark... | python | chosen |
[
{
"from": "human",
"value": "Include OpenCV based Python CLAHE script\n"
},
{
"from": "gpt",
"value": "from PIL import Image\nimport numpy as np\nimport h5py\nimport os\nimport sys\nimport cv2\n\n# Maybe consider implemeting more involved auto-balancing\n# http://wiki.cmci.info/documents/120206p... | python | chosen |
[
{
"from": "human",
"value": "Add generic asynchronous/synchronous run command\n\nSigned-off-by: Adam Stokes <0a364f4bf549cc82d725fa7fd7ed34404be64079@ubuntu.com>\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Canonical, Ltd.\n#\n# This program is free software: you can redistribute it and/or ... | python | chosen |
[
{
"from": "human",
"value": "Add crawler for 'Hark, A Vagrant'\n"
},
{
"from": "gpt",
"value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Hark, A Vagrant!'\n language = 'en'\n url = 'http:... | python | chosen |
[
{
"from": "human",
"value": "tests: Test for explicit start/end args to str methods for unicode.\n"
},
{
"from": "gpt",
"value": "# str methods with explicit start/end pos\nprint(\"Привет\".startswith(\"П\"))\nprint(\"Привет\".startswith(\"р\", 1))\nprint(\"абвба\".find(\"а\", 1))\nprint(\"абвба... | python | chosen |
[
{
"from": "human",
"value": "Add script for updating favicon from gh avatar\n"
},
{
"from": "gpt",
"value": "from PIL import Image\nimport requests\nfrom io import BytesIO\n\n# This whole script was done using Google and StackOverflow\n# How to generate ico files\n# https://stackoverflow.com/a/3... | python | chosen |
[
{
"from": "human",
"value": "Add blocking migration for new domain db\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom corehq.doctypemigrations.djangomigrations import assert_initial_complete\nfrom corehq.... | python | chosen |
[
{
"from": "human",
"value": "Add an example for the RedisLock\n"
},
{
"from": "gpt",
"value": "import random\n\nfrom diesel import fork, quickstop, quickstart, sleep\nfrom diesel.protocols.redis import RedisClient, RedisTransactionError, RedisLock, LockNotAcquired\n\n\n\"\"\"Implement the Redis ... | python | chosen |
[
{
"from": "human",
"value": "Add script to fix all notions\n"
},
{
"from": "gpt",
"value": "from alignements_backend.db import DB\nfrom alignements_backend.notion import Notion\n\nfor notion in DB.scan_iter(match='notion:*'):\n n = Notion(list(DB.sscan_iter(notion)))\n\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add command to test managers emails\n"
},
{
"from": "gpt",
"value": "from django.core.mail import mail_managers\nfrom django.core.management.base import BaseCommand\n\n\nclass Command(BaseCommand):\n help = \"Test if email settings are OK by sending mail to site m... | python | chosen |
[
{
"from": "human",
"value": "Customize behave formatter to output json\n"
},
{
"from": "gpt",
"value": "from behave.formatter.json import PrettyJSONFormatter\nfrom pprint import pprint\n\nclass RecordFormatter(PrettyJSONFormatter):\n name = \"super\"\n description = \"Formatter for adding ... | python | chosen |
[
{
"from": "human",
"value": "Add test case for user creation form\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom users.forms import ZionsUserCreationForm\nfrom users.models import User\n\n\nclass {{cookiecutter.project_camel_name}}UserCreationTestCase(TestCase):\n d... | python | chosen |
[
{
"from": "human",
"value": "Add test for decoder stack\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nfrom __future__ import division\n\nfrom timeside.decoder import FileDecoder\nfrom timeside.analyzer import AubioPitch\nfrom timeside.core import ProcessPipe\nimport numpy as np\nfro... | python | chosen |
[
{
"from": "human",
"value": "Improve code for creating temporary locustfiles that can be used in tests"
},
{
"from": "gpt",
"value": "import os\nimport random\nimport time\n\nfrom contextlib import contextmanager\n\n\nMOCK_LOUCSTFILE_CONTENT = '''\n\"\"\"This is a mock locust file for unit testi... | python | chosen |
[
{
"from": "human",
"value": "Add utility for walking etree and yielding nodes if options class type match.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSkCode utility for walking across a document tree.\n\"\"\"\n\n\ndef walk_tree_for_cls(tree_node, opts_cls):\n \"\"\"\n Walk the tree and yield... | python | chosen |
[
{
"from": "human",
"value": "Add super basic Hypothesis example\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Unit Tests\n\ndef test_add_zero():\n assert 0 + 1 == 1 + 0\n\ndef test_add_single_digits():\n assert 1 + 2 == 2 + 1\n\ndef test_add_double_di... | python | chosen |
[
{
"from": "human",
"value": "Add pseudo filter combining pypandoc and panflute\n\nThis is a prototype (filename is hardcoded) but should be easy to extend"
},
{
"from": "gpt",
"value": "import io\r\n\r\nimport pypandoc\r\nimport panflute\r\n\r\n\r\ndef prepare(doc):\r\n\tdoc.images = []\r\n\tdoc... | python | chosen |
[
{
"from": "human",
"value": "Add a modified version of simple bot\n"
},
{
"from": "gpt",
"value": "from tota.utils import closest, distance, sort_by_distance, possible_moves\nfrom tota import settings\n\n__author__ = \"angvp\"\n\n\ndef create():\n\n def lenovo_hero_logic(self, things, t):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for registry model hash\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom dockci.models.auth import AuthenticatedRegistry\n\n\nBASE_AUTHENTICATED_REGISTRY = dict(\n id=1,\n display_name='Display name',\n base_name='Base name',\n username='Us... | python | chosen |
[
{
"from": "human",
"value": "Add module for running the main simulation\n"
},
{
"from": "gpt",
"value": "import genetic\nimport sys\n\noutput = sys.stdout\n\ndef setOutput(out):\n output = out\n genetic.setOutput(output)\n\n# Test data for a XOR gate\ntestData = (\n (0.1, 0.1, 0.9),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add migration to update action implementation hashes.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport hashlib\nfrom base64 import b64encode, urlsafe_b64encode\n\nfrom django.db import migrations\n\n\ndef mak... | python | chosen |
[
{
"from": "human",
"value": "Add tests for inline list compilation\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START\nfrom thinglang.compiler.errors import NoMatchingOverload, InvalidReference\nfrom thinglang.c... | python | chosen |
[
{
"from": "human",
"value": "Add shared babel init code\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom flask import request\nfrom flask_babel import Babel\n\n__author__ = 'lundberg'\n\n\ndef init_babel(app):\n babel = Babel(app)\n app.babel = babel\n\n @babel.localesel... | python | chosen |
[
{
"from": "human",
"value": "tests/basics: Add test for logical constant folding.\n"
},
{
"from": "gpt",
"value": "# tests logical constant folding in parser\n\ndef f_true():\n print('f_true')\n return True\n\ndef f_false():\n print('f_false')\n return False\n\nprint(0 or False)\npri... | python | chosen |
[
{
"from": "human",
"value": "Write unit tests for _handle_long_response\n"
},
{
"from": "gpt",
"value": "import context\n\nclass TestHandleLongResponse(context.slouch.testing.CommandTestCase):\n bot_class = context.TimerBot\n config = {'start_fmt': '{:%Y}', 'stop_fmt': '{.days}'}\n norm... | python | chosen |
[
{
"from": "human",
"value": "Add a test for 'version.\n\n! needs updating with every nightly, currentl\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Test the version here.\n#\n\nimport pytest\nfrom pycket.test.testhelper import check_equal\n\nEXPECTED_VER... | python | chosen |
[
{
"from": "human",
"value": "Feat: Create Average Movies rating etl\n\nExtracts data from 2 tables in the database, transforms the data and writes the result into another table in the same database"
},
{
"from": "gpt",
"value": "import pyspark\n\nspark = (\n pyspark.sql.SparkSession.builder.a... | python | chosen |
[
{
"from": "human",
"value": "common/migrations: Remove duplicates in authorized origins table\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2019 The Software Heritage developers\n# See the AUTHORS file at the top-level directory of this distribution\n# License: GNU Affero General Public Lice... | python | chosen |
[
{
"from": "human",
"value": "Add a function to initialize the logging.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\nfrom __future__ import print_function, absolute_import, unicode_literals, division\nimport logging\n\n\ndef init_logging(logger=None, level=\"DEBUG\", log_file=\"\", file_co... | python | chosen |
[
{
"from": "human",
"value": "Add tests for file agent\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for a agent.\n\"\"\"\n\nimport io\nimport os\n\nimport pytest\n\nfrom onirim import action\nfrom onirim import agent\nfrom onirim import component\n\ndef file_agent(in_str):\n return agent.Fil... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for new statuses.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-04-04 17:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.manager\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract reads or alignments matching a barcode.\n"
},
{
"from": "gpt",
"value": "\"\"\"\ncode to extract a single cell from a set of alignments or reads marked via Valentine's umis \nrepository:\nhttps://github.com/vals/umis\n\"\"\"\nimport regex as re\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Part, Pin, Bus and Net iterators.\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom skidl import *\nfrom .setup_teardown import *\n\ndef test_iters_1():\n \"\"\"Test bus iterator.\"\"\"\n b_size = 4\n b = Bus('chplx', b_size)\n for hi in ... | python | chosen |
[
{
"from": "human",
"value": "[CHORE] Add whoami resource which decodes token and returns user info from token\n"
},
{
"from": "gpt",
"value": "from flask import make_response, jsonify\nfrom flask_restful import Resource, reqparse, marshal, fields\nfrom app.models import User\nfrom app.common.au... | python | chosen |
[
{
"from": "human",
"value": "Print The Message Happy New Year\n\n#Print The Message \"Happy new Year\" followed by the name of a person taken from a list for all people mentioned in the list.\n"
},
{
"from": "gpt",
"value": "# Print The Message \"Happy new Year\" followed by the name of a person... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract information for playbook files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nimport os\nimport argparse\nimport re\nimport yaml\n\ndef get_revision_number(yaml_content, tool_name):\n for tool i... | python | chosen |
[
{
"from": "human",
"value": "Insert a note at a specific position in a linked list\n"
},
{
"from": "gpt",
"value": "# https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list\n# Python 2\n\n\"\"\"\n Insert Node at a specific position in a linked list\n head inp... | python | chosen |
[
{
"from": "human",
"value": "Add apigateway integration test for PutIntegration\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except i... | python | chosen |
[
{
"from": "human",
"value": "Add module for utilities related to xgboost\n"
},
{
"from": "gpt",
"value": "\nxgb_to_sklearn = {\n 'eta': 'learning_rate',\n 'num_boost_round': 'n_estimators',\n 'alpha': 'reg_alpha',\n 'lambda': 'reg_lambda',\n 'seed': 'random_state',\n}\n\ndef to_sk... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add strip_html sql function\n\nUsed for stripping html from modules.name (title)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\ndef up(cursor):\n cursor.execute(\"\"\"\\\nCREATE OR REPLACE FUNCTION strip_html(html_text TEXT)\n RETU... | python | chosen |
[
{
"from": "human",
"value": "Add simple linear interpolation filling.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import division\n\nimport climate\nimport lmj.cubes\nimport lmj.cubes.fill\nimport numpy as np\nimport pandas as pd\n\nlogging = climate.get_logger('fil... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for OpenStack config defaults\n\nSigned-off-by: Zack Cerza <d7cdf09fc0f0426e98c9978ee42da5d61fa54986@redhat.com>\n"
},
{
"from": "gpt",
"value": "from teuthology.config import config\n\n\nclass TestOpenStack(object):\n\n def setup(self):\n se... | python | chosen |
[
{
"from": "human",
"value": "Add initial draft of posterior models\n"
},
{
"from": "gpt",
"value": "import scipy as sp\n\nfrom .utils import stochastic_optimization\n\nclass BolfiPosterior():\n\n def __init__(self, model, threshold, priors=None):\n self.threshold = threshold\n s... | python | chosen |
[
{
"from": "human",
"value": "Reset invalid default quotas for CloudServiceProjectLink [WAL-814]\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.contenttypes import models as ct_models\nfrom django.db import migrations, mode... | python | chosen |
[
{
"from": "human",
"value": "Remove mimetype from the module_files table\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\\\n- Move the mimetype value from ``module_files`` to ``files``.\n- Remove the ``mimetype`` column from the ``module_files`` table.\n\n\"\"\"\nfrom __future__... | python | chosen |
[
{
"from": "human",
"value": "Clean up db script (remove articles older than two days).\n"
},
{
"from": "gpt",
"value": "from pymongo import MongoClient\nfrom fetch_stories import get_mongo_client, close_mongo_client\nfrom bson import ObjectId\nfrom datetime import datetime, timedelta\n\ndef remo... | python | chosen |
[
{
"from": "human",
"value": "Add a server identity test\n"
},
{
"from": "gpt",
"value": "import nose\nimport requests\n\nimport fixture\n\n\n@nose.with_setup(fixture.start_tangelo, fixture.stop_tangelo)\ndef test_server_identity():\n response = requests.get(fixture.url(\"/\"))\n assert res... | python | chosen |
[
{
"from": "human",
"value": "Add tests for exit codes\n"
},
{
"from": "gpt",
"value": "\"\"\"Check that the CLI returns the appropriate exit code.\"\"\"\n\nimport subprocess\n\n\ndef test_exit_code_demo():\n \"\"\"Ensure that linting the demo returns an exit code of 1.\"\"\"\n try:\n ... | python | chosen |
[
{
"from": "human",
"value": "Test killing onitu during a transfer\n"
},
{
"from": "gpt",
"value": "import os.path\nfrom os import unlink\n\nfrom utils.launcher import Launcher\nfrom utils.entries import Entries\nfrom utils.loop import CounterLoop, BooleanLoop\nfrom utils.files import generate, c... | python | chosen |
[
{
"from": "human",
"value": "Add an python example for stream testing\n"
},
{
"from": "gpt",
"value": "\"\"\"Example program to show how to read a multi-channel time series from LSL.\"\"\"\n\nfrom pylsl import StreamInlet, resolve_stream\nimport sys\n# first resolve an EEG stream on the lab netw... | python | chosen |
[
{
"from": "human",
"value": "Add tests for utils experiment module\n"
},
{
"from": "gpt",
"value": "from nose.tools import assert_equal, assert_false\n\nfrom os import remove\nfrom os.path import join\nfrom json import dump\n\nfrom cptm.utils.experiment import load_config, add_parameter, thetaFi... | python | chosen |
[
{
"from": "human",
"value": "McARM: Write a silly Python script to compute some hard coded info from the\ngenerated ARM match table, which is substantially more efficient than dealing\nwith tblgen.\n\ngit-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@123252 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Add new DemoStream example corresponding to the LSL4Unity Project\n"
},
{
"from": "gpt",
"value": "\"\"\"Example program to show how to read a marker time series from LSL.\"\"\"\nimport sys\nsys.path.append('./pylsl') # help python find pylsl relative to this example... | python | chosen |
[
{
"from": "human",
"value": "Monitor process using subprocess module"
},
{
"from": "gpt",
"value": "import subprocess\n\n\"\"\" If the program is running \"ps -ef | grep program\" will return 2 or more rows \n(one with the program itself and the second one with \"grep program\"). \nOtherwise, it... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add china region\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-06-24 21:52\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef forwards(apps, schema_editor):\n Regi... | python | chosen |
[
{
"from": "human",
"value": "DM-12166: Create Content Loader app to Herd/DM standards\n- Configure Pyinstaller\n"
},
{
"from": "gpt",
"value": "hiddenimports = [\n 'numpy',\n 'pandas._libs.tslibs.timedeltas',\n 'pandas._libs.tslibs.nattype',\n 'pandas._libs.tslibs.np_datetime',\n ... | python | chosen |
[
{
"from": "human",
"value": "Access checking unit tests for SlotsTransferAdminPage.\n"
},
{
"from": "gpt",
"value": "# Copyright 2013 the Melange 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.\n... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for data integrity.\n"
},
{
"from": "gpt",
"value": "import ConfigParser\nimport csv\nimport unittest\n\nclass DataTest(unittest.TestCase):\n \n def setUp(self):\n config = ConfigParser.RawConfigParser()\n config.read('../app.config'... | python | chosen |
[
{
"from": "human",
"value": "Add tool for clean pyc files\n\nSigned-off-by: xcgspring <8f4f8d15922e4269158d45cde01dc3497961f40d@126.com>\n"
},
{
"from": "gpt",
"value": "\nimport re\nimport os\nimport sys\n\nprint(\"%s path\\n\" % sys.argv[0])\n\npath = sys.argv[1]\n\nfor root, dirs, files in os... | python | chosen |
[
{
"from": "human",
"value": "Test if we tried to commit with an empty message, it should raise a ValueError\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom mock import MagicMock, patch\nfrom nose.tools import raises\n\nfrom pyolite.git import Git\n\n\nclass TestGit(TestCas... | python | chosen |
[
{
"from": "human",
"value": "Add script to create the player pitch weights.\n"
},
{
"from": "gpt",
"value": "import random\nfrom player.models import Player, Pitch, PlayerPitchWeight\n\n#TODO: Need to centralize this function call.\nrandom.seed(123456789)\n\npitch_records = Pitch.objects.all().o... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 551. Student Attendance Record I\n\n551. Student Attendance Record I: https://leetcode.com/problems/student-attendance-record-i/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def checkRecord(self, s):\n \"\"\"\n :type... | python | chosen |
[
{
"from": "human",
"value": "Add Digital Outcomes and Specialists to frameworks\n\nThis commit checks to see if:\n- the framework exists in the enum before trying to add it\n- the framework exists in the table before trying to add\n\nThis means that it won’t fall over on enviroments where DOS has already be... | python | chosen |
[
{
"from": "human",
"value": "Test `write_*` and `join_*` on bytes\n"
},
{
"from": "gpt",
"value": "import re\nimport linesep\n\ntry:\n from StringIO import StringIO as BytesIO\nexcept ImportError:\n from io import BytesIO\n\n# Based on <https://pytest.org/latest/example/parametrize.h... | python | chosen |
[
{
"from": "human",
"value": "Add data migration for Audit's empty status\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"\nFix audit empty status\n\nCreate Date: 2016-12-22 13:53:24.497701\... | python | chosen |
[
{
"from": "system",
"value": "Fix serving uploaded files during development.\n"
},
{
"from": "human",
"value": "\nimport os\n\nfrom django.conf import settings\nfrom django.contrib.staticfiles.management.commands import runserver\nfrom django.contrib.staticfiles.handlers import StaticFilesHandle... | python | chosen |
[
{
"from": "human",
"value": "Allow to start server as a module\n"
},
{
"from": "gpt",
"value": "import cherrypy\nfrom argparse import ArgumentParser\nfrom . import LiSEHandleWebService\n\nparser = ArgumentParser()\nparser.add_argument('world', action='store', required=True)\nparser.add_argument(... | python | chosen |
[
{
"from": "human",
"value": "Add management command to find domains impacted by 502 bug\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.domain.models import Domain\nimport csv\n\n\nclass Command(BaseCommand):\n help = 'Find domains with s... | python | chosen |
[
{
"from": "human",
"value": "Add eval dispatch (copied from compyle)\n"
},
{
"from": "gpt",
"value": "from keywords import *\nfrom reg import *\nfrom parse import parse\n\ndef evalExp():\n\texpr = parse(fetch(EXPR)) # make dedicated fetch_expr()?\n\t# expr = transformMacros(expr)\n\tevalFunc = g... | python | chosen |
[
{
"from": "human",
"value": "Initialize multiple class setup; add remaining APIs\n"
},
{
"from": "gpt",
"value": "from .endpoints import Endpoints\nfrom .helpers import get, scrape_filters\n\n\nclass Cobalt:\n def __init__(self, api_key=None):\n self.host = 'http://cobalt.qas.im/api/1.... | python | chosen |
[
{
"from": "human",
"value": "Add an interface for eagerly evaluating command graph elements\n\nSetup a new interface that evaluates commands on the command graph as\nthey are issued. This is roughly the interface of the current Client.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2019, Sean... | python | chosen |
[
{
"from": "human",
"value": "Add a prototype for cached regex.compile()\n"
},
{
"from": "gpt",
"value": "from regex import *\nfrom regex import compile as raw_compile\n\n\n_cache = {}\n\n\n# Wrap regex.compile up so we have a global cache\ndef compile(s, *args, **args):\n global _cache\n t... | python | chosen |
[
{
"from": "human",
"value": "Test joint refinement of 300 cspad images using Brewster 2018 methods.\n\nThis reproduces the last panel of Figure 3, refining the outer shell of the cspad. It tests auto_reduction, parameter fixing, constraints, SparseLevMar, and sauter_poon outlier rejection.\n\nTest passes o... | python | chosen |
[
{
"from": "human",
"value": "Create a class named \"CreateSpark\", which is to solove the problem of \"Cannot run multiple SparkContexts at once; existing SparkContext(app=spam-msg-classifier, master=local[8]) created by __init__\"\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# !/us... | python | chosen |
[
{
"from": "human",
"value": "Add config command for setting the address of rf sensors.\n"
},
{
"from": "gpt",
"value": "import zmq\nimport time\nimport sys\nprint sys.argv[1:]\n\n# ZeroMQ Context\ncontext = zmq.Context()\n\nsock_live = context.socket(zmq.PUB)\nsock_live.connect(\"tcp://\"+sys.ar... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the parse method of the spider\n"
},
{
"from": "gpt",
"value": "from webcomix.comic_spider import ComicSpider\n\n\ndef test_parse_yields_good_page(mocker):\n mock_response = mocker.patch('scrapy.http.Response')\n mock_response.urljoin.return_value... | python | chosen |
[
{
"from": "human",
"value": "Add script to compute some stats about data from energy consumption measures\n"
},
{
"from": "gpt",
"value": "import argparse\nimport csv\nfrom glob import glob\nimport re\nimport statistics\nimport sys\n\ndef get_stats_from(files_names, files_content):\n for i in... | python | chosen |
[
{
"from": "human",
"value": "Add a vim version of merge business hours\n"
},
{
"from": "gpt",
"value": "from vim_turing_machine.machines.merge_business_hours.merge_business_hours import merge_business_hours_transitions\nfrom vim_turing_machine.vim_machine import VimTuringMachine\n\n\nif __name__... | python | chosen |
[
{
"from": "human",
"value": "Add new migration to load metrics fixtures\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.core.management import call_command\n\n\ndef load_metrics():\n cal... | python | chosen |
[
{
"from": "human",
"value": "Add script to update giving and teams receiving\n"
},
{
"from": "gpt",
"value": "import sys\n\nfrom gratipay import wireup\n\ndb = wireup.db(wireup.env())\n\nparticipants = db.all(\"\"\"\n SELECT p.*::participants\n FROM participants p\n WHERE (\n ... | python | chosen |
[
{
"from": "human",
"value": "Check coverage of pgi, vs gi\n\nThis loops through all the typelibs it can find and the methods, then tries to call them, to build a report to see coverage.\r\n\r\nIt's a fairly brute force approach but works.. not sure if this is the place to put this in the repo\r\n\r\nCould ... | python | chosen |
[
{
"from": "human",
"value": "Add migration to ensure consistency on file keys.\n\nResolves https://github.com/CenterForOpenScience/openscienceframework.org/issues/1119\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"Find all nodes with different sets of keys for ... | python | chosen |
[
{
"from": "human",
"value": "Add Himax motion detection example.\n"
},
{
"from": "gpt",
"value": "# Himax motion detection example.\n\nimport sensor, image, time, pyb\nfrom pyb import Pin, ExtInt\n\nsensor.reset()\nsensor.set_pixformat(sensor.GRAYSCALE)\nsensor.set_framesize(sensor.QVGA)\nsensor... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.