conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add py solution for 438. Find All Anagrams in a String\n\n438. Find All Anagrams in a String: https://leetcode.com/problems/find-all-anagrams-in-a-string/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findAnagrams(self, s, p):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Test dimension perserving for persistence.\n"
},
{
"from": "gpt",
"value": "import os.path\nimport shutil\nimport numpy as np\nimport blaze as blz\n\ndef test_perserve():\n shape = (3,4)\n arr = np.ones(shape)\n\n dshape = \"%s,%s, float64\" % (shape[0], sha... | python | chosen |
[
{
"from": "human",
"value": "Add module for hadoop execution\n"
},
{
"from": "gpt",
"value": "import threading, subprocess\n\nhostname = \"star@192.168.122.10\"\n\ndef start_hadoop(path, args, callback):\n command = [\"ssh\", hostname, \"hadoop\", \"jar\", path]\n command.extend(args)\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for outputting translations as CSV\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport yaml\nimport yaml.constructor\n\ntry:\n # included in standard lib from Python 2.7\n from collections import OrderedDict\nexcept ImportError:\n # t... | python | chosen |
[
{
"from": "human",
"value": "Add in setup application file to handle the app setup so that it can be used with browser testing as well\n"
},
{
"from": "gpt",
"value": "from flask import Flask, g\nfrom inspect import getmembers, isfunction\nfrom happymongo import HapPyMongo\nfrom config import co... | python | chosen |
[
{
"from": "system",
"value": "Remove redirect_invalid_to option and use settings.LOGIN_URL instead.\nWhen redirect the user, also forward the next parameter.\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nfrom django.http import HttpResponse, HttpResponseRedirect, HttpRespon... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the threading mechanism\n"
},
{
"from": "gpt",
"value": "import threading\n\ndef affiche(nb, nom = ''):\n for i in range(nb): print nom, i\n\na = threading.Thread(None, affiche, None, (200,), {'nom':'thread a'})\nb = threading.Thread(None, affiche, ... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for cmath module.\n"
},
{
"from": "gpt",
"value": "# test the functions imported from cmath\n\ntry:\n from cmath import *\nexcept ImportError:\n print(\"SKIP\")\n import sys\n sys.exit()\n\n# make sure these constants exist in cmath\nprint... | python | chosen |
[
{
"from": "human",
"value": "Reset the emisson state as well\n\nSimilar to 96eff63790e28741f45f0875fe888687b803eb6e but for emission users.\nIdeally this should only include the analysis_db, but we need the pipeline\ninfo, and Josh created two extra collections for the common trips and common\nplaces.\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add qiprofile imaging sync test case.\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom mongoengine import connect\nfrom nose.tools import assert_equal\nfrom qiprofile_rest_client.model.subject import Subject\nfrom qipipe.qiprofile import imaging\n... | python | chosen |
[
{
"from": "human",
"value": "Add first tests for PurchasingProfileBuilder and stubs for PurchasingProfileGenerator and ProductCategoryMarkovModelGenerator\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom algorithms.markovmodel import MarkovModel\nfrom algorithms.markovmodel import Markov... | python | chosen |
[
{
"from": "human",
"value": "Add script file reading csv sc files writing to db\n"
},
{
"from": "gpt",
"value": "from db import LinearTransformer, Source, Sink, Scenario, Storage, session\nimport pandas as pd\n\n\ndef asfloat(x):\n try:\n # do not convert boolean\n return float(... | python | chosen |
[
{
"from": "human",
"value": "Add drop hints script from Noto\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#\n# Copyright 2014 Google Inc. All rights reserved.\n# Copyright 2021 The Google Font Tools Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# yo... | python | chosen |
[
{
"from": "system",
"value": "[SD-4784] Remove take key validator macro\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8; -*-\n#\n# This file is part of Superdesk.\n#\n# Copyright 2013, 2014 Sourcefabric z.u. and contributors.\n#\n# For the full copyright and license information, please se... | python | chosen |
[
{
"from": "human",
"value": "Add migration to delete hanging bundle auths\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\ndef delete_hanging_bundle_auths(apps, schema_editor):\n Authorization = apps.get_model(\"users\", \"Authorization\")\n Authorization.objects.filt... | python | chosen |
[
{
"from": "human",
"value": "Add script to migrate relative disk paths to absolute\n\nPreviously disk paths were relative to BETTY_IMAGE_ROOT/MEDIA_ROOT, now they absolute.\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nimport os.path\n\nfrom betty.conf.app import settings\nf... | python | chosen |
[
{
"from": "human",
"value": "Add an example script for using the REST API to get the 20 of a users' friends and their latest status.\n\nSigned-off-by: Robert Dempsey <715b5a941e732be1613fdd9d94dfd8e50c02b187@gmail.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\n... | python | chosen |
[
{
"from": "human",
"value": "Convert literate coffeescript in to regular coffeescript\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python -w\n\nimport itertools, re\n\ndef print_docs(docs_, outfp):\n '''print out docs, skipping the hashes for leading/trailing blanks'''\n blank = re.comp... | python | chosen |
[
{
"from": "human",
"value": "Add timeout test (packet drop scenario.)\n"
},
{
"from": "gpt",
"value": "import mpipe\nimport time\n\ndef echo(value):\n time.sleep(0.125)\n print(value)\n return True\n\npipe2 = mpipe.Pipeline(mpipe.OrderedStage(echo))\n\nclass Filter(mpipe.OrderedWorker):... | python | chosen |
[
{
"from": "human",
"value": "Add tests for entity->biluo transformation\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\nfrom ...gold import biluo_tags_from_offsets\nfrom ...vocab import Vocab\nfrom ...tokens.doc import Doc\n\nimport pytest\n\n\n@pytest.fixture\ndef vo... | python | chosen |
[
{
"from": "human",
"value": "feat: Add a script which contains a function that takes a string with street name as an argument and should return the fixed name\n"
},
{
"from": "gpt",
"value": "\"\"\"\nYour task in this exercise has two steps:\n\n- audit the OSMFILE and change the variable 'mappin... | python | chosen |
[
{
"from": "human",
"value": "Add simplified 1-99 example, extracted from number_words.py\n"
},
{
"from": "gpt",
"value": "#\n# one_to_ninety_nine.py\n#\n# Copyright 2021, Paul McGuire\n#\n# Parser/evaluator for expressions of numbers as written out in words:\n# - one\n# - seven\n# - twelve\n#... | python | chosen |
[
{
"from": "human",
"value": "Add n9k IP iptables block\n\nChange-Id: Ife7168aebd5de6d017c48d3d7b6b1a0227c25f7c\n"
},
{
"from": "gpt",
"value": "def start(context, log, args):\n import time\n\n duration = args['duration']\n period = 20\n\n n9k1_ip, n9k2_ip, _, _ = context.n9k_creds()\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for rest api\n"
},
{
"from": "gpt",
"value": "from rest_framework.test import APITestCase\n\ndef has(d, key):\n if d.get(key) is not None:\n return True\n else:\n return False\n\n\nclass TestApi(APITestCase):\n def test_root(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add management command to generate SQL constraints for SHARE versioning\n"
},
{
"from": "gpt",
"value": "from django.apps import apps\nfrom django.core.management.base import BaseCommand\nfrom django.db.migrations import Migration\nfrom django.db.migrations import op... | python | chosen |
[
{
"from": "human",
"value": "Create TPR when watching it and not present in cluster yet\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8\nfrom __future__ import absolute_import\n\nimport six\n\nfrom .common import ObjectMeta\nfrom ..base import Model\nfrom ..fields imp... | python | chosen |
[
{
"from": "human",
"value": "Add wrapper functions for youtube-dl\n"
},
{
"from": "gpt",
"value": "# vim: fileencoding=utf-8\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport sys\nimport re\nimport subprocess as sp\nfrom collections import namedtuple\nim... | python | chosen |
[
{
"from": "human",
"value": "Add script for finding tests with explicit ana.activated\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nfrom pathlib import Path\nimport re\nimport shlex\nimport json\n\n\ntests_root_path = Path(\"./tests/regression\")\n\n# copied from options\nactivated_defa... | python | chosen |
[
{
"from": "human",
"value": "Add ExceptionLoggingMiddleware: Useful for debugging.\n"
},
{
"from": "gpt",
"value": "class ExceptionLoggingMiddleware(object):\n \"\"\"\n Small middleware that logs exceptions to the console. Useful in local\n development.\n \"\"\"\n def process_exce... | python | chosen |
[
{
"from": "human",
"value": "Add a little script to register a list of pods\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n## Utils script to call a list of pods\n\nimport subprocess\n\npods = open('/tmp/pods.txt', 'r')\nfor pod in pods:\n print pod.strip('\\n\\r')\n subprocess.call('... | python | chosen |
[
{
"from": "human",
"value": "Add Point class based on GEOS package\n"
},
{
"from": "gpt",
"value": "class Point(object):\n\n def __init__(self, x, y=None):\n \"\"\"\n The Point object may be initialized with either a tuple, or individual\n parameters.\n\n For Examp... | python | chosen |
[
{
"from": "human",
"value": "Add a test script for GPIOs\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as GPIO\n\nclass Test:\n\n # Mapping\n PINS = {2,3,4,14,15,17,18,27,22,23,24,10,9,25,11,8,7,5,6,12,13,19,16,26,20,21}\n\n def __init__(self):\n\n ## Attach a callback to each INPUT pi... | python | chosen |
[
{
"from": "human",
"value": "Add a script to run all of the programs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nfrom __future__ import print_function, unicode_literals\nfrom os import chdir, getcwd, getenv\nfrom subprocess import call\n\nPYTHON = getenv('PYTHON', 'python')\nFC = getenv(... | python | chosen |
[
{
"from": "human",
"value": "Add simple Python GUI to control volume.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom gi.repository import Gtk, GObject\nimport socket, os, sys\n\nclass Connection:\n def __init__(self, sock):\n self.sock = socket.socket(socket.AF_UNIX, socke... | python | chosen |
[
{
"from": "human",
"value": "Add a fixture that yields a requests Mocker() object.\n"
},
{
"from": "gpt",
"value": "\"\"\"Configuration module for pytests\"\"\"\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ impor... | python | chosen |
[
{
"from": "human",
"value": "Solve TDA Rational in python\n"
},
{
"from": "gpt",
"value": "import sys\n\nn = int(sys.stdin.readline())\n\nfor _ in range(n):\n a, _, b, o, c, _, d = sys.stdin.readline().split()\n a, b, c, d = map(int, [a, b, c, d])\n\n if o == \"+\":\n num = (b * ... | python | chosen |
[
{
"from": "human",
"value": "Add Migration For Office Hours Locations\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2018-04-10 20:18\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mi... | python | chosen |
[
{
"from": "human",
"value": "Create tests for tag parsing\n"
},
{
"from": "gpt",
"value": "\r\nfrom io import BytesIO\r\n\r\nimport pytest\r\n\r\nfrom nbtlib.tag import *\r\n\r\n\r\ntag_parsing_inputs = [\r\n\r\n # Byte tag\r\n (b'\\x00', Byte(0)),\r\n (b'\\xFF', Byte(-1)),\r\n (b'\\... | python | chosen |
[
{
"from": "human",
"value": "Add a script to search EC2 instances by instance ID\n"
},
{
"from": "gpt",
"value": "import sys\nimport json\nfrom subprocess import check_output\n\nfrom xml.etree import ElementTree\nfrom xml.etree.ElementTree import Element, tostring\nfrom xml.dom import minidom\n\... | python | chosen |
[
{
"from": "human",
"value": "Add partial backport of Python 3's open() interface\n"
},
{
"from": "gpt",
"value": "class open(object):\n \"\"\"Wrapper providing key part of Python 3 open() interface.\n\n From IPython's py3compat.py module. License: BSD.\n \"\"\"\n def __init__(self, f... | python | chosen |
[
{
"from": "human",
"value": "Add an example script to demonstrate a run with pure Python\n"
},
{
"from": "gpt",
"value": "\"\"\" The main purpose of this file is to demonstrate running SeleniumBase\n scripts without the use of Pytest by calling the script directly\n with Python or from a P... | python | chosen |
[
{
"from": "human",
"value": "Add a class for representing changes to GameState.\n"
},
{
"from": "gpt",
"value": "from abc import ABCMeta, abstractmethod\n\nclass GameStateChange(object):\n __metaclass__ = ABCMeta\n\n @abstractmethod\n def apply(self, gameState):\n pass\n\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add negative API tests for profile validation\n\nAdd negative API tests for profile validation\n\nChange-Id: I3ad3c9d891c857d9c6cfc08dcee2e3762d566115\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not ... | python | chosen |
[
{
"from": "human",
"value": "Add solution to transcribing DNA into RNA\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAn RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'.\n\nGiven a DNA string t corresponding to a coding strand, its transcribed RNA string u is formed b... | python | chosen |
[
{
"from": "human",
"value": "Add python program for find first occurance of k\n"
},
{
"from": "gpt",
"value": "\"\"\"\n== Given a sorted list, find the first occurance of k ==\n\"\"\"\n\ndef find_first(l, k):\n \"\"\" Assumes that 'l' is a list of integars and is sorted \"\"\"\n\n # Input ... | python | chosen |
[
{
"from": "human",
"value": "Remove unused page/parent fields from Articles\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.7 on 2019-03-07 02:05\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependenci... | python | chosen |
[
{
"from": "human",
"value": "Add BlobDB format definitions for AppGlanceSlice and AppGlance\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n__author__ = 'katharine'\n\n\"\"\"\nThis file is special in that it actually contains definitions of\nblobdb blob formats rather th... | python | chosen |
[
{
"from": "human",
"value": "Add Field default init test\n"
},
{
"from": "gpt",
"value": "\"\"\" \nUnit tests for the field module.\n\nThomas Ogden <t@ogden.eu>\n\n\"\"\"\n\nimport unittest\n\nfrom maxwellbloch import field\n\nclass TestInit(unittest.TestCase):\n\n def test_init_default(self)... | python | chosen |
[
{
"from": "human",
"value": "Add merge migration for GDPR\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-05-25 20:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Add helper script to convert all corpora from the relannis/ folder to the data/ folder\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport os\nfrom subprocess import call;\n\nfor d in os.listdir('relannis/'):\n print(\"Checking \" + d)\n if(os.pat... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the password reset emails\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase, override_settings\nfrom django.core import mail\n\nfrom wagtail.tests.utils import WagtailTestUtils\nfrom wagtail.wagtailcore.models import Site\n\n\nclass Test... | python | chosen |
[
{
"from": "human",
"value": "Add decorator to apply normalization\n"
},
{
"from": "gpt",
"value": "\"\"\"Decorators for neurodsp.sim.\"\"\"\n\nfrom functools import wraps\n\nfrom neurodsp.sim.utils import demean, normalize_variance\n\n#############################################################... | python | chosen |
[
{
"from": "human",
"value": "Add module for quick plotting of bmi values.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\nimport matplotlib.pyplot as plt\n\n\ndef quick_plot(bmi, name, **kwds):\n gid = bmi.get_var_grid(name)\n gtype = bmi.get_grid_type(gid)\n grid = bmi.grid[gi... | python | chosen |
[
{
"from": "human",
"value": "Add test for python editor.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport os\nimport sys\n\nfrom traits.testing.unittest_tools import unittest, UnittestTools\n\nfrom ..gui import GUI\nfrom ..python_editor import PythonEditor\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for crypto endpoints\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Tests for `tiingo` package.\"\"\"\n\nfrom unittest import TestCase\n\nfrom tiingo import TiingoClient\n\n\n# CRYPTO ENDPOINTS\nclass TestCryptoEndpoints(TestCase):\n\n def... | python | chosen |
[
{
"from": "human",
"value": "Add a Round Carrier board file to the RP2040 Stamp build\n"
},
{
"from": "gpt",
"value": "from board import *\nimport busio\n\n\n_SPI = None\n_UART = None\n_I2C = None\n\n\nD0 = GP0\nSDA = D0\nD1 = GP1\nSCL = D1\nD8 = GP8\nCIPO = D8\nMISO = D8\nD9 = GP9\nCS = D9\nD10... | python | chosen |
[
{
"from": "human",
"value": "Add a script to generate data for helping development.\n"
},
{
"from": "gpt",
"value": "''' Generate image and ground truth from the scene, for development purpose '''\n\nfrom unrealcv import client\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndef read_png... | python | chosen |
[
{
"from": "system",
"value": "Remove non-existing field from WeightBasedForm\n\nDjango 1.10 errors (correctly) on this\n"
},
{
"from": "human",
"value": "from django import forms\n\nfrom oscar.core.loading import get_model\n\n\nclass WeightBasedForm(forms.ModelForm):\n\n class Meta:\n ... | python | chosen |
[
{
"from": "human",
"value": "feat(logging): Add a more complex example\n\nThis example shows how to use multiple loggers, multiple output\ndestinations and filters.\n"
},
{
"from": "gpt",
"value": "import logging\n\nclass MyFilter(object):\n\n def __init__(self, level):\n self.__level ... | python | chosen |
[
{
"from": "human",
"value": "Test Collection.list_indexes with multiple batches.\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 MongoDB, 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 ... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for ModelBackend\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom django_backend.backend.base.backends import ModelBackend\nfrom django_backend.sitebackend import SiteBackend\n\nfrom .models import OneFieldModel\n\n\nclass Mod... | python | chosen |
[
{
"from": "human",
"value": "Add index on etablissements email for quick scam cleanup performance\n"
},
{
"from": "gpt",
"value": "\"\"\"\nadd index on etablissements email\n\nRevision ID: 99473cb51564\nRevises: 200d176f96b6\nCreate Date: 2018-11-30 15:38:57.294679\n\"\"\"\nfrom alembic import o... | python | chosen |
[
{
"from": "human",
"value": "Remove service.postage and choose_postage permission from database\n\nAlso change constraint on template postage so it cannot be null for\nletters\n\nAlso add postage to all letters in template_history to respect new constraint\n"
},
{
"from": "gpt",
"value": "\"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add script to make images file"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n'''\n ====================================================================\n Copyright (c) 2003-2016 Barry A Scott. All rights reserved.\n\n This software is licensed as described ... | python | chosen |
[
{
"from": "human",
"value": "Add AuthTokens table migration file.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add `AuthTokens` table.\n\nRevision ID: cf6ed76ef146\nRevises: 8da7405903f6\nCreate Date: 2020-09-10 17:13:40.407017\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision... | python | chosen |
[
{
"from": "human",
"value": "Add script for asimov MC analysis.\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport copy\nfrom fermipy.gtanalysis import GTAnalysis\nfrom haloanalysis.fit_funcs import fit_halo\n\nimport numpy as np\nimport itertools\nimport argparse\nimport yaml\n\nif ... | python | chosen |
[
{
"from": "human",
"value": "Add a Python json benchmark.\n\nAlas, it's about 3x faster than us, due to being written in C.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport json, sys, time\n\ncount = int(sys.argv[1])\n\nfor n in sys.argv[2:]:\n print '%s:' % n\n start = tim... | python | chosen |
[
{
"from": "human",
"value": "Add a test for an invalid merge\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom opentreetesting import test_http_json_method, config\nimport sys\n\nDOMAIN = config('host', 'apihost')\nSUBMIT_URI = DOMAIN + '/merge/v1/master/master'\n\ndata = {\n ... | python | chosen |
[
{
"from": "human",
"value": "Add YAML & JSON Read script\n"
},
{
"from": "gpt",
"value": "\n\nimport yaml\nimport json\n\nfrom pprint import pprint\n\ndef output_format(my_list, my_str):\n '''\n Make the output easier to read\n '''\n print '\\n\\n'\n print '#'*3\n print '#'*3+m... | python | chosen |
[
{
"from": "human",
"value": "Add a ImgurAPI simple interface\n\nThis is just an interface that performs RESTful operations to the Imgur\nAPI.\n"
},
{
"from": "gpt",
"value": "from models.image import Image\nfrom utils.utils import tidy_up_url\n\n\nclass ImgurAPI:\n _IMGUR_PARAMS = {\n ... | python | chosen |
[
{
"from": "human",
"value": "Update comment maxlength to 1000 characters\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.7 on 2017-12-07 19:31\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport osf.models.validators\n... | python | chosen |
[
{
"from": "human",
"value": "Add the script for generating\n\nthe legal info for the Maven dependencies\n"
},
{
"from": "gpt",
"value": "#\n# This script generates the license information of the Maven dependencies\n# for the about.html page. You would update this information everytime you\n# upd... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add a simple selection example.\n"
},
{
"from": "gpt",
"value": "from vtk import *\n\nfrom vtk import *\n\nsource = vtkRandomGraphSource()\nsource.SetNumberOfVertices(25)\nsource.SetStartWithTree(True)\nsource.SetIncludeEdgeWeights(True)\n\nview1 = vtkGraphLayo... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for ccm cli\n"
},
{
"from": "gpt",
"value": "from . import TEST_DIR\nfrom . import ccmtest\nfrom ccmlib.cluster import Cluster\nimport subprocess\nfrom six import print_\n\nCLUSTER_PATH = TEST_DIR\n\n\nclass TestCCMCmd(ccmtest.Tester):\n\n def __... | python | chosen |
[
{
"from": "human",
"value": "Add a new decorator: commit_on_http_success.\n"
},
{
"from": "gpt",
"value": "from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed\nfrom django.db import DEFAULT_DB_ALIAS\nfrom django.http i... | python | chosen |
[
{
"from": "human",
"value": "Add migrations to fix reimported blocked contacts\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.db.models import Count, Q\n\n\ndef unblock_contacts_imported_a... | python | chosen |
[
{
"from": "human",
"value": "Add calc area of shapes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\ndef main():\n shape = input()\n if shape == 'прямоугольник':\n a, b = int(input()), int(input())\n print('{}'.format(a * b))\n if shape == 'треугольник':\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test runner script for integration with the waterfall\n\nR=mark@chromium.org\n\nReview URL: https://codereview.chromium.org/800983002\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2014 The Crashpad Authors. All rights reserved.\n#\n# Licen... | python | chosen |
[
{
"from": "human",
"value": "Add test for object-based conversions between various stellar model formats, including via other formats\n"
},
{
"from": "gpt",
"value": "from tomso.adipls import load_amdl\nfrom tomso.fgong import load_fgong\nfrom tomso.gyre import load_gyre\nfrom math import frexp\... | python | chosen |
[
{
"from": "human",
"value": "Add test case for geolocation.\n"
},
{
"from": "gpt",
"value": "from . import TheInternetTestCase\nfrom helium.api import click, get_driver, S\n\nclass AbTestingTest(TheInternetTestCase):\n\tdef get_page(self):\n\t\treturn \"http://the-internet.herokuapp.com/geolocat... | python | chosen |
[
{
"from": "human",
"value": "Test AutoML usage of Backend to load models\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\nfrom __future__ import print_function\nimport unittest\nimport mock\nfrom autosklearn.automl import AutoML\nfrom autosklearn.util.backend import Backend\n\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add client grant to db choices\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.24 on 2021-11-24 19:31\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('motech', '0009_auto_20211122_20... | python | chosen |
[
{
"from": "human",
"value": "Add utilities for checking inputs\n\nThese functions all uses a consistent style of error reporting, which\nwill be used throughout drudge.\n"
},
{
"from": "gpt",
"value": "\"\"\"Small utilities.\"\"\"\n\nfrom collections.abc import Sequence\n\nfrom sympy import symp... | python | chosen |
[
{
"from": "human",
"value": "Add plot for trial durations, needs more work!\n"
},
{
"from": "gpt",
"value": "import climate\nimport collections\nimport lmj.plot\nimport numpy as np\n\nimport database\nimport plots\n\n\n@climate.annotate(\n root='load experiment data from this directory',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test case for status codes.\n"
},
{
"from": "gpt",
"value": "from . import TheInternetTestCase\nfrom helium.api import Link, find_all\nfrom httplib import HTTPConnection\nfrom urlparse import urlparse\n\nclass StatusCodesTest(TheInternetTestCase):\n\tdef get_page... | python | chosen |
[
{
"from": "human",
"value": "Add a python script to generate the many-images.yaml benchmark.\n"
},
{
"from": "gpt",
"value": "# 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 a... | python | chosen |
[
{
"from": "human",
"value": "Add script to load log parse data into the database\n"
},
{
"from": "gpt",
"value": "import csv\n\nfrom chemtools.mol_name import get_exact_name\nfrom models import DataPoint\n\n\nwith open(\"data/data.csv\", \"r\") as csvfile:\n reader = csv.reader(csvfile, delim... | python | chosen |
[
{
"from": "human",
"value": "Add trace config for pox l2_learning switch\n"
},
{
"from": "gpt",
"value": "from config.experiment_config_lib import ControllerConfig\nfrom sts.topology import StarTopology, BufferedPatchPanel, MeshTopology, GridTopology, BinaryLeafTreeTopology\nfrom sts.controller_... | python | chosen |
[
{
"from": "human",
"value": "Add routine to calculate enclosed mass.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -----------------------------------------------------------------------------\n# GENHERNQUIST.ENCMASS\n# Laura L Watkins [lauralwatkins@gmail.com]\n# -------------------... | python | chosen |
[
{
"from": "human",
"value": "Add an example script with missing constants\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom molml.features import Connectivity\nfrom molml.constants import BOND_LENGTHS\n\n# Currently, there are two recommended ways to work with elements that are not\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add qp controller input snooper\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n''' Listens to QP Controller Inputs and draws, in different but\norder-consistent colors, the cubic splines being followed by each\nbody motion block. '''\n\nimport lcm\nimport drc\... | python | chosen |
[
{
"from": "human",
"value": "Add revenge of the pancakes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Google Code Jam\n# Google Code Jam 2016\n# Qualification Round 2016\n# Problem B. Revenge of the Pancakes\n\n# Solved all test sets\n\nfrom __future__ import print_function\n\ndef... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for creation of tips\n"
},
{
"from": "gpt",
"value": "from twisted.internet.defer import inlineCallbacks\nfrom twisted.trial import unittest\n\nfrom globaleaks.settings import transact\nfrom globaleaks.jobs import delivery_sched\nfrom globaleaks.tests im... | python | chosen |
[
{
"from": "human",
"value": "Add script to update ora2 workflows with truncated course_ids\n\nStanford-Online/edx-ora2#25 expands course_id length.\nNote this script does not account for ambiguous truncated course_ids\n(i.e. multiple different full course_ids match the truncation).\nThis edge case does not ... | python | chosen |
[
{
"from": "human",
"value": "Add modify code Google News Crawer\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#Crawer Google News\n# coding=utf-8\n# -*- coding: utf8 -*-\n\nfrom urllib.request import urlopen\nfrom bs4 import BeautifulSoup\n\nres = urlopen(\"https://news.google.com\")\... | python | chosen |
[
{
"from": "human",
"value": "Add migration clearing all sessions.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.29 on 2020-05-08 17:49\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.core import management\nfrom dja... | python | chosen |
[
{
"from": "human",
"value": "Implement more sophisticated annotation generation\n"
},
{
"from": "gpt",
"value": "from indra.assemblers.english import EnglishAssembler\nfrom indra.databases import identifiers\nfrom indra.statements.agent import get_grounding, default_ns_order\n\n\ngrounding_ns = ... | python | chosen |
[
{
"from": "human",
"value": "Add migration script to add indexes\n"
},
{
"from": "gpt",
"value": "import logging\nimport migrations\n\nlogging.basicConfig()\n\nlog = logging.getLogger()\n\nconn = migrations.connect()\n\ncur = conn.cursor()\n\ndef drop_index(table, idx):\n cur.execute(\"SHOW I... | python | chosen |
[
{
"from": "human",
"value": "Add function to checkout a family\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 a quicky Abbyy recogniser node. Doesn't seem to work yet, but can't be sure 'cos our license has run out of pages...\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCuneiform Recogniser\n\"\"\"\n\nfrom nodetree import node, manager\nfrom ocradmin import plugins\nfrom o... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.