conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add test for validation of JWT in host api\n" }, { "from": "gpt", "value": "from common_fixtures import * # NOQA\nimport websocket as ws\nimport pytest\n\n\ndef test_host_api_token(admin_client):\n hosts = admin_client.list_host(kind='docker', removed_null=True)\...
python
chosen
[ { "from": "human", "value": "Add tests for CA slug generation\n\nTest that control assessment slugs are prefixed with control slug.\n" }, { "from": "gpt", "value": "# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LIC...
python
chosen
[ { "from": "human", "value": "Add alembic revision to delete legacy paper tables\n" }, { "from": "gpt", "value": "\"\"\"Delete legacy paper tables\n\nRevision ID: fb7b6aa148e\nRevises: 25d478c9d690\nCreate Date: 2017-02-22 14:43:34.952274\n\"\"\"\n\nimport sqlalchemy as sa\nfrom alembic import co...
python
chosen
[ { "from": "human", "value": "Add unit test for generate_html_for_tfma_component.\n\nPiperOrigin-RevId: 465824929\n" }, { "from": "gpt", "value": "# Copyright 2022 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance ...
python
chosen
[ { "from": "human", "value": "Use invoke as build tool\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals, absolute_import\n\nfrom invoke import run, task\n\nfrom os.path import join, abspath, dirname\n\nROOT = abspath(join(dirname(__file__)))\n\n\n@...
python
chosen
[ { "from": "human", "value": "Build a client for accessing Tempo.\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not us...
python
chosen
[ { "from": "human", "value": "Add very basic diurnal plotter\n" }, { "from": "gpt", "value": "import sys\nimport datetime as dt\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib as mpl\n\n\"\"\"\nDiurnal_Plot.py: \n\n Produce diurnal plots of fitbit data (5 min intervals)...
python
chosen
[ { "from": "human", "value": "Add script to display random wallpaper\n\nWindows 10 took away the handy \"random good wallpaper\" and apparently it\ntook me five years to get around to recreating it. This script makes use\nof my existing database of photos, with star ratings listed. It filters\nthat database ...
python
chosen
[ { "from": "human", "value": "Add Django db migration to latest version\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.1 on 2017-05-27 15:54\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion...
python
chosen
[ { "from": "human", "value": "Add script to refresh python production snaps\n" }, { "from": "gpt", "value": "\"\"\"\nThis script refreshes production varsnap snaps\n\"\"\"\n\nimport os\nimport subprocess\nimport sys\n\nimport requests\nimport syspath\nfrom syspath import git_root\n\nfrom app impo...
python
chosen
[ { "from": "human", "value": "Add tests for enhancments UI\n" }, { "from": "gpt", "value": "\"\"\"Module for enhancement UI.\"\"\"\nimport logging\nimport unittest\n\nimport mock\n\nfrom letsencrypt.client import errors\nfrom letsencrypt.client.display import display_util\n\n\nclass AskTest(unitt...
python
chosen
[ { "from": "human", "value": "Add init sem teste de primalidade\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom rsa import RSAKeyGeneration\nimport sys\n\n\ndef main():\n print('mensagem:')\n mensagem = input()\n\n if len(sys.argv) > 2:\n tamanho_chave, acuracidad...
python
chosen
[ { "from": "human", "value": "Solve Code Fights alternating sums problem\n" }, { "from": "gpt", "value": "def alternatingSums(a):\n # teamOne = [n for i, n in enumerate(a) if i % 2 == 0]\n # teamTwo = [n for i, n in enumerate(a) if i % 2 == 1]\n # return (sum(teamOne), sum(teamTwo))\n ...
python
chosen
[ { "from": "human", "value": "Add routine to calculate density slope.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -----------------------------------------------------------------------------\n# GENHERNQUIST.DENS_SLOPE\n# Laura L Watkins [lauralwatkins@gmail.com]\n# ----------------...
python
chosen
[ { "from": "human", "value": "Delete obsolete permissions from the database\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.6 on 2019-11-11 14:03\n\nfrom django.db import migrations\n\n\ndef delete_obsolete_perms(apps, schema_editor):\n \"\"\"Delete obsolete permissions from the dat...
python
chosen
[ { "from": "human", "value": "Add failing test for keyring.util.platform_.config_root\n" }, { "from": "gpt", "value": "import platform\n\nfrom keyring.util.platform_ import (\n config_root,\n data_root,\n _config_root_Linux,\n _config_root_Windows,\n _data_root_Linux,\n _data_ro...
python
chosen
[ { "from": "human", "value": "Add test for repair command\n" }, { "from": "gpt", "value": "from vdirsyncer.cli.utils import repair_storage\nfrom vdirsyncer.storage.memory import MemoryStorage\nfrom vdirsyncer.utils.vobject import Item\n\n\ndef test_repair_uids():\n s = MemoryStorage()\n s.u...
python
chosen
[ { "from": "human", "value": "Add login provides in session module.\n" }, { "from": "gpt", "value": "from flask import Flask, redirect, url_for, session, request\nfrom flask_oauth import OAuth\nfrom config import GOOGLE_OAUTH_ID, GOOGLE_OAUTH_SECRET, \\\n TWITTER_OAUTH_ID, TWIT...
python
chosen
[ { "from": "human", "value": "Add a script to extract the results from a Mahout PFPgrowth run\n" }, { "from": "gpt", "value": "import os, sys\nfrom operator import itemgetter\n\ndef errorExit(msg):\n sys.stderr.write(msg)\n sys.exit(1)\n\ndef main():\n # Verify arguments\n if len(sys....
python
chosen
[ { "from": "human", "value": "Add script to parse registration CSV\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport csv\nimport sys\n\n# For this function to work, the attendance list needs to include the exact fields as described\n# below. Otherwise this function won't be able t...
python
chosen
[ { "from": "human", "value": "Add ability to restart masters from console\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\n\nfrom cthulhubot.models import Buildmaster\n\nclass Command(BaseCommand):\n help = 'Restart all Buildmaster processes'\n args = \"...
python
chosen
[ { "from": "human", "value": "Add test per ld snp and gwas snp\n" }, { "from": "gpt", "value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom .base import TestPostgapBase\n# ------------------------------------------------\n\nclass TestPostgapPe...
python
chosen
[ { "from": "human", "value": "Refactor out the SSL handler.\n" }, { "from": "gpt", "value": "import urllib.request\nimport ssl\n\ndef create_toolsess_httpsHandler():\n\tcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n\tcontext.verify_mode = ssl.CERT_NONE\n\thttps_handler = urllib.request.HTTPSHand...
python
chosen
[ { "from": "human", "value": "Add a wrapper to GeoChart" }, { "from": "gpt", "value": "# Google Chart wrapper for iampl.\n\nfrom IPython.core.display import Javascript\n\ndef GeoChart(keys, data, **kwargs):\n table = \"{},\\n\".format(keys)\n for i in data:\n table += \"['{}', {}],\\...
python
chosen
[ { "from": "human", "value": "Create new module for calculation of veg indices; add EVI\n" }, { "from": "gpt", "value": "\"\"\" Functions for computing vegetation indices\n\"\"\"\nfrom __future__ import division\n\n\ndef EVI(red, nir, blue):\n \"\"\" Return the Enhanced Vegetation Index for a ...
python
chosen
[ { "from": "human", "value": "Add migration to disable disabled accounts' aliases\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.17 on 2021-01-28 13:40\n\nfrom django.db import migrations\n\n\ndef update_disabled_accounts_aliases(apps, schema_editor):\n User = apps.get_model('core'...
python
chosen
[ { "from": "human", "value": "Add script to test if patches have been applied\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport mysql.connector\nfrom mysql.connector import errorcode\nimport re\nimport os\nimport string\nimport sys\nimport subprocess\nimport auto_merge\n\ndef check_if_...
python
chosen
[ { "from": "human", "value": "Add Lecroy HDO6104 instrument class\n" }, { "from": "gpt", "value": "__all__ = ['HDO6104']\n\nfrom auspex.log import logger\nfrom .instrument import SCPIInstrument, StringCommand, FloatCommand, IntCommand, Command\nimport numpy as np\nimport time\n\nclass HDO6104(SCP...
python
chosen
[ { "from": "human", "value": "Add a migration script for networking_action to add the new columns\n\nIf there are entries in the networking action table that we upgrading, that\nmeans those are pending actions; so the script sets their status to PENDING.\n\nAnd since when those actions were queued, the users...
python
chosen
[ { "from": "human", "value": "Add py solution for 678. Valid Parenthesis String\n\n678. Valid Parenthesis String: https://leetcode.com/problems/valid-parenthesis-string/\n" }, { "from": "gpt", "value": "class Solution(object):\n\n def checkValidString(self, s):\n \"\"\"\n :type s...
python
chosen
[ { "from": "human", "value": "Add py solution for 695. Max Area of Island\n\n695. Max Area of Island: https://leetcode.com/problems/max-area-of-island/\n" }, { "from": "gpt", "value": "def link(info, size, r1, r2):\n if size[r1] > size[r2]:\n info[r2] = r1\n size[r1] += size[r2]\...
python
chosen
[ { "from": "human", "value": "Add a script to handle 5.0 db migrations\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# coding=utf8\n\"\"\"update_db.py - A basic migration script for 3.x/4.x databases to 5.0.\n\nUsage: ./update_db.py /path/to/config\n\nNote that it takes the config, rath...
python
chosen
[ { "from": "human", "value": "Add “Luo et al. (2006)” colour difference examples.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nShowcases *Delta E* colour difference computation objects based on\n*Luo et al. (2006)* *CAM02-LCD*, *CAM02-SCD*, and *CAM02...
python
chosen
[ { "from": "human", "value": "Add module to fetch server infos.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import (absolute_import, division, print_function)\n\nfrom ansible.module_utils.basic import AnsibleModule\n\n__metaclass__ = type\n\nDOCU...
python
chosen
[ { "from": "human", "value": "Add Favourite Biscuit as a field for candidates\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 def create_simple_fields(app...
python
chosen
[ { "from": "human", "value": "Add migration to create a 'manufacturer' field to the SupplierPart model\n\n(cherry picked from commit 890e938662ed4aff53ea9399b54a86359d23f23f)\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.10 on 2020-04-13 03:29\n\nfrom django.db import migrations, mod...
python
chosen
[ { "from": "human", "value": "Add 30 Days of Code Day 0 in Python.\n" }, { "from": "gpt", "value": "# Read a full line of input from stdin and save it to our dynamically typed variable, input_string.\ninput_string = input()\n\n# Print a string literal saying \"Hello, World.\" to stdout.\nprint('H...
python
chosen
[ { "from": "human", "value": "Remove old Staff page types\n" }, { "from": "gpt", "value": "# Generated by Django 2.0.8 on 2018-09-12 10:49\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('wagtailcore', '0040_page_draft_titl...
python
chosen
[ { "from": "system", "value": "Put config back in thing\n" }, { "from": "human", "value": "#! /usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n# Copyright (c) 2015-2016, Exa Analytics Development Team\r\n# Distributed under the terms of the Apache License 2.0\r\n'''\r\nExecutables\r\n###########...
python
chosen
[ { "from": "human", "value": "Add initial Route implementation: responsible to link the queue and the job executor\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport asyncio\nfrom functools import partial\nimport importlib\nimport logging\n\nimport boto3\n\nfrom cached_property im...
python
chosen
[ { "from": "human", "value": "Add an example of creating lvs using growable requests.\n" }, { "from": "gpt", "value": "import logging\nimport sys\nimport os\n\nfrom common import set_up_logging\nfrom common import create_sparse_file\nfrom common import tear_down_disk_images\nfrom common import pr...
python
chosen
[ { "from": "human", "value": "Add script to automate replacing HDP jars.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport os\nimport re\nimport shutil\nimport sys\n\n\"\"\" Automate updating multiple HDP jars for debugging/hotfix purposes.\nAgnostic to the target directory layout ...
python
chosen
[ { "from": "human", "value": "Add NaN output detection callback\n" }, { "from": "gpt", "value": "import numpy as np\nimport tensorflow as tf\nimport keras.backend as K\nfrom keras.callbacks import Callback\n\n\nclass CheckNumericsOps(Callback):\n \"\"\"Callback that terminates training when a ...
python
chosen
[ { "from": "human", "value": "Add alembic migration: \"add unique constraints\"\n" }, { "from": "gpt", "value": "\"\"\"Add unique constraints\n\nRevision ID: 0868747e62ff\nRevises: e60a77e44da8\nCreate Date: 2017-04-11 16:10:42.109777\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n...
python
chosen
[ { "from": "human", "value": "Cover tests for npz i/o\n" }, { "from": "gpt", "value": "# vim: fdm=indent\n'''\nauthor: Fabio Zanini\ndate: 31/01/19\ncontent: Test I/O of sparse counts table via npz files.\n'''\nimport os\n\n\ndef test_parse__save_npz():\n print('Parsing example NP...
python
chosen
[ { "from": "human", "value": "Add script to turn a CSV file into OpenSesame style Loops\n" }, { "from": "gpt", "value": "import argparse\nfrom collections import namedtuple\nimport csv\nfrom itertools import groupby\n\n\nclass Loop(object):\n def __init__(self, name, repeat=1, cycles=None, des...
python
chosen
[ { "from": "human", "value": "corpus: Add enum for HTTP auth strings\n\nTaken from curl/curl.h and converted to Python, for convenience when\nwriting corpus seed cases.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Allow using strings to represent CURLOPT_HTTPAUTH values when\n# gener...
python
chosen
[ { "from": "human", "value": "Change related name for SuppleirPart.supplier\n\n(cherry picked from commit 635c4339e06db392f373f46539df38c914683d5a)\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.10 on 2020-04-13 08:39\n\nfrom django.db import migrations, models\nimport django.db.model...
python
chosen
[ { "from": "human", "value": "[Add] Add collection mac tool for ilo\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport pexpect\nimport re\nimport sys\nfrom optparse import OptionParser\n\nmacs=[]\nerr=0\n\nop=OptionParser(\"fancheck [options] ip\")\nop.add_option(\"-l\",\"--log\",action...
python
chosen
[ { "from": "human", "value": "Move api test back to django\n" }, { "from": "gpt", "value": "import os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"api.api.settings\")\n\nimport pytest\nimport django\nfrom django.test import TestCase\nfrom rest_framework.test import APIRequestFactory\n\nfr...
python
chosen
[ { "from": "system", "value": "Modify round-trip test to use new function name.\n\nWe've temporarily settled on `fromdap()` for importing from `__distarray__` interfaces." }, { "from": "human", "value": "import unittest\nimport distarray as da\nfrom distarray.mpi.mpibase import create_comm_of_siz...
python
chosen
[ { "from": "human", "value": "Add a simple experiment script\n" }, { "from": "gpt", "value": "from toolbox.datasets.sr import load_data\nfrom toolbox.models import srcnn\nfrom toolbox.training import train\n\n\n(x_train, y_train), (x_test, y_test) = load_data()\nmodel = srcnn(x_train.shape[1:], f...
python
chosen
[ { "from": "human", "value": "Add python demo demonstrating custom tile source\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# To run this example, you need to set the GI_TYPELIB_PATH environment\n# variable to point to the gir directory:\n#\n# export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:...
python
chosen
[ { "from": "system", "value": "Revert back to PyBindGen as package name because it's what is already registered in PyPI.\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport os\nfrom distutils.core import setup\n\nsys.path.insert(0, os.path.dirname(__file__))\nfrom wutil...
python
chosen
[ { "from": "human", "value": "Add a module to map Postgres encoding names to Python\n" }, { "from": "gpt", "value": "'''Map PostgreSQL encoding names to Python encoding names\n\nhttps://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE\n\n'''\n\n_map = {\n 'abc': 'cp1258',\n ...
python
chosen
[ { "from": "human", "value": "Add a pi example using random.random instead of the halton sequence\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nfrom __future__ import division\n\nimport random\nimport sys\nimport mrs\n\nclass SamplePi(mrs.MapReduce):\n \"\"\"A less numerically-intensiv...
python
chosen
[ { "from": "human", "value": "Add tests suite for template tags of notifications app\n" }, { "from": "gpt", "value": "\"\"\"\nTest suite for the template tags of the notifications app.\n\"\"\"\n\nfrom django.test import TestCase\nfrom django.template import (engines,\n ...
python
chosen
[ { "from": "human", "value": "Add a simple script to get unique zip codes from demographics file and save as zip2wd inputs.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport csv\nimport argparse\n\n\ndef parse_command_line():\n \"\"\"Parse command line a...
python
chosen
[ { "from": "human", "value": "Add functional tests for security group CRUD\n\nChange-Id: Ib5bbd46c0454d7dbb541354d515430922569c994\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the ...
python
chosen
[ { "from": "human", "value": "Add unit test for path conversion.\n" }, { "from": "gpt", "value": "import os\nimport unittest\n\nimport stack\n\n\nclass TestSlashConvert(unittest.TestCase):\n def test_relative(self):\n # start with unix-style\n source = \"test/sub \\n dir/file.txt...
python
chosen
[ { "from": "human", "value": "Add command to generate metadata\n" }, { "from": "gpt", "value": "import logging\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nfrom projects import tasks\nfrom projects.models import Proj...
python
chosen
[ { "from": "human", "value": "Set up Code Fights merging vines problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Merging Vines Problem\n\nfrom functools import reduce\nimport math\n\n\ndef compose(functions):\n return reduce(lambda f, g: lambda x: f(g(x)), functio...
python
chosen
[ { "from": "human", "value": "Add a basic check for externals\n" }, { "from": "gpt", "value": "from i8c.tests import TestCase\n\nSOURCE = \"\"\"\\\ndefine test::externals_test returns int\n extern ptr a_symbol\n extern func int, int (ptr) a_function\n call\n return\n\"\"\"\n\nclass Te...
python
chosen
[ { "from": "human", "value": "Add an example test in Spanish\n" }, { "from": "gpt", "value": "# Spanish Language Test - Python 3 Only!\nfrom seleniumbase.translate.spanish import CasoDePrueba\n\n\nclass MiClaseDePrueba(CasoDePrueba):\n\n def test_ejemplo_1(self):\n self.abrir_url(\"http...
python
chosen
[ { "from": "human", "value": "Add a flag to print debuggy logging info vtwt/cli.py\n" }, { "from": "gpt", "value": "import sys\n\nfrom twisted.internet.defer import inlineCallbacks, gatherResults\nfrom twisted.plugin import IPlugin\nfrom twisted.python import usage\nfrom zope.interface import imp...
python
chosen
[ { "from": "human", "value": "Add standard tests for metrics\n" }, { "from": "gpt", "value": "import re\n\nfrom tests.helpers import BaseApplicationTest\n\n\ndef load_prometheus_metrics(response_bytes):\n return dict(re.findall(rb\"(\\w+{.+?}) (\\d+)\", response_bytes))\n\n\nclass TestMetrics(...
python
chosen
[ { "from": "human", "value": "Add new producer to test\n" }, { "from": "gpt", "value": "from pyspark import SparkConf, SparkContext\r\nfrom pyspark.streaming import StreamingContext\r\nfrom pyspark.streaming.kafka import KafkaUtils\r\nfrom kafka import SimpleProducer, KafkaClient\r\nfrom kafka im...
python
chosen
[ { "from": "human", "value": "Add upgrade warning for users expecting praatio 4.x\n" }, { "from": "gpt", "value": "class WrongPraatioVersion(Exception):\n pass\n\n\nraise WrongPraatioVersion(\n \"\\n\\nWARNING: You've tried to import 'tgio' which was renamed 'textgrid' in praatio 5.x.\\n\"\...
python
chosen
[ { "from": "human", "value": "Add custom date and period to form 10\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUtilities for interacting with edgar forms.\n\"\"\"\n\n# import os\n# import re\nimport logging\n\nfrom . import localstore\nfrom . import f...
python
chosen
[ { "from": "human", "value": "Add script to crop a raster to some boundaries\n" }, { "from": "gpt", "value": "import subprocess\n\n# TODO: Crop from boundaries of raster tiles in a folder\n\ndef gdal_crop(input_file, output_file, corners):\n proc_name = 'gdal_translate'\n # Using 'lanczos' ...
python
chosen
[ { "from": "human", "value": "Move scale helpers into a separate module\n\nNo change in behaviour\n" }, { "from": "gpt", "value": "\"\"\"Scale helpers functions.\"\"\"\n\nimport math\n\n\ndef any_scale(scale):\n \"\"\"Scale helper function that allows any scale.\"\"\"\n return scale\n\ndef ...
python
chosen
[ { "from": "human", "value": "Add an abstract ShopUser base class that other apps can extend for their auth user." }, { "from": "gpt", "value": "from django.conf import settings\nfrom django.db import models\nfrom django.contrib.auth.models import AbstractBaseUser, BaseUserManager\n\n\nclass Shop...
python
chosen
[ { "from": "human", "value": "Add password expiry user migration\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(m...
python
chosen
[ { "from": "system", "value": "Update Request object import to use statusable attributes\n" }, { "from": "human", "value": "# Copyright (C) 2016 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:...
python
chosen
[ { "from": "human", "value": "Add test to verify that jit-compiled functions show up in the profile stats.\n" }, { "from": "gpt", "value": "import numpy as np\nimport cProfile as profiler\nimport pstats\nfrom numba import jit\nfrom numba import unittest_support as unittest\n\ndef dot(a, b):\n ...
python
chosen
[ { "from": "human", "value": "Add py solution for 375. Guess Number Higher or Lower II\n\n375. Guess Number Higher or Lower II: https://leetcode.com/problems/guess-number-higher-or-lower-ii/\n" }, { "from": "gpt", "value": "class Solution(object):\n def getMoneyAmount(self, n, table=dict()):\n...
python
chosen
[ { "from": "system", "value": "Fix unicode error caused by ascii format string\n" }, { "from": "human", "value": "from django.forms.widgets import Widget\nfrom django.utils.safestring import mark_safe\n\n\nclass WidgetWithScript(Widget):\n def render(self, name, value, attrs=None):\n wi...
python
chosen
[ { "from": "human", "value": "Add func to get regular expression from a single line in `.gitignore`\n\nThe rule of the func followed http://git-scm.com/docs/gitignore\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport fnmatch\n\n\ndef get_re_from_single_line...
python
chosen
[ { "from": "human", "value": "Add order to proposed public bodies" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2018-07-26 09:51\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Add functional tests for IP availability\n\nThis patch adds functional tests for IP availability\n\nPartially-Implements: blueprint neutron-ip-capacity\nChange-Id: I1c1dc01801707fe8f0dc3c976e5d345d2b0db0ec\n" }, { "from": "gpt", "value": "# Licensed under the Apac...
python
chosen
[ { "from": "human", "value": "Add a plot script for std figure of choosen simu\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\n\n\"\"\"\nSelect a specific simulation from a HDF5 file and plot its granule figure.\n\n\"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport tab...
python
chosen
[ { "from": "human", "value": "Add tests for improved loading functionality.\n" }, { "from": "gpt", "value": "##############################################################################\n# MDTraj: A Python Library for Loading, Saving, and Manipulating\n# Molecular Dynamics Trajectories....
python
chosen
[ { "from": "human", "value": "Add solution to exercise 8.12.\n" }, { "from": "gpt", "value": "# 8-12. Sandwiches\n\ndef make_sandwich(*ingredients):\n\t\"\"\"Print the ingredients in the sandwich\"\"\"\n\tprint (\"Making a sandwich with the following ingredients:\")\n\tfor ingredient in ingredien...
python
chosen
[ { "from": "human", "value": "Test TemplateLookup dirs are not cleared during lms startup.\n\nLMS-2498\n" }, { "from": "gpt", "value": "\"\"\"Tests for the lms module itself.\"\"\"\n\nfrom django.test import TestCase\n\nfrom edxmako import add_lookup, LOOKUP\nfrom lms import startup\n\nclass Temp...
python
chosen
[ { "from": "human", "value": "Add a script that loads the taxonomies as a standalone thing\n" }, { "from": "gpt", "value": "import os\nimport json\nfrom framework.mongo import set_up_storage\n\nfrom website import settings\nfrom website.project.taxonomies import Subject\n\nfrom modularodm import ...
python
chosen
[ { "from": "human", "value": "Add test to login to the ICAT server.\n" }, { "from": "gpt", "value": "\"\"\"Test login to an ICAT server.\n\"\"\"\n\nfrom __future__ import print_function\nimport pytest\nimport icat\nimport icat.config\n\n# Try out three different users: root, useroffice, and acord...
python
chosen
[ { "from": "human", "value": "Implement tests for validate module\n" }, { "from": "gpt", "value": "\"\"\"tests/test_validate.py.\n\nTests to ensure hug's custom validation methods work as expected\n\nCopyright (C) 2015 Timothy Edmund Crosley\n\nPermission is hereby granted, free of charge, to any...
python
chosen
[ { "from": "human", "value": "Add a step for add a person in Wonderland database.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport json\n\nimport requests\nfrom flexbe_core import EventState, Logger\n\n\"\"\"\nCreated on 17/05/2018\n\n@author: Lucas Maurice\n\"\"\...
python
chosen
[ { "from": "human", "value": "Add script to control lights from Raspberry Pi.\n" }, { "from": "gpt", "value": "#\n# IAS Basic device framework.\n#\n# Author: Joeri Hermans\n#\n\nimport sys\nimport socket\nimport struct\nimport os\nimport RPIO\n\n# Global members, which are required for the commun...
python
chosen
[ { "from": "human", "value": "Test win 7 with winreg module mock\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with ...
python
chosen
[ { "from": "human", "value": "Add in Django migration for shares.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n depe...
python
chosen
[ { "from": "human", "value": "Add failing test on Py3: initialising ProgressBar with UnknownLength\n" }, { "from": "gpt", "value": "import progressbar\n\n\ndef test_unknown_length():\n pb = progressbar.ProgressBar(widgets=[progressbar.AnimatedMarker()],\n max_va...
python
chosen
[ { "from": "human", "value": "Add Python Lambda, Map, Filter, Reduce Test\n\nAdd simple functionality for Lambda, Map, Filter, and Reduce.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Topics: Lambdas, Maps, Filters, Reduce\n#\n# Background: Lambda examples and functionality, i...
python
chosen
[ { "from": "human", "value": "Add test for deprecated sparse_embed module\n" }, { "from": "gpt", "value": "from ...neural._classes.sparse_embed import SparseEmbed\nimport numpy\n\n\ndef test_create_sparse_embed():\n embed = SparseEmbed(300)\n\n\ndef test_predict_sparse_embed():\n embed = Sp...
python
chosen
[ { "from": "human", "value": "Add script to build conda recipes\n\nSigned-off-by: Harsh Gupta <c4bd8559369e527b4bb1785ff84e8ff50fde87c0@gmail.com>\n" }, { "from": "gpt", "value": "import argparse\nimport subprocess\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"package_list\", help=...
python
chosen
[ { "from": "human", "value": "Test classes from the README.md file\n" }, { "from": "gpt", "value": "import argcommand\nimport argparse\n\n##\nclass Say( argcommand.Command ):\n\n what = argcommand.Argument( \"WORD\", default = \"Something\", help = \"the text you want to print\" )\n times =...
python
chosen
[ { "from": "human", "value": "Add test for file objects created by open()\n" }, { "from": "gpt", "value": "from browser import document, html, window\n\nwith open('test.html') as f:\n f.read()\n\nwith open('files/text-utf8.txt') as f:\n f.read()\n\nwith open('compression/du cote de chez swa...
python
chosen
[ { "from": "human", "value": "Add a jinja filter and factory\n" }, { "from": "gpt", "value": "import re\n\n\n\ndef get_filters():\n\t\"\"\"Register a function with decorator\"\"\"\n\tregistry = {}\n\tdef registrar(func):\n\t\tregistry[func.__name__] = func\n\t\treturn func \n\tregistrar.all = reg...
python
chosen
[ { "from": "human", "value": "Add management command to delete invalid topics\n" }, { "from": "gpt", "value": "from optparse import make_option\nfrom datetime import datetime, timedelta\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Count\n\nfro...
python
chosen
[ { "from": "human", "value": "Add migration to flush saved tr-55 results\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef clear_old_scenario_results(apps, schema_editor):\n Scenario = apps.get...
python
chosen