conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test for issue-2857 fix.\n\nThe test makes sure that inheriting from file works as it should.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# __COPYRIGHT__\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this ... | python | chosen |
[
{
"from": "human",
"value": ":sparkles: Add French language option to Slot content.\n\n #59\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-10-05 13:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass M... | python | chosen |
[
{
"from": "human",
"value": "Add test convex in gis\n"
},
{
"from": "gpt",
"value": "from pylayers.gis.layout import *\nimport pylayers.util.geomutil as geu\nL=Layout('WHERE1.ini')\nL.build()\n\nlc = [(n,L.Gt.node[n]['polyg'].isconvex()) for n in L.Gt.nodes()]\ncnc = [n for n in L.Gt.nodes() if ... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests to cover tokenstorage\n\nThe tokenstorage adapters have several untested behaviors regarding\nhandling of malformed data. Add some unit tests which inject bad data,\nto confirm that the handling code is triggered correctly with no\ncrashfails or other unexpec... | python | chosen |
[
{
"from": "human",
"value": "Add Mgt command to rebuild ccs records\nrebuild ccs record cases for pnc_complete=1\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport time\n\nfrom django.core.management.base import BaseCommand\... | python | chosen |
[
{
"from": "human",
"value": "Add database backup JITishCron task\n\nNow the database will be backed up once per day, given activity on the\nsite. The task is run asynchronously using subprocess.Popen.\n\nThis fixes #46.\n"
},
{
"from": "gpt",
"value": "from wikipendium.jitishcron.decorators impo... | python | chosen |
[
{
"from": "human",
"value": "Add import script for Ceredigion\n"
},
{
"from": "gpt",
"value": "\"\"\"\nImport Ceredigion\n\nnote: this script takes quite a long time to run\n\"\"\"\nfrom django.contrib.gis.geos import Point\nfrom data_collection.management.commands import BaseAddressCsvImporter\... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for hooks\n"
},
{
"from": "gpt",
"value": "import decimal\n\nfrom django.test import TestCase\n\nfrom django.contrib.auth import get_user_model\n\nfrom mock import patch\n\nfrom ..hooks import DefaultHookSet\nfrom ..proxies import ChargeProxy, Customer... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for event dispatcher\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unicode_literals\n\nfrom mock import Mock\nfrom testtools import TestCase\n\nfrom spreadflow_core.even... | python | chosen |
[
{
"from": "human",
"value": "Add test to ensure that UM3 and UM3E variants are kept the same\n\nIt's a bit chunky, but functional.\n"
},
{
"from": "gpt",
"value": "import configparser #To read the profiles.\nimport os #To join paths.\nimport pytest\n\n## Makes sure that the variants for the Ult... | python | chosen |
[
{
"from": "human",
"value": "Add 3-fold cv airlines example for Deep Water.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nfrom builtins import range\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nimport h2o\nfrom tests import pyunit_utils\nimpo... | python | chosen |
[
{
"from": "human",
"value": "Add utils for initalizing dataloaders\n"
},
{
"from": "gpt",
"value": "from typing import Tuple, Type, Union\n\nimport torch\nimport numpy as np\n\n\ndef init_dataloaders(X_train: np.ndarray,\n y_train: np.ndarray,\n X_test: np... | python | chosen |
[
{
"from": "human",
"value": "Add a command to delete areas for a new (inactive) generation\n"
},
{
"from": "gpt",
"value": "# This script deletes all the areas from the new generation (i.e. the\n# most recent inactive one).\n\nfrom optparse import make_option\nfrom django.core.management.base im... | python | chosen |
[
{
"from": "human",
"value": "Switch license from LGPL to ASL.\n\n\ngit-svn-id: 1006245cb1bdea2fd4c9095e50bc2ef3d167b18c@243048 13f79535-47bb-0310-9956-ffa450edef68\n"
},
{
"from": "gpt",
"value": "#!/bin/perl\r\n# $Id$\r\n\r\nimport os, sys\r\nfrom stat import *\r\n\r\ndef walktree(dir, callback... | python | chosen |
[
{
"from": "human",
"value": "Add template tags to template groups\n\n - nc-959\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport taggit.managers\n\n\nclass Migration(migrations.Migration):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test definitions for TranslatableModelLoader unit tests\n"
},
{
"from": "gpt",
"value": "\"\"\"Test class for TranslatableModelLoader.\"\"\"\n\nfrom django.test import SimpleTestCase\n\nclass TranslatableModelLoaderTest(SimpleTestCase):\n \"\"\"Test class for ... | python | chosen |
[
{
"from": "human",
"value": "Remove static selectiongrid hero fields\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-05-30 15:19\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport falmer.content.blocks\nimport falme... | python | chosen |
[
{
"from": "human",
"value": "Add functions for filtering mal-formed materials\n"
},
{
"from": "gpt",
"value": "from django.db.models import Q\n\nfrom models import Material, Person\n\n\ndef get_page(pid, qset, per_page=20):\n \"\"\" Returns item list of specific page in result\n pi... | python | chosen |
[
{
"from": "human",
"value": "Add module to download thumbnails from Commons\n\nThis module allows to download file thumbnails given the image name,\nusing the module urllib2 to access the MediaWiki API thumb.php.\n\nThe entry method is download_file().\n"
},
{
"from": "gpt",
"value": "# -=- enco... | python | chosen |
[
{
"from": "human",
"value": "Add migration for model changes\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.8 on 2019-06-03 12:08\n\nimport django.contrib.postgres.fields\nfrom django.db import migrations, models\nimport grandchallenge.annotations.models\n\n\nclass Migration(migratio... | python | chosen |
[
{
"from": "human",
"value": "Add solution and unit tests for problem 6\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProject Euler Problem 6\n=======================\n\nThe sum of the squares of the first ten natural numbers is,\n 1^2 + 2^2 + ... + 10^2 = 385\n\nThe square of th... | python | chosen |
[
{
"from": "human",
"value": "Add multiprocessing capability via `Parallelizer`\n\nSee https://docs.python.org/3/library/multiprocessing.html\n"
},
{
"from": "gpt",
"value": "from multiprocessing import Pool\nimport os\n\n\nclass Parallelizer:\n def __init__(self, parallelize=True, processes=o... | python | chosen |
[
{
"from": "human",
"value": "Add test with recursive field\n"
},
{
"from": "gpt",
"value": "from mongoengine import Document, fields\nimport unittest\n\n\nclass MyDocument(Document):\n parent = fields.ReferenceField(\"MyDocument\")\n\n\nclass SimpleDocumentTest(unittest.TestCase):\n\n def ... | python | chosen |
[
{
"from": "human",
"value": "Update related facts attr name in results model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport modelcluster.fields\n\n\nclass Migration(migrations.Migration):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add the answer to the fourth question of Assignment 3\n"
},
{
"from": "gpt",
"value": "def odd( number ):\n\n\treturn number % 2 == 1\n\nnumber = int( input( \"Enter a number: \") )\n\nprint( \"Is the number \" + str( number ) + \" odd? Answer: \" + str( odd( number)... | python | chosen |
[
{
"from": "human",
"value": "Split parser pattenrs into passes to support compound returns\n"
},
{
"from": "gpt",
"value": "from thinglang.common import ValueType\nfrom thinglang.lexer.symbols import LexicalGroupEnd\nfrom thinglang.lexer.symbols.arithmetic import FirstOrderLexicalBinaryOperation... | python | chosen |
[
{
"from": "human",
"value": "Move module manager to own module\n"
},
{
"from": "gpt",
"value": "from glob import glob\nimport importlib\n\n\nclass ModuleManager:\n def __init__(self):\n self.availableNodes = {}\n\n # Import all builtin modules first\n modpaths = glob(\"mo... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights efficient comparison problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Efficient Comparison Problem\n\nimport time\n\n\ndef main():\n x, y, L, R = 9, 9, 1, 10000\n print(\"Procedure 1\")\n t1 = time.clock()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to validate CLI communications\n"
},
{
"from": "gpt",
"value": "#!/bin/python2\n# Copyright (C) 2021 OpenMotics BV\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights calkin wilf sequence problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Calkin Wilf Problem\n\n\ndef calkinWilfSequence(number):\n def fractions():\n cur = (1, 1)\n while True:\n yield list(cu... | python | chosen |
[
{
"from": "human",
"value": "Create training and testing text and target pickle files\n"
},
{
"from": "gpt",
"value": "from app import db\nfrom app import Text\nfrom sklearn.externals import joblib\nimport gc\n\n#Train Data Set\ntraining_collection = Text.query.filter_by(data_set = \"train\").al... | python | chosen |
[
{
"from": "human",
"value": "Add three test to check the module\n"
},
{
"from": "gpt",
"value": "'''\nCreated on 2009 mar 11\n\n@author: peio\n'''\nimport unittest\nfrom biolib.cafparser import CafFile\n\nclass Test(unittest.TestCase):\n ''' It tests '''\n def setUp(self):\n self._f... | python | chosen |
[
{
"from": "human",
"value": "Add file to save activity and connectivity matrices to a matlab file\n"
},
{
"from": "gpt",
"value": "import click\nimport numpy as np\nfrom scipy import stats\nimport scipy.io as sio\nfrom scipy.special import expit\n\nfrom spikes_activity_generator import generate_... | python | chosen |
[
{
"from": "system",
"value": "Remove redundant 'ckernel' overload match\n"
},
{
"from": "human",
"value": "\"\"\"\nLift ckernels to their appropriate rank so they always consume the full array\narguments.\n\"\"\"\n\nfrom __future__ import absolute_import, division, print_function\n\nimport datas... | python | chosen |
[
{
"from": "human",
"value": "Test harness for the multicast transceiver.\n\n\nMichael.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# Basic acceptance test harness for the Multicast_sender and receiver\n# components.\n#\n\nimport socket\nimport Axon\n\ndef tests():\n from Axon.Schedu... | python | chosen |
[
{
"from": "human",
"value": "Add an index on accesstokens table for access_token column\n\nPerformance improvement tweak for retrieving and validating\naccess_tokens.\n\nChange-Id: I96a81902d607cc3a3bbb20e71df5f87ff544406e\nStory: 2000165\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apa... | python | chosen |
[
{
"from": "human",
"value": "Add script to move mail in imap folder\n"
},
{
"from": "gpt",
"value": "import imaplib, getpass, re\npattern_uid = re.compile('\\d+ \\(UID (?P<uid>\\d+)\\)')\n\ndef connect(email):\n imap = imaplib.IMAP4_SSL(\"imap.gmail.com\")\n password = getpass.getpass(\"En... | python | chosen |
[
{
"from": "human",
"value": "Add script to make a deprojected cube\n"
},
{
"from": "gpt",
"value": "\n'''\nCreate a deprojected cube in M33's frame\n'''\n\nfrom spectral_cube import SpectralCube\nfrom astropy.io import fits\nimport numpy as np\nimport os\nimport astropy.units as u\nfrom radio_be... | python | chosen |
[
{
"from": "human",
"value": "Add settings for ARNES Tomo instance\n"
},
{
"from": "gpt",
"value": "from common import *\n\nSECRET_KEY = os.environ['SECRET_KEY']\n\nDEBUG = False\nTEMPLATE_DEBUG = False\n\nALLOWED_HOSTS = ['tomo.arnes.si']\n\nWSGI_APPLICATION = 'web.wsgi.dev.application'\n\nDATAB... | python | chosen |
[
{
"from": "human",
"value": "Fixtures: Add script to load fixtures into tables.\n"
},
{
"from": "gpt",
"value": "import subprocess\n\nfrom django.conf import settings\nMY_APPS = settings.MY_APPS\n\nCOMMAND_FORMAT = \"python manage.py loaddata core/fixtures/{app}.json\"\n\ndef load_fixtures():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some python test codes.\n"
},
{
"from": "gpt",
"value": "print(\"\\nTest quotations.\")\nprint(\"Welcome to the GPA calculator.\");\nprint(\"\"\"Welcome to the GPA calculator.\nPlease enter all your letter grades, one per line.\nEnter a blank line to designate th... | python | chosen |
[
{
"from": "human",
"value": "[gem5] Add basic run script with config for syscall emulation.\n"
},
{
"from": "gpt",
"value": "#!/bin/bash\n\nif [ $# -lt 1 ]; then\n echo \"Usage: $0 [-h] [-c COMMAND] [-o OPTIONS]\"\n exit -1\nfi\n\nGEM5ROOT=~/Projects/Sexain-MemController/gem5-stable\nARCH=X86 ... | python | chosen |
[
{
"from": "human",
"value": "Add error messenger via DM\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n# This file provides exactly one method: send_error_message\n# If the setup.ERROR_MESSAGE_RECIPIENT_SCREEN_NAME is not set to None,\n# an error message should be sent to the recipie... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert from ical to csv\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis file is an exmaple for running the conversion script\n\"\"\"\n\nfrom datetime import datetime, timedelta\nimport sys\n\nsys.path.append('.')\nsys.path.append('../')\n\nfrom convert i... | python | chosen |
[
{
"from": "human",
"value": "examples/hwapi: Add hwconfig for console tracing of LED operations.\n"
},
{
"from": "gpt",
"value": "# This is hwconfig for \"emulation\" for cases when there's no real hardware.\n# It just prints information to console.\nclass LEDClass:\n\n def __init__(self, id)... | python | chosen |
[
{
"from": "human",
"value": "Add SNS example file with case: create a topic and publish message to it\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nfrom tornado.ioloop import IOLoop\nfrom tornado.gen import coroutine\nfrom asyncaws import SNS\n\nioloop = IOLoop.current()\naws_key_id = ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for extended_app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('extende... | python | chosen |
[
{
"from": "human",
"value": "Update Urdu transliteration from Hindi\n\n- Adds 0130_copy_hindi_transliteration_to_urdu.py which was requested\n by @cormacanderson\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Inspired by:\n# https://github.com/lingdb/CoBL/issues/223#issuecomment-25... | python | chosen |
[
{
"from": "human",
"value": "Add file containing small, common obo tasks.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tasks for GOTerms in obo dag.\"\"\"\n\ndef get_all_parents(go_objs):\n \"\"\"Return a set containing all GO Term parents of multiple GOTerm objects.\"\"\"\n go_parents = set()\n... | python | chosen |
[
{
"from": "system",
"value": "Change logging format. To be compatible with nailgun web ui\n\nChange-Id: I2e8bfe32bbb1b8f48e5ab0a418ab9592cc00adc3\n"
},
{
"from": "human",
"value": "# Copyright 2013 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you m... | python | chosen |
[
{
"from": "human",
"value": "TST: Add test for missing data in DataFrame\n"
},
{
"from": "gpt",
"value": "import pandas\nimport numpy as np\n\nfrom scikits.statsmodels.tools import data\n\ndef test_missing_data_pandas():\n \"\"\"\n Fixes GH: #144\n \"\"\"\n X = np.random.random((10,5... | python | chosen |
[
{
"from": "human",
"value": "Add USB VCP example script.\n"
},
{
"from": "gpt",
"value": "# USB VCP example.\n# This example shows how to use the USB VCP class to send an image to PC on demand.\n#\n# WARNING:\n# This script should NOT be run from the IDE or command line, it should be saved as ma... | python | chosen |
[
{
"from": "human",
"value": "Add CLI for joining lines to polygons\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom __future__ import print_function\n\nfrom stompy.spatial import join_features\nfrom optparse import OptionParser\n\ntry:\n from osgeo import ogr\nexcept ImportError:\... | python | chosen |
[
{
"from": "human",
"value": "Add test for lwaftr's generate-binding-table subcommand\n\nThis adds a test which runs the generate-binding-table command and\nverifies that it exits with a 0 status code and produces the expected\noutput for the command line parameters.\n\nIt doesn't check the contents of the b... | python | chosen |
[
{
"from": "human",
"value": "Add migration to fix http 500 errors\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.4 on 2017-08-03 19:38\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migrat... | python | chosen |
[
{
"from": "human",
"value": "Add Ensembl Compara django model\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCopyright [2009-2019] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.... | python | chosen |
[
{
"from": "human",
"value": "Add Instance cache dump/load tests\n"
},
{
"from": "gpt",
"value": "from boosh.ssh import Instance\n\n\ndef test_cache_dump():\n src_instance = Instance(\n id='i-10ca9425',\n profile_name='testing',\n region='us-west-1',\n private_ip_ad... | python | chosen |
[
{
"from": "human",
"value": "Add test structure for clustering algorithms\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTesting clustering algorithms in Clusterpy\n** All the following tests take considerable time to complete **\n\"\"\"\n\nfrom unittest import TestCase\n\nclass TestClusteringAlgorith... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add post publication trigger\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\ndef up(cursor):\n cursor.execute(\"\"\"\\\nCREATE OR REPLACE FUNCTION post_publication() RETURNS trigger AS $$\nBEGIN\n NOTIFY post_publication;\n RETURN ... | python | chosen |
[
{
"from": "human",
"value": "Add example file for running cloud-harness tasks.\n"
},
{
"from": "gpt",
"value": "import json\nimport os\n# from osgeo import gdal\n\nfrom gbdxtools import Interface\nfrom task_template import TaskTemplate, Task, InputPort, OutputPort\n\n\ngbdx = Interface()\n\n# da... | python | chosen |
[
{
"from": "human",
"value": "Add test for the root url\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.5\n#\n# Copyright 2010 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 random X-Forwarded-For to bypass IP Ban.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nCopyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)\nSee the file 'doc/COPYING' for copying permission\n\"\"\"\n\nfrom lib.core.enums import PRIO... | python | chosen |
[
{
"from": "human",
"value": "Add a basic CountyForm for allowing the visitor to select from a list of Oregon counties.\n"
},
{
"from": "gpt",
"value": "from django import forms\n\nfrom olcc.models import Store\n\nCOUNTIES = (\n (u'baker', u'Baker'),\n (u'benton', u'Benton'),\n (u'clacka... | python | chosen |
[
{
"from": "human",
"value": "Add 'old style' test for game client\n"
},
{
"from": "gpt",
"value": "from mock import Mock\nfrom nose.tools import *\nfrom nose.plugins.attrib import attr\n\nimport pybomb\nfrom pybomb.response import Response\nfrom pybomb.clients.game_client import GameClient\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add test for wake losses\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nimport numpy as np\nimport pytest\nfrom pandas.util.testing import assert_series_equal\n\nfrom windpowerlib.wake_losses import reduce_wind_speed, get_wind_efficiency_curve, display_wind_e... | python | chosen |
[
{
"from": "human",
"value": "Add a little test for queue speed.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\"\"\"How fast is the queue implementation?\"\"\"\n\nimport time\nimport asyncio\nprint(asyncio)\n\nN_CONSUMERS = 10\nN_PRODUCERS = 1\nN_ITEMS = 100000 # Per producer\nQ_SIZE... | python | chosen |
[
{
"from": "human",
"value": "Save users' followers into file\n"
},
{
"from": "gpt",
"value": "\"\"\"\n instabot example\n\n Workflow:\n Save users' followers into a file.\n\n\"\"\"\n\n\nimport argparse\nimport os\nimport sys\n\nfrom tqdm import tqdm\n\nsys.path.append(os.path.join(s... | python | chosen |
[
{
"from": "human",
"value": "Add a simple demo for showing the features of the Component class.\n"
},
{
"from": "gpt",
"value": "from __future__ import with_statement\n\nfrom enthought.enable.api import Component, ComponentEditor\nfrom enthought.traits.api import HasTraits, Instance\nfrom enthou... | python | chosen |
[
{
"from": "human",
"value": "Add code taking advantage of binary numbers\n"
},
{
"from": "gpt",
"value": "# Python 2 \r\n\r\n# Enter your code here. Read input from STDIN. Print output to STDOUT\r\n\r\n# Observation: If you factor 9 from 9, 90, 99, 900, 909, 990, 999, ...\r\n# you ge the binary ... | python | chosen |
[
{
"from": "human",
"value": "Add command to export db\n"
},
{
"from": "gpt",
"value": "import click\n\nfrom ..cli import cli_command\nfrom ..stacks import StackPlan\nfrom ..syncdata import RDS, RDSPostgresClient\n\n\n@cli_command('syncdata', max_apps=0)\ndef syncdata_cmd(ctx):\n plan = StackP... | python | chosen |
[
{
"from": "human",
"value": "Add restore endpoint.. was missing for some reason\n"
},
{
"from": "gpt",
"value": "import urlparse\nimport os, sys\nimport json\ntools_dir = os.environ.get('TOOLSDIR')\nlib_path = os.path.abspath(tools_dir)\nsys.path.append(lib_path)\nfrom msc_apps import *\n\ndata_... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights palindrome rearranging problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Palindrome Rearranging Problem\n\n\ndef palindromeRearranging(inputString):\n from collections import Counter\n is_even_len = len(inputStrin... | python | chosen |
[
{
"from": "human",
"value": "Add a simple 2/2 twill draft generator\n"
},
{
"from": "gpt",
"value": "from . import Draft, Thread\n\n\ndef twill():\n # just generates 2/2 twill for now\n\n # we'll need 4 shafts and 4 treadles\n draft = Draft(num_shafts=4, num_treadles=4)\n\n # do tie-... | python | chosen |
[
{
"from": "human",
"value": "Create main challenge file with proble statement and i/o expectations\n"
},
{
"from": "gpt",
"value": "\"\"\"\nProblem Statement:\nGiven an array of integers, calculate which fraction of the elements are positive, negative, and zeroes, respectively. Print the decimal... | python | chosen |
[
{
"from": "human",
"value": "Add test for bulk email optout mgmt cmd.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest the test_bulk_user_org_email_optout management command\n\"\"\"\nimport os\nimport tempfile\nfrom contextlib import contextmanager\nimport mock\nimport pytest\n\nfrom django.core.ma... | python | chosen |
[
{
"from": "human",
"value": "Add basic test suite for SimulatedContentTypeManager\n"
},
{
"from": "gpt",
"value": "# SYSTEM\nfrom __future__ import absolute_import\n\n# LIBRARIES\nfrom django.db import models\nfrom django.test import TestCase\nfrom django.contrib.contenttypes.models import Conte... | python | chosen |
[
{
"from": "human",
"value": "Add some basic cost functions (L1 & L2 norms)\n"
},
{
"from": "gpt",
"value": "\"\"\"\na set of cost functions for Neural Network layers.\n\"\"\"\n\nimport theano.tensor as T\n\nl1_norm(w):\n\t\"\"\"\n\tReturns L1 norm of the given matrix (w).\n\tL1 norm is simply su... | python | chosen |
[
{
"from": "human",
"value": "Add esp8266 ADC sensor client example\n"
},
{
"from": "gpt",
"value": "# Main program for ESP8266 to sample a potentiometer sensor and send sensor\n# events to an MQTT broker.\n\n# Configuration is stored in a separate config.py\nfrom config import SENSOR_ID, WIFI_ES... | python | chosen |
[
{
"from": "human",
"value": "Add migration for adding published column in project\n"
},
{
"from": "gpt",
"value": "\"\"\"Add published column to project\n\nRevision ID: 3a98a6674cb2\nRevises: 35f8b948e98d\nCreate Date: 2015-08-07 10:24:31.558995\n\n\"\"\"\n\n# revision identifiers, used by Alemb... | python | chosen |
[
{
"from": "human",
"value": "Add blank=True to external account and Institution so that permissions can be sucessfully added in the admin's admin interface\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-02-02 15:43\nfrom __future__ import unicode_lite... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of CORE API handler.\n\nThis uses the CORE v2 API to get the number of open access articles with\nthe given software identifier mentioned in the full text.\n\nCurrently the maximum returned is 100, since the v2 API doesn't return\nthe total number of search r... | python | chosen |
[
{
"from": "system",
"value": "Remove import of non-existing file.\n"
},
{
"from": "human",
"value": "\"\"\"\nDefinition of urls for $safeprojectname$.\n\"\"\"\n\nfrom django.conf.urls import include, url\n\nimport $safeprojectname$.views\n\n# Uncomment the next two lines to enable the admin:\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking whether data files have valid JSON syntax\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport json\nfrom glob import glob\nfrom os.path import relpath, abspath, dirname\nfrom pathlib import Path\n\nBASE_DIR = str(Path... | python | chosen |
[
{
"from": "human",
"value": "Add column for property subtype\n\nAdd column 'subproperty' into fulltext_record_properties table\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\"\"\"\nAdd 'subprop... | python | chosen |
[
{
"from": "human",
"value": "Add ability to get and display Jisho.org results\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport sys\nfrom workflow import Workflow, web, ICON_WEB\n\nAPI_URL = 'http://jisho.org/api/v1/search/words'\nSEP_COMMA = u'、 ' # Separator... | python | chosen |
[
{
"from": "human",
"value": "[vigir_ltl_specification] Add module for task-specific specs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport pprint\n\nimport preconditions as precond\nfrom gr1_specification import GR1Specification\nfrom gr1_formulas import GR1Formula, Fa... | python | chosen |
[
{
"from": "human",
"value": "Package control APIs for installing/removing.\n"
},
{
"from": "gpt",
"value": "import sys\n\n\npackage_name = 'My Package'\n\n\ndef plugin_loaded():\n from package_control import events\n\n if events.install(package_name):\n print('Installed %s!' % event... | python | chosen |
[
{
"from": "human",
"value": "Add python helper to add new post\n"
},
{
"from": "gpt",
"value": "import argparse, datetime, unicodedata, re\n\ndef slugify(value):\n \"\"\"\n Converts to lowercase, removes non-word characters (alphanumerics and\n underscores) and converts spaces to hyphen... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for object_controls -> relationships\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: anze@re... | python | chosen |
[
{
"from": "human",
"value": "Add new message which checks whether an object exists\n"
},
{
"from": "gpt",
"value": "# stdlib\nfrom typing import Any\nfrom typing import Optional\n\n# third party\nfrom nacl.signing import VerifyKey\n\n# relative\nfrom ... import UID\nfrom ....abstract.node import... | python | chosen |
[
{
"from": "human",
"value": "Add script to process a jsontree (this will soon parse with esprima).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Process a JSON file tree.\"\"\"\n\nimport os\nimport json\nimport logging\nimport sys\n\ndef main():\n logging.basicConfig(level=log... | python | chosen |
[
{
"from": "human",
"value": "Add tool to convert zasm .lst to az80 .prn for simualtor symbols\n"
},
{
"from": "gpt",
"value": "#!python\n\nimport sys\n\nprint '\f',\n\nprint_labels = False\n\nfor line in sys.stdin:\n if line.strip() == \"; +++ global symbols +++\":\n break;\n\ndummy = ... | python | chosen |
[
{
"from": "human",
"value": "Add utility to set GCS JSON metadata\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 Google LLC\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 t... | python | chosen |
[
{
"from": "human",
"value": "Add a test for file hashing\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom photoshell import util\n\n\ndef test_hash_file(tmpdir):\n tmpdir.join('file.test').write(\"Test\")\n assert (util.hash_file(os.path.join(tmpdir.strpath, 'file.test')) ==\n ... | python | chosen |
[
{
"from": "human",
"value": "Test alternate encodings when dumping and loading\n"
},
{
"from": "gpt",
"value": "import redisdl\nimport unittest\nimport json\nimport os.path\nfrom . import util\n\nclass RedisdlTest(unittest.TestCase):\n def setUp(self):\n import redis\n self.r = ... | python | chosen |
[
{
"from": "human",
"value": "Test - add commands test folder, first test - update command\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 0xc0170\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 m... | python | chosen |
[
{
"from": "human",
"value": "Add tests for nx backend\n"
},
{
"from": "gpt",
"value": "import os, sys\nimport numpy as np\nfrom numpy.testing import assert_equal, assert_almost_equal\nfrom skan import nx\n\nrundir = os.path.dirname(os.path.abspath(__file__))\nsys.path.append(rundir)\n\nfrom skan... | python | chosen |
[
{
"from": "human",
"value": "Add a test for invalid PUTs which do not have a valid auth_token\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom opentreetesting import test_http_json_method, config\nimport datetime\nimport codecs\nimport json\nimport sys\nimport os\n\n# this makes it e... | python | chosen |
[
{
"from": "human",
"value": "Add new example with maginc mock\n"
},
{
"from": "gpt",
"value": "from mock import MagicMock\nfrom calculator import Calculator\n\nthing = Calculator()\nthing.mymethod = MagicMock(return_value = {'x':'X'})\nthing.mymethod(1,2,3,4,5,6,7,8,9,0, k='val')\n\nthing.mymeth... | python | chosen |
[
{
"from": "human",
"value": "Write unit tests for scalar and vector classes\n"
},
{
"from": "gpt",
"value": "\"\"\"Unit tests for the pymt.framwork.bmi_ugrid module.\"\"\"\nimport numpy as np\nimport xarray as xr\n\nfrom pymt.framework.bmi_ugrid import Scalar, Vector\nfrom pymt.framework.bmi_bri... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.