conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add import script for Denbighshire\n"
},
{
"from": "gpt",
"value": "\"\"\"\nImport Denbighshire\n\"\"\"\nfrom time import sleep\nfrom django.contrib.gis.geos import Point\nfrom data_collection.management.commands import BaseAddressCsvImporter\nfrom data_finder.helper... | python | chosen |
[
{
"from": "system",
"value": "Add a second trivial streaming test to make sure our re-useing the spark context is ok\n"
},
{
"from": "human",
"value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with... | python | chosen |
[
{
"from": "human",
"value": "Create a new example of shape using Facade pattern\n"
},
{
"from": "gpt",
"value": "import abc\n\nclass Shape(object):\n __metaclass__ = abc.ABCMeta\n\n @abc.abstractmethod\n def draw(self):\n pass\n\n\nclass Rectangle(Shape):\n def __init__(self):... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for linux.dig action\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2020 The StackStorm Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 282. Expression Add Operators\n\n282. Expression Add Operators: https://leetcode.com/problems/expression-add-operators/\n\nWay too ugly...\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nclass Solution(object):\n def dfs_a... | python | chosen |
[
{
"from": "human",
"value": "Add a more generic stepping benchmark, which uses the '-k' option of the test driver\nto be able to specify the runhook(s) to bring the debug session to a certain state\nbefore running the benchmarking logic. An example,\n\n./dotest.py -v -t +b -k 'process attach -n Mail' -k 't... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the log command\n"
},
{
"from": "gpt",
"value": "from mock import patch\n\nfrom ..utils import DustyTestCase\nfrom dusty.commands.logs import tail_container_logs\n\nclass TestLogsCommands(DustyTestCase):\n @patch('dusty.commands.logs.exec_docker')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit-level test for the SummaryReporter\nTests configuration of the report method of SummaryReader\n"
},
{
"from": "gpt",
"value": "# coding: utf8\n# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0\n# For details: https://bitbucket.o... | python | chosen |
[
{
"from": "human",
"value": "Test for reset fixes refcount bug\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport sys\nimport pycurl\n\nsaw_error = 1\n\ndef main():\n global saw_error\n\n pycurl.global_init(pycurl.GLOBAL_DEFAULT)\n\n outf = file(\"/dev/null\", \"rb... | python | chosen |
[
{
"from": "human",
"value": "Add test for date conversion\n"
},
{
"from": "gpt",
"value": "def test_fact_mjd_conversion():\n from aux2mongodb.utils import fact_mjd_to_datetime\n\n timestamp = fact_mjd_to_datetime(16801.33)\n assert timestamp.year == 2016\n assert timestamp.month == 1... | python | chosen |
[
{
"from": "human",
"value": "Add a script to calculate track recalls.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame\nfrom vdetlib.utils.common import iou\nimport argparse\nimport numpy as np\n\nif __name__ ... | python | chosen |
[
{
"from": "human",
"value": "Add send email using SMTP example\n"
},
{
"from": "gpt",
"value": "from email.mime.text import MIMEText\nfrom smtplib import SMTP\nimport logging\n\n\n#from settings import EMAIL_FROM, EMAIL_MSG, EMAIL_TO, SERVER\nEMAIL_FROM = 'me@example.com'\nEMAIL_MSG = 'Hi friend... | python | chosen |
[
{
"from": "human",
"value": "Create script to generate PL bank registry\n"
},
{
"from": "gpt",
"value": "import json\nimport csv\nimport requests\n\nURL = \"https://ewib.nbp.pl/plewibnra?dokNazwa=plewibnra.txt\"\n\n\ndef process():\n registry = []\n with requests.get(URL, stream=True) as t... | python | chosen |
[
{
"from": "human",
"value": "Add tests for autoencoder models\n"
},
{
"from": "gpt",
"value": "import sys\nimport pytest\nfrom numpy.testing import assert_equal\nimport torch\n\nsys.path.append(\"../../../\")\n\nfrom pycroscopy.learn import models\n\n\n@pytest.mark.parametrize(\"dim, size\", [(1... | python | chosen |
[
{
"from": "human",
"value": "Set interface-config from pre-defined csv-file"
},
{
"from": "gpt",
"value": "\n\n__version__ = '0.9'\n__author__ = 'Remi Batist'\n\n# Importing interface-settings from pre-defined csv-file\n\n# used row format shown in the example below\n# csv delimiter ' ; '\n\n# i... | python | chosen |
[
{
"from": "human",
"value": "Convert web.Application tests to pytest style\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport pytest\n\nfrom aiohttp import web, log\nfrom unittest import mock\n\n\ndef test_app_ctor(loop):\n app = web.Application(loop=loop)\n assert loop is app.loop\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example script which converts a Compass .PLT plot file with splay shots to an XYZ pointcloud.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nusage: plt2xyz.py PLTFILE > outfile.xyz\n\nDumps an XYZ point cloud from a compiled Compass plot file, wi... | python | chosen |
[
{
"from": "human",
"value": "Add ML lab2 vedio version\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport time\nimport pandas as pd\nfrom sklearn.preprocessing import normalize\nfrom sklearn.neighbors import KNeighborsClassifier as KNN\nfrom sklearn.metric... | python | chosen |
[
{
"from": "human",
"value": "DEBUG AND TEST. This one had a lot of typos\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport pygeoip, dpkt, socket, optparse\n\ngi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat')\ntgt = '173.255.226.98'\t\t\t\t\t\t\t\t\t\t#Could be added as an argument\n\ndef ba... | python | chosen |
[
{
"from": "human",
"value": "Add tests quantity from string parsing\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n#=============================================================================================\n# MODULE DOCSTRING\n#=====================================================... | python | chosen |
[
{
"from": "human",
"value": "Add script to do inferencer of autoencoder model\n\n"
},
{
"from": "gpt",
"value": "import os\nimport numpy as np\nimport tensorflow as tf\nfrom btc_settings import *\nfrom btc_train import BTCTrain\nimport matplotlib.pyplot as plt\nfrom btc_cae_parameters import get... | python | chosen |
[
{
"from": "human",
"value": "Add Exploit Dev Pattern Create\n"
},
{
"from": "gpt",
"value": "import sys, string, re\r\n\r\narguments = []\r\ntextString = []\r\nprogram = True\r\nnumber = ['a','a','a']\r\n\r\ndef get_pattern(stuff):\r\n\tfirst = \"abcdefghijklmnopqrstuvwxyz0123456789\"\r\n\tnext ... | python | chosen |
[
{
"from": "system",
"value": "Use relative import to import tasks\n"
},
{
"from": "human",
"value": "from .interfaces.model import Model\nfrom .interfaces.dataset import Dataset\nfrom .trainer import Trainer\n\nimport tasks.tasks as tasks\n"
},
{
"from": "gpt",
"value": "from .interf... | python | chosen |
[
{
"from": "human",
"value": "Add an example showing how to use some of the oban functions.\n\ngit-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@295 150532fb-1d5b-0410-a8ab-efec50f980d4\n"
},
{
"from": "gpt",
"value": "import scipy.constants as sconsts\nimport matplotlib.pyplot as plt\nfrom ma... | python | chosen |
[
{
"from": "human",
"value": "Test metadata_proxy properties independently from hypothesis strategies\n\nOccasionally they fail to cover all bases and break our coverage job on Python 2.7.\n\nSigned-off-by: Hynek Schlawack <6a253031d5fc83cdcd7910737760a89b7bcfb849@ox.cx>\n"
},
{
"from": "gpt",
"v... | python | chosen |
[
{
"from": "human",
"value": "Add demo code for later\n"
},
{
"from": "gpt",
"value": "from tilezilla.db.sqlite.tables import Base, TileSpec, Tile\n\n\nif __name__ == '__main__':\n from tilezilla import tilespec, products, stores\n from sqlalchemy import create_engine\n from sqlalchemy.o... | python | chosen |
[
{
"from": "human",
"value": "Add tests (Inspired by yocommon)\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom yocommon.util import configure\n\nimport authtkt\n\n\nclass AuthTktTests(unittest.TestCase):\n def setUp(self):\n self.secret = 'hmac secret'\n self.crypto_secr... | python | chosen |
[
{
"from": "human",
"value": "Add test for RegexLexer inheritance (fails with current code).\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n Tests for inheritance in RegexLexer\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: Copyright 2006-2014 by the Pygments te... | python | chosen |
[
{
"from": "human",
"value": "Add example of processing two different streams in separate threads\nretrieving the streams from the module's global scope.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n'''\n Process two different streams in parallel,\n retrieving them from the mo... | python | chosen |
[
{
"from": "human",
"value": "Add example for the expose/unexpose methods\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis example:\n\n1. Connects to the current model.\n2. Deploys a charm and waits until it reports itself active.\n3. Demonstrates exposing application endpoints to space and CIDR com... | python | chosen |
[
{
"from": "human",
"value": "Add ability to create and update financial data\n"
},
{
"from": "gpt",
"value": "from maediprojects import db, models\nfrom sqlalchemy import *\nimport datetime\n\ndef isostring_date(value):\n # Returns a date object from a string of format YYYY-MM-DD\n return ... | python | chosen |
[
{
"from": "system",
"value": "Make pip log world writable"
},
{
"from": "human",
"value": "\"\"\"\nPython Blueprint\n================\n\nDoes not install python itself, only develop and setup tools.\nContains pip helper for other blueprints to use.\n\n**Fabric environment:**\n\n.. code-block:: y... | python | chosen |
[
{
"from": "human",
"value": "Add Git SHA read util\n"
},
{
"from": "gpt",
"value": "from subprocess import check_output\n\ndef get_sha():\n \"\"\"Determines Git SHA of current working directory.\"\"\"\n return check_output([\"git\", \"log\",\"-n1\",\"--pretty=oneline\"]).split(' ')[0]\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add script to datamine the reports via NLTK\n"
},
{
"from": "gpt",
"value": "\nfrom map import mapping\n# walk through the os and get all files\n# read each file in tern and go through line by line\n# print lines that contain smell and the report name\nfrom os import... | python | chosen |
[
{
"from": "human",
"value": "Add script to add a user to a project\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\nimport sys\n\n\nclass Access(object):\n def __init__(self, user_id, project_id, project_name):\n self.u... | python | chosen |
[
{
"from": "human",
"value": "Add Python script used to retrieve confirmation links from emails\n"
},
{
"from": "gpt",
"value": "import email\nimport imaplib\nimport os\nimport sys\n\n\nclass EmailProcessor():\n mail = None\n\n def __init__(self, user, password, host='mail.mega.co.nz', port... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add extension ID to addon study recipes\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.0.13 on 2019-02-28 11:28\n\nimport json\n\nfrom urllib.parse import unquote_plus\n\nfrom django.db import migrations\n\n\ndef remove_signatures(apps, sch... | python | chosen |
[
{
"from": "human",
"value": "Create days_in_month fn in new internal module.\n"
},
{
"from": "gpt",
"value": "def is_gregorian_leap_year(y):\n if (y % 400) == 0:\n return True\n if (y % 100) == 0:\n return False\n if (y % 4) == 0:\n return True\n return False # ... | python | chosen |
[
{
"from": "human",
"value": "Add missing template context processor\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\nfrom __future__ import unicode_literals\n\ndef orcid_base_domain(request):\n from django.conf import settings\n return {'ORCID_BASE_DOMAIN':settings.ORCID_BASE_DO... | python | chosen |
[
{
"from": "human",
"value": "Create fake data for testing\n"
},
{
"from": "gpt",
"value": "\"\"\"Generate fake data for testing purposes.\"\"\"\n\nfrom faker import Faker\nfrom random import randint\nfrom GoPlayer import Player\nfrom pprint import pprint\n\nfake = Faker()\n\nnames = [fake.name()... | python | chosen |
[
{
"from": "human",
"value": "Add a script to implement the workflow pieces.\n"
},
{
"from": "gpt",
"value": "from git import *\n\ndef prefix():\n # TODO: Extract to common class if other workflow providers installed\n return \"issue/\"\n\ndef __findRepo():\n return Repo(\".\")\n\ndef cr... | python | chosen |
[
{
"from": "human",
"value": "Add test for campaign repr\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom k2catalogue import models\n\n@pytest.fixture\ndef campaign():\n return models.Campaign(id=5)\n\n\ndef test_campaign_repr(campaign):\n assert repr(campaign) == '<Campaign: 5>'\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add a python script for checking that the examples match the event\nschema.\n\nDoes the same checks as check.sh, but is a *lot* faster making it\nsuitable for using as a pre-commit hook.\n\nI don't suggest replacing check.sh since it's good to check that the\nschema works with m... | python | chosen |
[
{
"from": "human",
"value": "Add CatalogMenu allowing to use the CMS menu system for products\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.menu_bases import CMSAttachMenu\n... | python | chosen |
[
{
"from": "human",
"value": "Add the reder for two dimensional dic csv\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Dec 13 12:50:28 2015\n\n@author: ilyass.tabiai@gmail.com\n@author: rolland.delorme@gmail.com\n@author: diehl@ins.uni-bonn.de\n\"\"\"\nimport csv... | python | chosen |
[
{
"from": "human",
"value": "Add an experimental ssh monitoring script.\n\nSigned-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport eventlet\nfrom eventlet.green import socket\nimport libssh2\nimport time\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add to Array-Form of Integer\n"
},
{
"from": "gpt",
"value": "class Solution:\n def addToArrayForm(self, A: List[int], K: int) -> List[int]:\n \n num = int(''.join(str(x) for x in A)) + K\n \n return ([int(x) for x in str(num)])\n ... | python | chosen |
[
{
"from": "human",
"value": "Add the random matrix module\n"
},
{
"from": "gpt",
"value": "\n# encoding: utf-8\n\"\"\"Routines for sampling from the Haar measures of the classical compact\ngroups. Algorithms taken from http://arxiv.org/abs/math-ph/0609050.\n\nTODO Symplectic groups are missing\n... | python | chosen |
[
{
"from": "human",
"value": "Add open port violation alert\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://... | python | chosen |
[
{
"from": "human",
"value": "Add example saving jpg using pillow\n"
},
{
"from": "gpt",
"value": "# Usage: python examples/save_jpeg_using_pil.py src.CR2 dest.jpg\n# Requires PIL (pip install pillow)\nimport sys\nfrom PIL import Image\nfrom rawkit.raw import Raw\n\n\nsrc = sys.argv[1]\ndest = sy... | python | chosen |
[
{
"from": "human",
"value": "Add test to simply run a few binaries\n\nThis is not really a unit test, but it's so fast that I think it could\nbe considered as such. And it would be nice to gate on such blatant\nbreakage.\n\nChange-Id: I8ff4ca27a912c30bd962168418ac44217ea9e54d\nSigned-off-by: Jeff Peeler <d7... | python | chosen |
[
{
"from": "system",
"value": "Use get_profile_for_user() in profile signal handler\n"
},
{
"from": "human",
"value": "from django.db import DatabaseError, connection\nfrom django.db.models.signals import post_save\nfrom mezzanine.accounts import get_profile_user_fieldname\nfrom mezzanine.conf im... | python | chosen |
[
{
"from": "human",
"value": "Add a base handler for URI-oriented pubsub messages\n"
},
{
"from": "gpt",
"value": "\"\"\"\nHandler base classes.\n\n\"\"\"\nfrom abc import ABCMeta\nfrom inflection import humanize\n\nfrom requests import get\n\n\nclass URIHandler(object):\n \"\"\"\n Base han... | python | chosen |
[
{
"from": "human",
"value": "Add Dominic Hamon's nettest for running tests written with other interpreters.\n\n * Fixes #8011.\n"
},
{
"from": "gpt",
"value": "from ooni import nettest\nfrom ooni.utils import log\nfrom twisted.internet import defer, protocol, reactor\nfrom twisted.python import ... | python | chosen |
[
{
"from": "human",
"value": "Structure for the Rst test"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport sys\nimport os\nimport pytest\n\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), \"../src/epicslide\"))\n\nimport rst\n\n\nclass TestRst(object):\n def test_pygm... | python | chosen |
[
{
"from": "human",
"value": "Add a toolbar for Zinnia\n"
},
{
"from": "gpt",
"value": "\"\"\"Toolbar extensions for CMS\"\"\"\nfrom django.core.urlresolvers import reverse\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.toolbar_base import CMSToolbar\nfrom cms.toolbar_pool i... | python | chosen |
[
{
"from": "human",
"value": "Create a custom UUID column type\n"
},
{
"from": "gpt",
"value": "from sqlalchemy.types import TypeDecorator, BINARY\nfrom sqlalchemy.dialects.postgresql import UUID\nimport uuid\n\n\nclass UUID(TypeDecorator):\n \"\"\"Platform-independent UUID type.\n\n Uses P... | python | chosen |
[
{
"from": "human",
"value": "Add instance generator for complete reproducible objects\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport random\nimport re\nimport StringIO\n\nimport d1_common.xml\n\nimport d1_test.d1_test_case\nimport d1_test.instance_generat... | python | chosen |
[
{
"from": "human",
"value": "Add tests for cleaning line\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\nimport sshrc.core.lexer as lexer\n\nimport pytest\n\n\n@pytest.mark.parametrize(\"input_, output_\", (\n (\"\", \"\"),\n (\" \", \"\"),\n (\" #\", \"\"),\n ... | python | chosen |
[
{
"from": "human",
"value": "Test for the new versioning sub package\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\nimport unittest\nfrom nose import tools\n\nfrom kitchen.versioning import version_tuple_to_string\n\n# Note: Using nose's generator tests for this so we can't subclas... | python | chosen |
[
{
"from": "human",
"value": "Add python script that converts Twitter IDs to timestamps\n"
},
{
"from": "gpt",
"value": "import sys\nfrom datetime import datetime\n\n# use like:\n# twilight stream --filter \"locations=-180,-90,180,90\" | grep --line-buffered -v '^{\"delete\":' | jq --unbuffered -... | python | chosen |
[
{
"from": "human",
"value": "Add test case for networks and network sorting.\n"
},
{
"from": "gpt",
"value": "# US 101, \"James Lick Freeway\"\n# http://www.openstreetmap.org/way/27183379\n# http://www.openstreetmap.org/relation/108619\nassert_has_feature(\n 16, 10484, 25334, 'roads',\n { ... | python | chosen |
[
{
"from": "human",
"value": "Add an example which lists the unsuported semantics - useful\n"
},
{
"from": "gpt",
"value": "\n# Note: Display the list of unsuported semantics\n\nfrom operator import itemgetter\nfrom triton import *\n\n\nunsuportedSemantics = dict()\n\n\ndef cbefore(instruct... | python | chosen |
[
{
"from": "human",
"value": "Add test to demonstrage the bug\n"
},
{
"from": "gpt",
"value": "code = '''from __future__ import unicode_literals\n\nfrom webtest import Upload\n\n\ndef test_create_break(testapp, session):\n sid = session['id']\n\n resp = testapp.post(\n '/sessions/{}/... | python | chosen |
[
{
"from": "human",
"value": "Test individual functions in cellom2tif.py\n"
},
{
"from": "gpt",
"value": "from cellom2tif import cellom2tif\n\ndef test_start():\n cellom2tif.start()\n assert cellom2tif.VM_STARTED\n\n\ndef test_done():\n cellom2tif.done()\n assert cellom2tif.VM_KILLED\... | python | chosen |
[
{
"from": "human",
"value": "Add a script to convert AA bench runs to CSV.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport os\nimport argparse\nimport json\n\ndef read_stat_file(path):\n with open(path, 'r') as f:\n json_data = f.read()\n parsed = j... | python | chosen |
[
{
"from": "human",
"value": "Add script used to add BBB017 sample documents\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# BBBC017-image.py <metadata.json> <features-mongo.json> <screen-info.json>\n\nimport json\nimport os\nfrom pymongo import MongoClient\nimport sys\n\ndef main(arg... | python | chosen |
[
{
"from": "human",
"value": "Add a test for l_to_lm.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom __future__ import print_function, division\n\nimport numpy as np\nfrom sht.utils import l_to_lm\n\ndef test_l_to_lm():\n L = 10\n x = np.random.randn(L)\n\n # Test withou... | python | chosen |
[
{
"from": "human",
"value": "Add reference to constellation paper\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nhttp://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42\nhttps://iopscience.iop.org/article/10.1086/132034/pdf\n\n\"\"\"\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add test module for GreedyEmbedding\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# \n# This script tests the functions in GreedyEmbedding. It also shows\n# how to calculate the distance of any two points in Poincare disk.\n#\n# Reference: \n# R. Kleinberg ... | python | chosen |
[
{
"from": "system",
"value": "Move URLconfig around to fix Django Debug Toolbar\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\nfrom django.conf import settings\n\nimport pretixcontrol.urls\nimport pretixpresale.urls\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add API for check MX\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport dns.resolver\nimport dns.reversename\nimport json\nimport urlparse\n\n\ndef resolve_mx(hostname):\n response = []\n for data in dns.resolver.query(hos... | python | chosen |
[
{
"from": "human",
"value": "Add a script to be able to control the motor based on mobile phone inclination. This can be used to control the kite while launching it if alone\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport threading\nimport time\nimport numpy as np\nsys.path.append... | python | chosen |
[
{
"from": "human",
"value": "Add a script to download the manifest database.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport json\nimport os\nimport sys\nimport tempfile\nimport urllib2\nimport zipfile\n\n# Get the manifest urls.\nreq = urllib2.Request(\n \"https://www.bungie.net... | python | chosen |
[
{
"from": "human",
"value": "Add debugging submodule for bug reporters\n\nThe suggested usage in a bug report would be\n\n python -c 'from requests import _bug; _bug.print_information()'\n\nThis should generate most of the information we tend to ask for\nrepeatedly from bug reporters.\n"
},
{
"fr... | python | chosen |
[
{
"from": "human",
"value": "Remove invalid user role entries\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\"\"\"\nClear user roles with invalid context\n\nCreate Date: 2017-03-11 14:26:55.133... | python | chosen |
[
{
"from": "human",
"value": "Add MyAnimeList plugin for searching animes.\n"
},
{
"from": "gpt",
"value": "import aiohttp\nfrom bs4 import BeautifulSoup\n\nfrom plumeria import config\nfrom plumeria.command import commands, CommandError\nfrom plumeria.util import http\nfrom plumeria.util.message... | python | chosen |
[
{
"from": "human",
"value": "Add dict of rest freqs for 17B\n"
},
{
"from": "gpt",
"value": "\n# Line SPW setup for 17B-162 w/ rest frequencies\nlinespw_dict = {0: [\"HI\", \"1.420405752GHz\"],\n 1: [\"H166alp\", \"1.42473GHz\"],\n 2: [\"H164alp\", \"1.47734GHz\"],... | python | chosen |
[
{
"from": "human",
"value": "Add old script for creating dataset TOML from HDF5\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nfrom __future__ import print_function\n\nimport glob\nimport os\nimport re\n\nimport argparse\nimport h5py\nimport numpy as np\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add tests for events Location model\n"
},
{
"from": "gpt",
"value": "from tests.BaseTest import BaseTest\nfrom events.models import Location\n\n\nclass LocationModelTest(BaseTest):\n\n def test_location(self):\n location = self.event_data.create_location(1)... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking witness isomorphism\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport sys\nimport networkx as nx\n\n# def witness_node_match(n1, n2):\n# return True\nwitness_node_match = nx.algorithms.isomorphism.categorical_node_match(\n [... | python | chosen |
[
{
"from": "human",
"value": "Add base tool to facilitate drag and drop support.\n"
},
{
"from": "gpt",
"value": "#------------------------------------------------------------------------------\n# Copyright (c) 2014, Enthought, Inc.\n# All rights reserved.\n#\n# This software is provided without ... | python | chosen |
[
{
"from": "system",
"value": "Fix url of entries made by listdir on Windows.\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1586 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n"
},
{
"from": "human",
"value": "import logging\nfrom flexget.plugin import *\n\nlog = logging.getLogger('listdir')\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for command line script\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\r\n\"\"\"\r\nTests for pyftpsync\r\n\"\"\"\r\nfrom __future__ import print_function\r\n\r\nimport os\r\nimport sys\nimport unittest\r\n\r\nfrom ftpsync import pyftpsync, __vers... | python | chosen |
[
{
"from": "human",
"value": "Add concurrent futures benchmark script"
},
{
"from": "gpt",
"value": "from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor\nimport multiprocessing\nfrom multiprocessing.pool import ThreadPool\nimport threading\nimport time\n\n\ndef bar(i=0):\n i... | python | chosen |
[
{
"from": "human",
"value": "Add command for listing playing OCN maps\n"
},
{
"from": "gpt",
"value": "from bs4 import BeautifulSoup\nfrom plugin import CommandPlugin\nimport requests\nimport json\n\n\nclass PlayingMaps(CommandPlugin):\n \"\"\"\n Parses Overcast's maps page and prints curr... | python | chosen |
[
{
"from": "human",
"value": "Add EC2 Container Service (ECS)"
},
{
"from": "gpt",
"value": "from . import AWSObject, AWSProperty\nfrom .validators import boolean, network_port, integer\n\n\nclass Cluster(AWSObject):\n resource_type = \"AWS::ECS::Cluster\"\n\n props = {}\n\n\nclass LoadBala... | python | chosen |
[
{
"from": "human",
"value": "Fix some issues with Bitcoind and WebsiteUptime tabs\n"
},
{
"from": "gpt",
"value": "from tabs.bitcoin import BitcoinPrice, Bitcoind\nfrom tabs.sysinfo import SystemStats, DiskUsage\nfrom tabs.uptime import WebsiteUptime\n\nimport os\n\n# Add any tabs you want to be... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 541. Reverse String II\n\n541. Reverse String II: https://leetcode.com/problems/reverse-string-ii/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def reverseStr(self, s, k):\n \"\"\"\n :type s: str\n :type k: in... | python | chosen |
[
{
"from": "human",
"value": "Split Node initial commit. Class is created with its primary feature\n"
},
{
"from": "gpt",
"value": "class SplitNode:\n # TODO Naming convention\n\n \"\"\"\n Type: Node\n Function: Splits the dataset into 2 sets\n Input port requirements: DATASET, PERCENTAGES\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to test if documents exist\n"
},
{
"from": "gpt",
"value": "#!/bin/python\nimport MySQLdb\nimport argparse\nimport os\n\nparser = argparse.ArgumentParser(description='Test documents of SugarCRM')\nparser.add_argument('--remove', type=bool, default=False,\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script to extra logs for particular test filenames from full WPT logs."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2019 The Servo Project Developers. See the COPYRIGHT\n# file at the top-level directory of this distribution.\n#\n# Licens... | python | chosen |
[
{
"from": "human",
"value": "Check if binary tree is a BST\n"
},
{
"from": "gpt",
"value": "\"\"\"\nWrite a program to check if a given binary tree is bst or not.\n\"\"\"\n\n\"\"\"\nApproach 1:\n1. For each node, check that node's value is greater than max_value in its left subtree and smaller t... | python | chosen |
[
{
"from": "human",
"value": "Add complete hybridization test with python PC\n"
},
{
"from": "gpt",
"value": "\"\"\"Solve a mixed Helmholtz problem\n\nsigma + grad(u) = 0,\nu + div(sigma) = f,\n\nusing hybridisation with SLATE performing the forward elimination and\nbackwards reconstructions. The... | python | chosen |
[
{
"from": "human",
"value": "Clean up the travis log output.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport io\nimport pexpect\nimport string\nimport sys\nimport time\n\nsys.stdin = io.TextIOWrapper(sys.stdin.detach(), newline='')\n\noutput_to=sys.stdout\n\nargs = list(sys.argv[1:... | python | chosen |
[
{
"from": "human",
"value": "Test to check switching off user signup\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom usersettings.shortcuts import get_current_usersettings\n\nfrom django_webtest import WebTest\nfrom django.core.urlresol... | python | chosen |
[
{
"from": "human",
"value": "Add a minimal Flask application\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom database_setup import User, session\n\napp = Flask(__name__)\n\n\n@app.route('/')\n@app.route('/hello')\ndef HelloWorld():\n users = session.query(User)\n output = ''... | python | chosen |
[
{
"from": "human",
"value": "Add a script to run reftests and spawn reftest analyzer.\n\nThis probably only works on Linux, and will need some changes\nto support running on Mac and Windows.\n\nFixes #1863.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# This Source Code Form is subject ... | python | chosen |
[
{
"from": "human",
"value": "Add convertes folder with init python file\n\nAdd the folder that will contain all files related to import export. The\ninit file contains:\n\n- Column order for csv files.\n- Mapping rules that will be used for setting mapping columns\n- List of all objects that are/should be i... | python | chosen |
[
{
"from": "human",
"value": "Add test file for Result class.\n"
},
{
"from": "gpt",
"value": "# Copyright 2017 Google Inc.\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# You may obtain a copy of the L... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.