conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add excel sheet column title question description\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSource : https://oj.leetcode.com/problems/excel-sheet-column-number/\nAuthor : Changxi Wu\nDate : 2015-01-21\n\nGiven a column title as appear in an Excel sheet, return its c... | python | chosen |
[
{
"from": "human",
"value": "Add test for PowerStrike ability\n"
},
{
"from": "gpt",
"value": "import unittest\nimport unittest.mock as mock\n\nfrom hunting.level.map import LevelMap, LevelTile\nfrom hunting.sim.entities import GameObject, Fighter\nfrom hunting.sim.skills import PowerStrike\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating a historic version of the Dutch LIWC\n\nAdded the script for generating a historic version of the Dutch LIWC.\nThis script was not yet committed in the old liwc project. The same\nholds for the files historic_Dutch_LIWC.dic and liwc_output.json.\n"
},... | python | chosen |
[
{
"from": "human",
"value": "Add migration file that removes last_modification_date\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2016-09-01 01:27\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migration... | python | chosen |
[
{
"from": "human",
"value": "Add test server to demo functionality\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Author: sc0tfree\n# Twitter: @sc0tfree\n# Email: henry@sc0tfree.com\n\nimport os\nimport socket\n\n\ndef generate_random_hex(length):\n '''\n Generates a hex string of... | python | chosen |
[
{
"from": "human",
"value": "Implement Api addons (not tested)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom importlib import import_module\nfrom inspect import isclass, getmembers\nfrom django.conf import setting... | python | chosen |
[
{
"from": "system",
"value": "Add partial support for firewall\n"
},
{
"from": "human",
"value": "'''Partial class to handle Vultr Firewall API calls'''\nfrom .utils import VultrBase\n\n\nclass VultrFirewall(VultrBase):\n '''Handles Bultr Firewall API calls'''\n def __init__(self, api_key)... | python | chosen |
[
{
"from": "human",
"value": "Add marker for 104th error"
},
{
"from": "gpt",
"value": "\"\"\"Marks all fixed errors #104 on ruwiki's CheckWikipedia.\"\"\"\r\nimport re\r\nimport pywikibot\r\nfrom checkwiki import load_page_list, mark_error_done, log\r\n\r\nNUMBER = \"104\"\r\nREGEXP = r\"<ref\\s... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights fix tree problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Fix Tree Problem\n\n\ndef fixTree(tree):\n return [s.strip().center(len(s)) for s in tree]\n\n\ndef main():\n tests = [\n [\n [\" *... | python | chosen |
[
{
"from": "human",
"value": "Add tests for calculating MIDI numbers - octave -1.\n\nSigned-off-by: Charlotte Pierce <351429ca27f6e4bff2dbb77adb5046c88cd12fae@malformed-bits.com>\n"
},
{
"from": "gpt",
"value": "# TODO: test if method to convert Note to a MIDI note number works\n\nimport pytest\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to update FamPlex groundings\n"
},
{
"from": "gpt",
"value": "import os\nimport requests\n\n# NOTE: this URL should be updated once the reach_export branch is merged\nbase_url = ('https://raw.githubusercontent.com/bgyori/famplex/reach_export/'\n ... | python | chosen |
[
{
"from": "human",
"value": "Use Caffe to cache feature vectors\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport os\nimport pickle\n\nimport caffe\ncaffe.set_mode_cpu()\ncaffe_root = os.path.normpath(os.path.dirname('%s/../../../../' % caffe.__file__))\n\nimport numpy as np\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Add tests for parsing numbers\n"
},
{
"from": "gpt",
"value": "from nex.tokens import PLYTokenMixin\nfrom nex.parsing import parsing\n\n\nimport pytest\n\n\nclass T(PLYTokenMixin):\n def __init__(self, type_, v=None):\n self.type = type_\n self.value... | python | chosen |
[
{
"from": "human",
"value": "Add tests for typing errors\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport unittest\nfrom numba.compiler import compile_isolated\nfrom numba import types\nfrom numba.typeinfer import TypingError\n\n\ndef what():\n pass\n\n\ndef foo(... | python | chosen |
[
{
"from": "human",
"value": "Add number guess SVM file\n"
},
{
"from": "gpt",
"value": "# Requires sci-kit learn and matplotlib\n\nimport matplotlib.pyplot as pyplot\n\nfrom sklearn import datasets\nfrom sklearn import svm\n\ndigits = datasets.load_digits()\n\n#Gamma breaks when greater than 0.0... | python | chosen |
[
{
"from": "human",
"value": "Add a stub fake ICE peripheral\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nMAX_GPIO = 24\n\nimport serial\n\ns = serial.Serial('/tmp/com2', 115200)\nif not s.isOpen():\n raise IOError, \"Failed to open serial port\"\n\nGPIO_INPUT = 0\nGPIO_OUTPUT ... | python | chosen |
[
{
"from": "human",
"value": "Add my config as an example config.\n"
},
{
"from": "gpt",
"value": "from roland import lazy, Mode\n\n\nhome_page = 'https://www.google.com'\nsearch_page = 'https://www.google.com/search?q=%s'\n\ncommands = {\n 'i': lazy.set_mode(Mode.Insert),\n 'colon': lazy.s... | python | chosen |
[
{
"from": "human",
"value": "Add solution for 171:Excel sheet column number\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def titleToNumber(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n # A-Z:65-90 || a-z:97-122 \n # ord('A')... | python | chosen |
[
{
"from": "human",
"value": "Create a conf file for the internet.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nRATE = 150000.00\nFORMAT = 'list'\nPORT = '445'\nOUTFILE = 'internet_{0}.list'.format(PORT)\nBANNER = 'false'\n\nwith open('internet.conf', 'w') as f:\n f.write('# Inte... | python | chosen |
[
{
"from": "human",
"value": "Add some basic tests for Channel(Stderr)File\n"
},
{
"from": "gpt",
"value": "from mock import patch, MagicMock\n\nfrom paramiko import Channel, ChannelFile\n\n\nclass TestChannelFile(object):\n @patch(\"paramiko.channel.ChannelFile._set_mode\")\n def test_defa... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating enums.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport re\n\nvalgrind_home = \"/usr\"\n\ninput = open(valgrind_home + \"/include/valgrind/libvex_ir.h\").read()\ninput += open(valgrind_home + \"/include/valgrind/libvex.h\").r... | python | chosen |
[
{
"from": "human",
"value": "Add initial test class for subaccount\n"
},
{
"from": "gpt",
"value": "import httpretty\n\nfrom paystackapi.tests.base_test_case import BaseTestCase\nfrom paystackapi.subaccount import SubAccount\n\n\nclass TestSubAccount(BaseTestCase):\n\n @httpretty.activate\n ... | python | chosen |
[
{
"from": "human",
"value": "Test if all commands can import\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2009, 2010, 2011 Hans van Leeuwen.\n# See LICENSE.txt for details.\n\nfrom __future__ import unicode_literals\n\nimport unittest\nimport... | python | chosen |
[
{
"from": "human",
"value": "Test of access to a dataset's blocks.\n\nSee #6.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport rasterio\n\nclass RasterBlocksTest(unittest.TestCase):\n def test_blocks(self):\n with rasterio.open('rasterio/tests/data/RGB.byte.tif') as s:\n ... | python | chosen |
[
{
"from": "human",
"value": "Create test case to ensure data from initial_categories is loaded\n\nHad to run tasks.clear_db() first as one of the migration files includes importing the initial_categories.json file and saving this to the db.\n\nTests check data from both fixture files, initial_categories.jso... | python | chosen |
[
{
"from": "human",
"value": "Add binary script for getting HT record number\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.... | python | chosen |
[
{
"from": "human",
"value": "Test rasa show stories help\n"
},
{
"from": "gpt",
"value": "def test_show_stories_help(run):\n help = run(\"show\", \"stories\", \"--help\")\n\n help_text = \"\"\"usage: rasa show stories [-h] [-v] [-vv] [--quiet] [-d DOMAIN] [-s STORIES]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script that converts text files to input for the classifier\n\nThe script tokenizes the text and writes sentences in the correct format\nto file. Used for the Ceneton texts.\n"
},
{
"from": "gpt",
"value": "\"\"\"Script to convert text file to input for embem cla... | python | chosen |
[
{
"from": "human",
"value": "Test running with ALL and ALL_DEFINED\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom tests.acceptance import (\n run_gitlabform,\n)\n\n\nclass TestRunning:\n # noinspection PyPep8Naming\n def test__ALL(self, gitlab, group, project, other_project):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add function to write Lammps files using lammps_interface.\n"
},
{
"from": "gpt",
"value": "# Date: September 2017\n# Author: Kutay B. Sezginel\n\"\"\"\nInitialize Lammps simulation using lammps_interface\n\"\"\"\nimport os\nfrom lammps_interface.lammps_main import L... | python | chosen |
[
{
"from": "human",
"value": "Add new, low-level security group rule blueprint\n\nThis should make it super simple to have a stack that\nmaintains security group rules on security groups built in other\nstacks. Mostly useful for rules that glue two stacks together\n(like adding a rule to allow instances in y... | python | chosen |
[
{
"from": "human",
"value": "testsuite: Add tests for help bot in contrib_bots.\n\nAdd test file 'test_help.py'.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nour_dir = os.path.d... | python | chosen |
[
{
"from": "human",
"value": "Create script for generation test queries\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport os\nimport sys\nimport time\ntry:\n import wikipedia\nexcept ImportError:\n print('Queries generation requires wikipedia package. \\n'\n 'You can i... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new moment functions\n"
},
{
"from": "gpt",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nimport numpy as np\nf... | python | chosen |
[
{
"from": "human",
"value": "Test that uses the convert_dtype's get_shape\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\nfrom datetime import date\nfrom dynd import nd, ndt\n\nclass TestNDObjectCast(unittest.TestCase):\n def test_broadcast_cast(self):\n a = nd.ndobject(1... | python | chosen |
[
{
"from": "human",
"value": "Create the first Sierra window generator\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n\"\"\"\nPublish a new Sierra update window to SNS.\n\"\"\"\n\nimport os\n\nimport boto3\nimport maya\n\nfrom wellcome_aws_utils.sns_utils import publish_sns_message\n... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for volume availability zone client\n\nThis patch adds unit test for volume v2 availability zone client.\n\nPartially Implements: blueprint tempest-lib-missing-test-coverage\n\nChange-Id: I94f758307255de06fbaf8c6744912b46e15a6cb2\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Add script to take a result set and turn them all into timeouts.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# vim: set sw=2 ts=2 softtabstop=2 expandtab:\n\"\"\"\nThis script is designed to take a set of results\nand set them all to timeouts.\n\"\"\"\nim... | python | chosen |
[
{
"from": "human",
"value": "Add benchmark for building transforms (not including compilation time)\n"
},
{
"from": "gpt",
"value": "from warnings import WarningMessage\nimport pytest\nimport subprocess\nimport os\nimport h5py\nimport numpy as np\nimport time\nfrom desc.__main__ import main\n\nf... | python | chosen |
[
{
"from": "human",
"value": "Add basic functionality for using the MTA service status feed\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nimport urllib2\nimport xml.etree.ElementTree as ET\n\nMTA_SERVICE_STATUS_URL = 'http://web.mta.info/status/serviceStatus.txt'\n\n\ndef servic... | python | chosen |
[
{
"from": "human",
"value": "Add a django model to save emails and specify subscriptions.\n"
},
{
"from": "gpt",
"value": "from django.db import models\nfrom datetime import datetime\nimport settings\n\nclass Email(models.Model):\n ''' Monitor emails sent '''\n to = models.ForeignKey(... | python | chosen |
[
{
"from": "human",
"value": "droplets: Add a tool to clean up old hostnames in DNS.\n"
},
{
"from": "gpt",
"value": "import argparse\nimport configparser\nimport os\n\nimport digitalocean\n\n\ndef get_config() -> configparser.ConfigParser:\n config = configparser.ConfigParser()\n config.re... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 383. Ransom Note\n\n383. Ransom Note: https://leetcode.com/problems/ransom-note/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def canConstruct(self, ransomNote, magazine):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for service function that counts ordered article by payment state\n"
},
{
"from": "gpt",
"value": "\"\"\"\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom itertools import count\n\nfrom byceps.serv... | python | chosen |
[
{
"from": "human",
"value": "Add an auxiliary Python script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport math\nimport numpy as np\nimport sqlite3\n\ndef read(path='tests/fixtures/google.sqlite3'):\n connection = sqlite3.connect(path)\n cursor = connection.cursor()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for `license info` function\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n Tests for the `license info` function\n\"\"\"\n\nfrom click.testing import CliRunner\n\nfrom choosealicense.main import info\n\n\ndef t... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for package directories\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests directories set in the package definition file.\"\"\"\n\nimport os\nfrom nose.tools import assert_true\nfrom .. import package_dir, data_dir\n\n\ndef test_package_dir_is_set():\n a... | python | chosen |
[
{
"from": "system",
"value": "Add a create page test"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom pages.models import *\nfrom django.test.client import Client\n\nclass PagesTestCase(TestCase):\n fixtures = ['tests.json']\n\n def test_01_add_page(self):\n \... | python | chosen |
[
{
"from": "human",
"value": "Add module for Python 3 compatibility layer.\n"
},
{
"from": "gpt",
"value": "import sys\n\ndef no_code(x, encoding=None):\n return x\n\ndef decode(s, encoding=None):\n encoding = encoding or sys.stdin.encoding or sys.getdefaultencoding()\n return s.decode(e... | python | chosen |
[
{
"from": "human",
"value": "Add sample file with secrets (db credentials and secret_key).\n"
},
{
"from": "gpt",
"value": "# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = ''\n\n# Database\n# https://docs.djangoproject.com/en/1.7/ref/settings/#databases\n\nDATABA... | python | chosen |
[
{
"from": "human",
"value": "Add migration that add blank on file field\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2016-11-11 01:44\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.... | python | chosen |
[
{
"from": "human",
"value": "Add script to split data into training and testing\n"
},
{
"from": "gpt",
"value": "# Copyright 2017 Rice University\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": "Move geometric functions into a separate file\n"
},
{
"from": "gpt",
"value": "import math\n\ndef line_magnitude (x1, y1, x2, y2):\n return math.sqrt(math.pow((x2 - x1), 2) + math.pow((y2 - y1), 2))\n\n#Calc minimum distance from a point and a line segment (i.e. c... | python | chosen |
[
{
"from": "human",
"value": "Add plugin for docker tasks\n"
},
{
"from": "gpt",
"value": "from girder_worker import GirderWorkerPluginABC\n\n\nclass DockerPlugin(GirderWorkerPluginABC):\n\n def __init__(self, app, *args, **kwargs):\n self.app = app\n\n def task_imports(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add monitoring state for load average\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nMinion status monitoring\n\nMaps to the `status` execution module.\n'''\n\n__monitor__ = [\n 'loadavg',\n ]\n\n\ndef loadavg(name, maximum=None, minimum... | python | chosen |
[
{
"from": "human",
"value": "Add script to email users of name-conflicting packages.\n"
},
{
"from": "gpt",
"value": "import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt\nimport store, config\n\ntry:\n config = config.Config(sys.argv[1], 'webui')\nexcept IndexError:\n print ... | python | chosen |
[
{
"from": "human",
"value": "Add view for notice and comment homepage.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom operator import itemgetter\n\nimport logging\n\nfrom django.http import Http404\nfrom django.template.response import... | python | chosen |
[
{
"from": "human",
"value": "Add test of writing a file\n"
},
{
"from": "gpt",
"value": "import os.path as osp\nfrom tempfile import TemporaryDirectory\nfrom testpath import assert_isfile\n\nfrom karabo_data import RunDirectory, H5File\n\ndef test_write_selected(mock_fxe_run):\n with Temporar... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate statistics on liwc entities in texts\n\nThe script count the frequencies of liwc words given a liwc dictionary\n(modern or historic).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Script to generate stat... | python | chosen |
[
{
"from": "human",
"value": "Add a simple Shadow DOM / Shadow Root test\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass ShadowRootTest(BaseCase):\r\n def test_shadow_root(self):\r\n self.open(\"https://react-shadow.herokuapp.com/Patagonia\")\r\n ... | python | chosen |
[
{
"from": "human",
"value": "Add some helpful SQL indices\n\nAdds a few SQL indices that improve performance significantly as\nthe Designate database grows in size.\n\nChange-Id: If68b3f7883487e5379e7ab45f51a27ef7ecb2f58\nBlueprint: add-indices\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 20... | python | chosen |
[
{
"from": "human",
"value": "Add utilities for working with Django models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE. For\n# more information on... | python | chosen |
[
{
"from": "human",
"value": "TST: Add memory leak regression test\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport sys\nimport bottleneck as bn\nimport pytest\n\n\n@pytest.mark.skipif(\n sys.platform.startswith(\"win\"), reason=\"resource module not available on windows\"\n)\ndef t... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test of the trial division algorithm.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nif __name__ == '__main__':\n from find_primes import find_primes\n\n assert find_primes(50) == [\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 3... | python | chosen |
[
{
"from": "human",
"value": "Add `session` and `connection` fixtures\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache License, Version 2.0. See the LICENS... | python | chosen |
[
{
"from": "human",
"value": "Add tests for EnvironmentChecker object\n"
},
{
"from": "gpt",
"value": "import sys\n\nfrom botbot import env, envchecks\n\ndef test_EnvironmentChecker_constructor():\n assert env.EnvironmentChecker(sys.stdout)\n\ndef test_env_check_constructor_register():\n ec... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 670. Maximum Swap\n\n670. Maximum Swap: https://leetcode.com/problems/maximum-swap/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def maximumSwap(self, num):\n \"\"\"\n :type num: int\n :rtype: int\n \"\... | python | chosen |
[
{
"from": "human",
"value": "Add temporary bootstrapping to get the service working with how the charm presently expects to run the app.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nWSGI config for capomastro project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\... | python | chosen |
[
{
"from": "human",
"value": "Add an example file demonstrating defining, adding and serializing prov elements in a prov container\n"
},
{
"from": "gpt",
"value": "import json\nfrom provpy import *\n\n# Define your namespaces (see provpyexample_PROVURIRef_PROVNamespace.py)\nFOAF = PROVNamespace(\... | python | chosen |
[
{
"from": "human",
"value": "Add example for customizable hotkeys\n"
},
{
"from": "gpt",
"value": "import keyboard\n\nprint('Press and release your desired shortcut: ')\nshortcut = keyboard.read_shortcut()\nprint('Shortcut selected:', shortcut)\n\ndef on_triggered():\n\tprint(\"Triggered!\")\nke... | python | chosen |
[
{
"from": "human",
"value": "Add helper functions for permissions.\n"
},
{
"from": "gpt",
"value": "def user_can_view_scans(user, moon):\n return (\n user_can_delete_scans(user, moon) or\n user.has_perm('eve_sde.can_view_scans', moon.planet.system) or\n user.has_perm('eve... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for udiskie.match\n\nI hope this proves my modifications to be working.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\"\"\"\nTests for the udiskie.match module.\n\nThese tests are intended to demonstrate and ensure the correct usage of the\nconf... | python | chosen |
[
{
"from": "system",
"value": "Use PascaleCase notation in class\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2014 KTec S.r.l.\n# (<http://www.ktec.it>).\n#\n# Copyright (C) ... | python | chosen |
[
{
"from": "human",
"value": "CC-5133: Make sure Liquidsoap 1.1.1 is used\n\nadd missing file\n"
},
{
"from": "gpt",
"value": "import re\n\n\ndef version_cmp(version1, version2):\n def normalize(v):\n return [int(x) for x in re.sub(r'(\\.0+)*$','', v).split(\".\")]\n return cmp(norma... | python | chosen |
[
{
"from": "human",
"value": "Make tink a package and refactor aead into a package.\n\nPiperOrigin-RevId: 249473289\n"
},
{
"from": "gpt",
"value": "\"\"\"Tink package.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import google_type_annotations\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for utl module\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom aiodownload.util import clean_filename, make_dirs, default_url_transform\n\n\ndef test_clean_filename():\n\n sanitized_filename = clean_filename('français.txt')\n\n assert sanitized_fil... | python | chosen |
[
{
"from": "human",
"value": "Implement bubble sort algorithm with benchmarking\n"
},
{
"from": "gpt",
"value": "def bubble_sort(arr_list):\n # For bigO benchmarking\n num_of_comparison = 0\n num_of_exchanges = 0\n\n for pass_num in range(len(arr_list) - 1, 0, -1):\n for j in r... | python | chosen |
[
{
"from": "human",
"value": "Add a little test coverage for plugins, needs more.\n"
},
{
"from": "gpt",
"value": "from django.utils import unittest\nfrom hydra_agent import plugins\n\n\nclass TestPlugins(unittest.TestCase):\n def test_scan_plugins(self):\n \"\"\"Test that we get a list... | python | chosen |
[
{
"from": "human",
"value": "Add a simple validator for the Sensorama JSON format.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport json\n\ndef usage():\n print \"validate.py <jsonfilename>\\n\"\n sys.exit(1)\n\ndef main():\n if len(sys.argv) != 2:\n u... | python | chosen |
[
{
"from": "human",
"value": "Add script to process mtarchive's sounding archive"
},
{
"from": "gpt",
"value": "import subprocess\nimport datetime\nimport pytz\nimport urllib2\nfrom ingest_from_rucsoundings import RAOB\nimport psycopg2\n\nPOSTGIS = psycopg2.connect(database='postgis', host='iemdb... | python | chosen |
[
{
"from": "human",
"value": "Add problem solver to display results and give accurate measure of times to solve\n"
},
{
"from": "gpt",
"value": "#EulerRunner.py\nimport datetime\ndef solve_problem(solve_func):\n start = datetime.datetime.now()\n result = str(solve_func())\n end = datetim... | python | chosen |
[
{
"from": "human",
"value": "Make room arg list and Dojo instance\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Usage:\n create_room <name> <type_room>\n add_person <firstname> <surname> [wants_accomodation=\"N\"]\n dojo (-i | --interactive)\n dojo (-h | --help | --ver... | python | chosen |
[
{
"from": "human",
"value": "Add small helper class to check if float parameters are in allowed range\n"
},
{
"from": "gpt",
"value": "class FloatRange(object):\n def __init__(self, start, end):\n self.start = start\n self.end = end\n def __eq__(self, other):\n return ... | python | chosen |
[
{
"from": "human",
"value": "Add initial modules to calculate pn & ps\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Module to calculate pn ps.\"\"\"\nfrom Bio import AlignIO\nfrom Bio.Align import MultipleSeqAlignment\n\ndef calculate_pnps(genomes_a, genomes_b, sico_files):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add 50ep R50 Mask RCNN training recipe to D2 new baselines\n\nSummary: Added a training recipe with a shorter training time, reducing `train.max_iter` using the same pattern used to length it for the recipes >100ep.\n\nReviewed By: rbgirshick\n\nDifferential Revision: D28935200\... | python | chosen |
[
{
"from": "human",
"value": "Add a circle detection script.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*-\n\n#\n# Capture calibration circles\n#\n\n# External dependencies\nimport cv2\nimport numpy as np\n\n# Get the camera\ncamera = cv2.VideoCapture( 0 )\n# Acq... | python | chosen |
[
{
"from": "human",
"value": "refactor: Return angle between 0 and 2pi\n\nConsider cases when angle is greater than 2pi and less than -2pi, and when it is exactly 2pi."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport unittest\nfrom math import pi\n\nfrom orientation import get_angle_b... | python | chosen |
[
{
"from": "human",
"value": "Add a dumb language \"translator\" function.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\n# ##### BEGIN AGPL LICENSE BLOCK #####\n# This file is part of SimpleMMO.\n#\n# Copyright (C) 2012 Charles Nelson\n#\n# This program is free software: you can redi... | python | chosen |
[
{
"from": "human",
"value": "Add initial command bar module\n"
},
{
"from": "gpt",
"value": "'''\nDefine the command bar\n'''\n# Import third party libs\nimport urwid\n\n\nclass CommandBar(object):\n '''\n The object to manage the command bar\n '''\n def __init__(self, opts):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example of generate document by each test case.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n autodoc.tests.test_unittest\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Autodoc for UnitTest.\n\n\n :copyright: (c) 2014 Shinya Ohyanagi, All righ... | python | chosen |
[
{
"from": "human",
"value": "Test: Add test case for read_page\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom githubtrending import trending as githubtrending\n\nfrom . import data\n\nclass TestGithubTrending(unittest.TestCase):\n\n def test_read_page(self):\n for each in dat... | python | chosen |
[
{
"from": "human",
"value": "Add tests of certain basic infrastructure behavior\n"
},
{
"from": "gpt",
"value": "\r\nfrom nose.tools import eq_, assert_raises\r\nfrom utils import with_app, pretty_print_xml\r\nfrom sphinxcontrib.traceables.infrastructure import (Traceable,\r\n ... | python | chosen |
[
{
"from": "human",
"value": "Remove old type of image hashes\n\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef delete_imageinfo(apps, schema_editor):\n ImageInfo = apps.get_model('core.Image... | python | chosen |
[
{
"from": "human",
"value": "Add tests for bugs which have been fixed.\n"
},
{
"from": "gpt",
"value": "from copperhead import *\n\nimport unittest\n\n@cu\ndef dismantle((x, (y, z))):\n return x\n\n@cu\ndef tuple_inline_test(x):\n return dismantle((x,(x,x)))\n\nclass TupleInlineTest(unitte... | python | chosen |
[
{
"from": "human",
"value": "Make a prot_target table from bp+_tbl\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport sys\nimport gzip\nimport re\n\nfilename_tbl = sys.argv[1]\nfilename_base = re.sub(r'.bp\\+\\_tbl.gz', '', filename_tbl)\n\nprint(filename_tbl, filename_base)\nsys.ex... | python | chosen |
[
{
"from": "human",
"value": "Add Python script to stress test the system\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom json import dumps\nfrom random import randint\nfrom sys import argv\nfrom urllib.error import HTTPError\nfrom urllib.request import Request, urlopen\n\n\ndef p... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 653. Two Sum IV - Input is a BST\n\n653. Two Sum IV - Input is a BST: https://leetcode.com/problems/two-sum-iv-input-is-a-bst/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(sel... | python | chosen |
[
{
"from": "human",
"value": "Add simple tests for rmap\n"
},
{
"from": "gpt",
"value": "from skrt.utils import rmap\n\n\ndef test_list():\n list_ = [1, 2, 3, 4, 5]\n assert rmap(list_, lambda x: x**2, int) == [1, 4, 9, 16, 25]\n\n\ndef test_tuple():\n tuple_ = (1, 2, 3, 4, 5)\n asser... | python | chosen |
[
{
"from": "human",
"value": "Add test module for update_sample job\n\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport virtool.jobs.create_sample\n\n\n@pytest.fixture\ndef test_update_sample_job(mocker, tmpdir, loop, request, dbi, dbs, test_db_connection_string, test_db_name):\n tmpdir... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove duplicate results folders.\n"
},
{
"from": "gpt",
"value": "import shutil\nfrom argparse import ArgumentParser, ArgumentDefaultsHelpFormatter\nfrom pathlib import Path\n\n\ndef parse_args():\n # noinspection PyTypeChecker\n parser = Argumen... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.