conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test coverage for database resource\n"
},
{
"from": "gpt",
"value": "\"\"\" Tests the database class. \"\"\"\nimport requests_mock\n\nfrom . import BaseTest\nfrom ..resources import Database, BackupList\n\n@requests_mock.Mocker()\nclass TestDatabase(BaseTest):\n ... | python | chosen |
[
{
"from": "human",
"value": "Enable presubmit warning for \"git cl format\"\n\nBUG=None\n\nReview URL: https://codereview.chromium.org/835683004\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#311332}\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 The Chromium Authors. All r... | python | chosen |
[
{
"from": "human",
"value": "Add rough state mapping class\n"
},
{
"from": "gpt",
"value": "import enum\nimport logging\nimport json\nimport cv2\nimport os\nfrom pynput import keyboard\n\nfrom src import screen, helper\n\nlogger = logging.getLogger(__name__)\n\n\nclass Mapper():\n def __init_... | python | chosen |
[
{
"from": "human",
"value": "Add (currently failing) test with URR (n,gamma) reaction rate check\n"
},
{
"from": "gpt",
"value": "import openmc\nimport pytest\n\n\n@pytest.fixture\ndef th232_model():\n # URR boundaries for Th232\n e_min, e_max = 4000.0, 100000.0\n\n model = openmc.model... | python | chosen |
[
{
"from": "human",
"value": "Add a model field for states of Brazil\n"
},
{
"from": "gpt",
"value": "from django.utils.translation import ugettext_lazy as _\nfrom django.db.models.fields import CharField\n\nfrom .br_states import STATE_CHOICES\n\n\nclass BRStateField(CharField):\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "108536374: Change to a generic message for database errors.\n\nNeed a story to handle db exceptions in the dao layer\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nfrom flask import render_template, redirect, jsonify\n\nfrom app.main import main... | python | chosen |
[
{
"from": "human",
"value": "Fix svm drop columns test - add test that missing skipped_columns or skipped_columns = [] should work correctly and give the same frame as original one\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys\n\nsys.path.insert(1, \"../../\"... | python | chosen |
[
{
"from": "human",
"value": "Add an example with probability distribution estimates using GMM.\n\nThis is a work in progress. Also, the .eval() function from GMM\nmight very likely change it's return type in the future.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n=================================\n... | python | chosen |
[
{
"from": "human",
"value": "Add handy number checker script\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport feedparser\n\nurl = \"https://edit.yournextmp.com/results/all.atom\"\nfeed = feedparser.parse(url)\n\nentries = {x['post_id']: x for x in feed.entries}.values()\n\nresult... | python | chosen |
[
{
"from": "human",
"value": "Use function for input_format friendly names\n\nRefactoring TransformerWorkflow to use newly created FriendlyName that returns a human readable names of specific input formats.\n"
},
{
"from": "gpt",
"value": "try:\n import logging\nexcept ImportError as err:\n ... | python | chosen |
[
{
"from": "human",
"value": "Prepare constants into seperate location\n"
},
{
"from": "gpt",
"value": "NIST_KEY_FREQUENCY = 'frequency'\nNIST_KEY_OUTPUT_VALUE = 'outputValue'\nNIST_KEY_PREVIOUS_OUTPUT_VALUE = 'previousOutputValue'\nNIST_KEY_SEED_VALUE = 'seedValue'\nNIST_KEY_SIGNATURE_VALUE = 's... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton script to draw similarites between objects\n"
},
{
"from": "gpt",
"value": "import json\nimport networkx as nx\nfrom networkx.readwrite import json_graph\n\nwith open(\"/query_results.json\") as f:\n json_data = f.read()\nx = json.loads(json_data)\ndo... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for process flood.\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\"\"\"Docstring here.\"\"\"\nimport unittest\nfrom django import test\n\nfrom realtime.tasks.realtime.flood import process_flood\nfrom realtime.tasks.flood import create_flood_report\nf... | python | chosen |
[
{
"from": "human",
"value": "Add a script to copy data files conveniently.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n\"\"\"Copy data from the given zip file to the project.\"\"\"\n\nimport argparse\nimport fnmatch\nimport os\nimport time\nimport zipfile\n\n_... | python | chosen |
[
{
"from": "human",
"value": "Add a test Python script\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport time\n\nfrom might_driver import MightyWattDriver\nfrom buck_driver import FCCBuckDriver\n\ndischarger = FCCMPPTDriver()\ndischarger.open_serial('SNR=8543035353135... | python | chosen |
[
{
"from": "human",
"value": "Add some scaffolding for Squid Proxy detection test\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Squid Proxy Detector\n ********************\n\n\"\"\"\nimport os\nimport httplib\nimport urllib2\nfrom urlparse import urlparse\n\nfrom plugoo import gen_headers\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for dns config parsing\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance w... | python | chosen |
[
{
"from": "human",
"value": "Add a basic integrator + solution class\n\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom scipy.integrate import solve_ivp\nfrom scipy.interpolate import interp1d\nfrom scipy.sparse import csr_matrix, csc_matrix\nfrom scipy.sparse.linalg import spsolve\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add early analysis script for traces\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom scipy import ndimage as ndi\nfrom skimage.filters import threshold_otsu\n\n\ndef _extract_roi(image, axis=-1):\n max_frame = np.max(image, axis=axis)\n initial_mask =... | python | chosen |
[
{
"from": "human",
"value": "Add an empty package (classifiers).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)\n\n# This script is provided under the terms and conditions of the MIT license:\n# Permis... | python | chosen |
[
{
"from": "human",
"value": "Add locator file for winter '20.\nWithout this file, Salesforce.py will throw an error when it's imported\nwhile testing Winter '20.\n"
},
{
"from": "gpt",
"value": "from cumulusci.robotframework import locators_46\n\nlex_locators = locators_46.lex_locators.copy()\n\... | python | chosen |
[
{
"from": "human",
"value": "Add the management commands unit tests.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the management commands\"\"\"\nfrom __future__ import absolute_import\nfrom django.conf import settings\nfrom django.core import management\nfrom importlib import import_module\n... | python | chosen |
[
{
"from": "human",
"value": "Add python driver (depend on PyV8)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport PyV8\nimport urllib\nfrom urlparse import urlparse\n\ntry:\n import json\nexcept ImportError:\n import simplejson... | python | chosen |
[
{
"from": "human",
"value": "Add the migration for the image field\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '... | python | chosen |
[
{
"from": "human",
"value": "Add simple scanner pipeline to help with job submission\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCopyright [2009-2018] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compl... | python | chosen |
[
{
"from": "human",
"value": "Add alembic script to fix the type of the column updated_at of shelters\n"
},
{
"from": "gpt",
"value": "\"\"\"fix the type of the updated_at column for shelters\n\nRevision ID: 953c5e0cebad\nRevises: 9bfedc780ac5\nCreate Date: 2016-06-17 09:00:35.875583\n\n\"\"\"\n\... | python | chosen |
[
{
"from": "human",
"value": "Add function for python implementation of fibonacci sequence\n"
},
{
"from": "gpt",
"value": "# Implement fibonacci sequence function using recursion\n\ndef get_fib(position):\n\tif position < 2: # base case\n\t\treturn position\n\telse:\n\t\treturn get_fib(position-... | python | chosen |
[
{
"from": "human",
"value": "Add an example of interop with descartes and matplotlib\n"
},
{
"from": "gpt",
"value": "\nimport logging\nimport sys\n\nfrom matplotlib import pyplot\nfrom descartes import PolygonPatch\n\nfrom fiona import collection\n\n\nBLUE = '#6699cc'\nfig = pyplot.figure(1, fi... | python | chosen |
[
{
"from": "human",
"value": "Add my configuration file as an example.\n"
},
{
"from": "gpt",
"value": "import libqtile\n\nkeys = [\n libqtile.Key(\n [\"mod1\"], \"k\",\n libqtile.command.Call(\"max_next\").when(layout=\"max\"),\n libqtile.command.Call(\"stack_down\").when... | python | chosen |
[
{
"from": "human",
"value": "Add untested Fourier linear function approximator\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nimport itertools\n\nimport numpy as np\n\ndef make_feature_vec(state_ranges, order):\n \"\"\"\n\n Arguments:... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert regex to enum in schemas\n\nThis script is just to record how regular expression patterns describing\nchoices were converted into enums in the json schemas.\n"
},
{
"from": "gpt",
"value": "import json\nimport os\nimport re\n\n\ndef is_enum(patt... | python | chosen |
[
{
"from": "human",
"value": "Add helper for git clean that keeps the IDE folders\n"
},
{
"from": "gpt",
"value": "import subprocess\n\n# Keep the following directories\n# - .vscode (Visual Studio code project settings)\n# - .vs (Visual Studio project files)\n# - .idea (PyCharm project files)\nsu... | python | chosen |
[
{
"from": "human",
"value": "Add script for profiling the generate process.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom logya.generate import Generate\n\nimport cProfile, pstats, io\nfrom pstats import SortKey\n\n\npr = cProfile.Profile()\npr.enable()\n\... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for zlibd module.\n"
},
{
"from": "gpt",
"value": "try:\n import zlib\nexcept ImportError:\n import zlibd as zlib\n\nPATTERNS = [\n # Packed results produced by CPy's zlib.compress()\n (b'0', b'x\\x9c3\\x00\\x00\\x001\\x001'),\n (b'a', ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for analyses handlers\n\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n@pytest.mark.parametrize(\"not_found\", [False, True], ids=[\"200\", \"404\"])\nasync def test_get(mocker, not_found, spawn_client):\n client = await spawn_client(authorize=... | python | chosen |
[
{
"from": "system",
"value": "Add tests for connecting to three different sensors\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_pytoon\n----------------------------------\n\nTests for `pytoon` module.\n\"\"\"\n\nimport unittest\nfrom mock impor... | python | chosen |
[
{
"from": "system",
"value": "Fix infinite loop in highlighter\n"
},
{
"from": "human",
"value": "import re\nfrom pyqode.core.qt import QtGui\n\n\nclass MatchHighlighter(QtGui.QSyntaxHighlighter):\n def __init__(self, document):\n super().__init__(document)\n self.prog = None\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement database driver for MongoDB\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nimport urllib.parse\n\nimport pymongo\nimport pymongo.database\nimport pymongo.uri_parser\n\nimport lglass.database.base\nimport lglass.rpsl\n\n@lglass.database.base.register(\"... | python | chosen |
[
{
"from": "human",
"value": "Add a few tests for md5.md5\n\n\ngit-svn-id: ace7fa9e7412674399eb986d17112e1377537c44@4673 95a46c32-92d2-0310-94a5-8d71aeb3d4b3\n"
},
{
"from": "gpt",
"value": "from md5 import md5\n\n########################################\n## md5.md5\n#############################... | python | chosen |
[
{
"from": "human",
"value": "Add script for setting up DO nodes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport subprocess\nimport re\nimport os.path\n\n\nsubprocess.check_call(['fallocate', '-l', '2G', '/swapfile'])\nsubprocess.check_call(['mkswap', '/swapfile'])\nsubprocess.chec... | python | chosen |
[
{
"from": "human",
"value": "Check latest version of Python modules in Pypi"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Adapted from http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/\n# Changelog:\n# - patch to python 3.6\n# - include hi... | python | chosen |
[
{
"from": "human",
"value": "ADD Network roles unit tests\n"
},
{
"from": "gpt",
"value": "def test_create_role(client):\n result = client.post(\"/roles/\", data={\"role\": \"admin\"})\n assert result.status_code == 200\n assert result.get_json() == {\"msg\": \"Role created succesfully!... | python | chosen |
[
{
"from": "human",
"value": "[Android] Add a command line tool for reverse port forwarding\n\nThis patch adds a command line interface to\nbuild/android/pylib/forwarder.py. It allows an Android device to access\nservices running on the host machine or elsewhere. This is essentially\nthe reverse of \"adb for... | python | chosen |
[
{
"from": "human",
"value": "Add tests for main app\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest main pm functionality\n\"\"\"\n\nfrom cement.utils import test\nfrom pmtools import PmController, PmApp\nfrom test_default import config_defaults, PmTestApp\n\nclass PmMainTest(test.CementTestCase):... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 717. 1-bit and 2-bit Characters\n\n717. 1-bit and 2-bit Characters: https://leetcode.com/problems/1-bit-and-2-bit-characters/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def isOneBitCharacter(self, bits):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a calc function for asymmetric hessian errors\n"
},
{
"from": "gpt",
"value": "\"\"\"Functions for calculating errors by combining different datasets.\"\"\"\n\nimport math\n\ndef asymmetric_hessian_error(value_lists):\n \"\"\"Calculate the asymmetric hessian e... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add tool for downloading release wheels from Anaconda.\n\nThis is a simplified version of terryfy::wheel-uploader that has\ntwo advantages over the original:\n\n- It works with Anaconda where our wheels are now stored.\n- It is simplified to match the NumPY workflow.\n"
}... | python | chosen |
[
{
"from": "human",
"value": "Test script to get console url for a sliver.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n#\n# Copyright (c) 2008-2014 University of Utah and the Flux Group.\n# \n# {{{GENIPUBLIC-LICENSE\n# \n# GENI Public License\n# \n# Permission is hereby granted, free... | python | chosen |
[
{
"from": "human",
"value": "Handle Y' rosetta code series\n\nA very beautiful one, that once again raised a lot of errors...\n"
},
{
"from": "gpt",
"value": "# from http://rosettacode.org/wiki/Yin_and_yang#Python\nimport math\ndef yinyang(n=3):\n\tradii = [i * n for i in [1, 3, 6]]\n\tranges ... | python | chosen |
[
{
"from": "human",
"value": "Print out image URLs from Mars\n"
},
{
"from": "gpt",
"value": "import requests\n\nrover_url = 'https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos'\nparameters = {'api_key': 'DEMO_KEY', 'sol': '1324'}\n\nresponse = requests.get(rover_url, params=paramete... | python | chosen |
[
{
"from": "human",
"value": "Test file to get started with APIs\n"
},
{
"from": "gpt",
"value": "from ringcentral import SDK\nfrom config import USERNAME, EXTENSION, PASSWORD, APP_KEY, APP_SECRET, SERVER\n\n# Before you start\n# Rename credentials-sample.ini to credentials.ini\n# Edit credential... | python | chosen |
[
{
"from": "human",
"value": "Add testcase for casefold plugin\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom irc3.testing import BotTestCase\n\n\nclass TestCasefold(BotTestCase):\n\n config = dict(includes=['irc3.plugins.casefold'])\n\n def test_ascii(self):\n bot = ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for pypuppetdbquery.parse()\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# This file is part of pypuppetdbquery.\n# Copyright © 2016 Chris Boot <bootc@bootc.net>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n... | python | chosen |
[
{
"from": "human",
"value": "MovingEddies: Add simple test setup that follows two particles\n"
},
{
"from": "gpt",
"value": "from parcels import Particle, ParticleSet, JITParticle, JITParticleSet\nfrom parcels import NEMOGrid, ParticleFile, AdvectionRK4\nfrom argparse import ArgumentParser\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for task statuses\n"
},
{
"from": "gpt",
"value": "from taiga.requestmaker import RequestMaker, RequestMakerException\nfrom taiga.models.base import InstanceResource, ListResource\nfrom taiga.models import TaskStatus, TaskStatuses\nfrom taiga import TaigaAP... | python | chosen |
[
{
"from": "human",
"value": "Add class to support dependency graph visualisation\n"
},
{
"from": "gpt",
"value": "import logging\nimport re\nfrom graphviz import Digraph\nfrom IPython.display import SVG\n\n__all__ = ['DependencyGraph']\n\nlogger = logging.getLogger('tohu')\n\n\nclass DependencyG... | python | chosen |
[
{
"from": "human",
"value": "Add a RequireModule decorator for use by helpers\n\nThis eliminates the need for _require in helpers.\n"
},
{
"from": "gpt",
"value": "class RequireModule(object):\n \"\"\"Decorator that raises import error if specified module isn't found.\"\"\"\n\n def __init_... | python | chosen |
[
{
"from": "human",
"value": "Add new dev server to replace tape\n"
},
{
"from": "gpt",
"value": "\"\"\"Hacked-together development server for feedreader.\n\nRuns the feedreader server under the /api prefix, serves URI not containing a\ndot public/index.html, servers everything else to public.\n\... | python | chosen |
[
{
"from": "human",
"value": "Add scipy sin cos example\n"
},
{
"from": "gpt",
"value": "\"\"\" Given the set of points generated by\nf(x) = 0.5 * cos(2 * x) + 2 * sin(0.5 * x) with some noise,\nuse Levenberg-Marquardt algorithm to find the model of the form\nf(x) = a * cos(b * x) + b * sin(a * x... | python | chosen |
[
{
"from": "human",
"value": "Add field to render image many-to-many as checkboxes with thumbnails.\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom django.template import Context, Template\n\nclass ProductImageMultipleChoiceField(forms.ModelMultipleChoiceField):\n \"\"\"\n F... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add testing for C extensions\n\nTesting compares matrices calculated by python algorithms to\nthose calculated by the C extension. Tests the calculation of\nsurface area in a similar manner. Testing fails if C extension\nis not available or if any element in the matrix diff... | python | chosen |
[
{
"from": "human",
"value": "Add migration for setting retina annotation permissions\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.7 on 2019-02-25 12:28\n\nfrom django.db import migrations\nfrom django.contrib.auth.models import User, Group\nfrom django.conf import settings\nfrom gu... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for queue.file\n\ntests/queue/test_file.py\n\t-Add a bunch of `unittest` unit tests for most/all of the\n\tfunctions in `tilequeue.queue.file`, as per all of the recent\n\twork there.\n"
},
{
"from": "gpt",
"value": "'''\nUnit tests for `tilequeue.queu... | python | chosen |
[
{
"from": "human",
"value": "Add example of catalog copying into MovieLister example\n"
},
{
"from": "gpt",
"value": "\"\"\"A naive example of dependency injection in Python.\n\nExample implementation of dependency injection in Python from Martin Fowler's\narticle about dependency injection and ... | python | chosen |
[
{
"from": "human",
"value": "Add monitor script for website.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport urllib2\nfrom BeautifulSoup import BeautifulSoup\nfrom StringIO import StringIO\nfrom datetime import datetime, timedelta\nimport subprocess\n\nWEBSITE = 'http://www.newsdiff... | python | chosen |
[
{
"from": "human",
"value": "Implement reading from data files\n\nReads files and stores contents in new DataSentence/DataToken constructions."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom collections import OrderedDict\n\n\nclass DataToken:\n def __init__(self, line: str):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add dummy Simprocedure for java.lang.string.equals\n\n"
},
{
"from": "gpt",
"value": "from ..java import JavaSimProcedure\nimport logging\n\nl = logging.getLogger('angr.procedures.java.string.equals')\n\nclass StringEquals(JavaSimProcedure):\n\n NO_RET = True\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add copying of selected photos to a new directory"
},
{
"from": "gpt",
"value": "import pandas as pd\n\ndef main():\n \n # create a directory for selected photos\n print 'mkdir photos_las_vegas_food_drinks'\n\n # load data about selected photos\n selec... | python | chosen |
[
{
"from": "human",
"value": "Add simple driller list serializer\n"
},
{
"from": "gpt",
"value": "from rest_framework import serializers\nfrom registries.models import Organization\nfrom gwells.models import ProvinceState\n\nclass DrillerListSerializer(serializers.ModelSerializer):\n province_... | python | chosen |
[
{
"from": "human",
"value": "Add work for Exercise 24\n"
},
{
"from": "gpt",
"value": "print \"Let's practice everything.\"\nprint 'You\\'d need to know \\'bout escapes with \\\\ that do \\n newlines and \\t tabs.\"\n\npoem = \"\"\"\n\\t the lovely world\nwtih logic so firmly planted\ncannot dis... | python | chosen |
[
{
"from": "human",
"value": "Fix PlotReport.available and write test\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom chainer.training import extensions\n\n\nclass TestPlotReport(unittest.TestCase):\n\n def test_available(self):\n try:\n from matplotlib import pyplot... | python | chosen |
[
{
"from": "human",
"value": "Test cases for UrbanDict plugin\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n###\n# Copyright (c) 2004, Kevin Murphy\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided ... | python | chosen |
[
{
"from": "human",
"value": "Add Elasticsearch mapping test case\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Elasticsearch client test cases.\"\"\"\n\nimport unittest\n\nfrom sqlalchemy import types as sql_types\n\nfrom esis.es import Mapping\n\n\nclass MappingTest(unittest.T... | python | chosen |
[
{
"from": "human",
"value": "Add en and en-US locales back to locale list.\n\nBoth are source locales and shouldn't have been removed.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef add_back_s... | python | chosen |
[
{
"from": "human",
"value": "Call quicksort from Python; it works!\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport numpy as np\nimport rust_sorting as rs\n\n\narray = np.zeros((5,), dtype=np.int8)\n\n\nrs.quicksort(array)\n\nprint(\"Python done!\")\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add fake params from test.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\n\nDATASET_PATH = os.path.join(\n os.path.dirname(__file__),\n 'test_dataset',\n)\n\nDATASET_SUBDIRS = [\n {\n 'name': 'enron1',\... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for services_view.py\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015-2016:\n# Matthieu Estrada, ttamalfor@gmail.com\n#\n# This file is part of (AlignakApp).\n#\n# (AlignakApp) is free software: ... | python | chosen |
[
{
"from": "human",
"value": "Add hooks for inference experiments.\n"
},
{
"from": "gpt",
"value": "from bayeslite.shell.hook import bayesdb_shell_cmd\nfrom bdbcontrib.general_utils import ArgparseError, ArgumentParser\n\nimport bdbexp\n\nexperiments = {\n 'haystacks' : bdbexp.haystacks,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tool to fix IO tilegrid\n\nSigned-off-by: David Shah <bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@ds0.me>\n"
},
{
"from": "gpt",
"value": "import database\nimport tiles\nimport json\nfrom os import path\n\n\"\"\"\nDespite Lattice assigning them the same tile type; \... | python | chosen |
[
{
"from": "human",
"value": "Select a subset for each label. If the label image count is greater\nthan min, return the greatest number of images less than or equal to the max.\nThe images will be evenly distributed across years, seasons and days.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/pyt... | python | chosen |
[
{
"from": "human",
"value": "Use the model to classify face in local camera.\n\n"
},
{
"from": "gpt",
"value": "import openface\nimport numpy as np\nimport os\nimport cv2\nimport pickle\n\nid_name = [\"Alec\", \"Greg\", \"Phong\", \"Emil\"]\n\n\ndef classify(aligned_face, net, clf, le):\n rep... | python | chosen |
[
{
"from": "human",
"value": "Add simple plugin that times ansible-playbook runs.\n"
},
{
"from": "gpt",
"value": "import os\nimport datetime\nfrom datetime import datetime, timedelta\n\n\nclass CallbackModule(object):\n \"\"\"\n This callback module tells you how long your plays ran for.\n... | python | chosen |
[
{
"from": "human",
"value": "Add a Nano installer for Windows\n\n1. Downloads and installs Nano into the users home directory\n2. Adds Nano to the path\n3. Makes Nano the default editor\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Software Carpentry Nano Installer for Windows\... | python | chosen |
[
{
"from": "human",
"value": "Add gateway monitor Windows service\n"
},
{
"from": "gpt",
"value": "#\r\n# A sample service to be 'compiled' into an exe-file with py2exe.\r\n#\r\n# See also\r\n# setup.py - the distutils' setup script\r\n# setup.cfg - the distutils' config file for this\r\n# ... | python | chosen |
[
{
"from": "system",
"value": "Support remember flag when calling login on flask app\n"
},
{
"from": "human",
"value": "from flask import g, Blueprint\nfrom flask.ext.login import login_required, login_user\n\nfrom social.actions import do_auth, do_complete, do_disconnect\nfrom social.apps.flask_... | python | chosen |
[
{
"from": "human",
"value": "Add a regression test case for alias execution and live action context user.\n\nVerify that the user inside the context is correctly set to the authenticated\nuser which triggered the alias execution.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc... | python | chosen |
[
{
"from": "human",
"value": "Create method for redirect after signin\n"
},
{
"from": "gpt",
"value": "from django.conf import settings\n\nfrom grandchallenge.subdomains.utils import reverse\n\n\ndef signin_redirect(redirect=None, user=None):\n \"\"\"\n Redirect user after successful sign i... | python | chosen |
[
{
"from": "human",
"value": "Add extension to search JIRA for bug reports\n"
},
{
"from": "gpt",
"value": "import re\nimport urllib.parse\n\nfrom discord.ext import commands\nfrom discord.ext.commands import Context\n\nfrom cogbot.cog_bot import CogBot\n\n\nclass Jira:\n REPORT_PATTERN = re.c... | python | chosen |
[
{
"from": "human",
"value": "[RM-11742] Add tests for argparse purge\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom ceph_deploy.cli import get_parser\n\n\nclass TestParserPurge(object):\n\n def setup... | python | chosen |
[
{
"from": "human",
"value": "Implement Token and Not, And, Or classes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\nclass TreeElement(object):\n def __repr__(self):\n return u'{}'.format(self.__class__.__name__)\n\n\nclass Token(TreeElement):\n def __init__(self, val... | python | chosen |
[
{
"from": "human",
"value": "Add tests for User model\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom administrator.models import User, UserManager\n\n\nclass UserManagerTestCase(TestCase):\n valid_email = 'example@example.com'\n valid_username = 'foobar'\n val... | python | chosen |
[
{
"from": "human",
"value": "Build code depending on resources from the appcompat library with both Buck and Gradle\n\nReviewed By: sdwilsh\n\nDifferential Revision: D2844961\n\nfb-gh-sync-id: 686a9f253eb370a9dc8cc33ca1c4e8453f89210a\n"
},
{
"from": "gpt",
"value": "import contextlib\nimport os\... | python | chosen |
[
{
"from": "human",
"value": "TST: Add a test for TripWire.\n"
},
{
"from": "gpt",
"value": "\"\"\" Testing tripwire module.\n\"\"\"\n\nfrom ..tripwire import TripWire, is_tripwire, TripWireError\n\nfrom nose import SkipTest\nfrom nose.tools import (assert_true, assert_false, assert_raises,\n ... | python | chosen |
[
{
"from": "human",
"value": "Write tests for active and inactive list routes\n"
},
{
"from": "gpt",
"value": "import pytz\nfrom datetime import datetime, timedelta\nfrom django.test import TestCase\n\nfrom api.factories import TopicFactory\nfrom rest_framework.test import APIRequestFactory, forc... | python | chosen |
[
{
"from": "human",
"value": "Add basic api version test coverage\n\nChange-Id: Idb04e81ce5954ca8b5e387dc7c0776fdf7d08779\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 License. You ma... | python | chosen |
[
{
"from": "human",
"value": "Migrate documentation_type from Project to Version\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.27 on 2020-01-14 17:40\n\nfrom django.db import migrations\nfrom django.db.models import OuterRef, Subquery\n\n\ndef forwards_func(... | python | chosen |
[
{
"from": "human",
"value": "Add jury to 2012-2014 - take the data from results pages\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom functools import partial\n\nfrom django.db import migrations\n\n\ndef add_to_season(apps, schema_editor,... | python | chosen |
[
{
"from": "human",
"value": "Add example test for non-terminating checks\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\n\n\nclass MyTestClass(BaseCase):\n\n def test_non_terminating_checks(self):\n self.open('http://xkcd.com/993/')\n self.wait_for_element('#... | python | chosen |
[
{
"from": "human",
"value": "Add url rewriter for shortened urls\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, division, absolute_import\nimport logging\nfrom urlparse import urlparse\n\nfrom flexget import plugin\nfrom flexget.utils import requests\nfrom flexget.even... | python | chosen |
[
{
"from": "human",
"value": "Add database migration to make all Massgov Eopss URLs absolute.\n"
},
{
"from": "gpt",
"value": "\"\"\"absolute_massgov_eopss_url\n\nRevision ID: a1b42c9006a7\nRevises: 9b30b0fe231a\nCreate Date: 2017-06-26 00:02:45.998655\n\n\"\"\"\nfrom alembic import op\nimport sq... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.