conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to lauch ec2 instance\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\nStart new ec2 instance with open ssh port\n'''\n\n__author__ = \"Leonid Vasilyev, <vsleonid@gmail.com>\"\n\nimport json\nimport os\nimport sys\nimport time\nfrom datetime ... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton code for state machine\n\nState machine module will be implemented to allow for better unit\ntesting. We can better test each individual match mode using this\nmethod.\n"
},
{
"from": "gpt",
"value": "from enum import Enum\n\nclass match_state(Enum):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix the misspell Ochestration to Orchestration\n\nNow the 'Ochestration' is misspell\n\nThis patch fix it\n\nChange-Id: I7723354d23f31f3320439ae025c561082bb95115\n"
},
{
"from": "human",
"value": "from django.utils.translation import ugettext_lazy as _\n\n# The slug... | python | chosen |
[
{
"from": "human",
"value": "Add bot vs bot example\n"
},
{
"from": "gpt",
"value": "import sc2\nfrom sc2 import Race\nfrom sc2.player import Bot\n\nfrom zerg_rush import ZergRushBot\n\ndef main():\n sc2.run_game(sc2.maps.get(\"Abyssal Reef LE\"), [\n Bot(Race.Zerg, ZergRushBot()),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add serialization tests for tensorizer\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom ..util import make_tempdir\nfrom ...pipeline import TokenVectorEncoder as Tensorizer\n\nimport pytest\n\n\ndef test_serialize_tens... | python | chosen |
[
{
"from": "human",
"value": "Add verify 2FA webhook signature Python snippet\n"
},
{
"from": "gpt",
"value": "import base64\nimport hashlib\nimport hmac\n\nfrom django.conf import settings\nfrom django.http import HttpResponseForbidden\nfrom functools import wraps\ntry:\n from urllib.parse im... | python | chosen |
[
{
"from": "human",
"value": "Add a custom user report generation script for Metalogix, with\ninstructions.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFirst do the following:\n\nssh to the Metalogix server\n\n```\n(if necessary): sudo mv /tmp/metalogix_users.csv /tmp/metalogix_users.(date).csv\nsud... | python | chosen |
[
{
"from": "human",
"value": "Allow empty alterance_email in save tables\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAllow empty alternance email in SAVE\n\nRevision ID: 36188da1a919\nRevises: 6a40b75d390a\nCreate Date: 2021-07-19 10:33:57.780826\n\"\"\"\nfrom alembic import op\nfrom sqlalchemy.dial... | python | chosen |
[
{
"from": "human",
"value": "Add import script for start project pages\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.db import connection\nfrom django.utils.timezone import now\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Check if can access vultr.\n"
},
{
"from": "gpt",
"value": "from urllib import request, response\nimport json\n\ndef can_access(api_key):\n req = request.Request('https://api.vultr.com/v1/auth/info')\n req.add_header('API-Key', api_key)\n\n try:\n wit... | python | chosen |
[
{
"from": "human",
"value": "Add deploy script using Fabric\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDeploy Freesound Explorer to labs.freesound.org (required Pythons's fabric installed)\n\"\"\"\n\n\nfrom __future__ import with_statement\nfrom fabric.api import *\nfrom fabric.contrib.files impor... | python | chosen |
[
{
"from": "human",
"value": "Add CustomTestCase class to format output of assertEqual\n"
},
{
"from": "gpt",
"value": "class CustomTestCase(object):\n def assertSentence(self, result, expected):\n try:\n self.assertEqual(result, expected)\n except AssertionError as e:... | python | chosen |
[
{
"from": "human",
"value": "Add a unit test for the pipeline range query\n\nSo we can check for 1c113c005b260a13bd93c33bf9b033184c2f0ea5\ngoing forward\n"
},
{
"from": "gpt",
"value": "import unittest\nimport logging\nimport arrow\nimport os\n\nimport emission.core.get_database as edb\nimport e... | python | chosen |
[
{
"from": "human",
"value": "Add file missed in previous commit.\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n#\n# Copyright 2013 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 with t... | python | chosen |
[
{
"from": "human",
"value": "Add test for managed alloc\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numba.cuda.cudadrv import driver\nfrom numba import cuda\nfrom numba.cuda.testing import unittest, ContextResettingTestCase\nfrom numba.cuda.testing import skip_on_cudasim\n\n\n@skip... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 508. Most Frequent Subtree Sum\n\n508. Most Frequent Subtree Sum: https://leetcode.com/problems/most-frequent-subtree-sum/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\n# Definition for a binary tree node.\n# class TreeNode(obj... | python | chosen |
[
{
"from": "human",
"value": "Add positioning module and Position object.\n"
},
{
"from": "gpt",
"value": "\nclass Position(object):\n\t\"\"\"Represents a postion and orientation in the arena.\"\"\"\n\n\tdef __init__(self, x, y, r=0):\n\t\tself.x = x\n\t\tself.y = y\n\t\tself.r = r % 360\n\n\tdef... | python | chosen |
[
{
"from": "human",
"value": "Add python wrapper for C extension\n"
},
{
"from": "gpt",
"value": "# vim: ft=python fileencoding=utf-8 sw=4 et sts=4\n\"\"\"Wrapper functions for the _image_enhance C extension.\"\"\"\n\nfrom gi.repository import Gdk\n\nfrom vimiv import _image_enhance\n\ndef enhanc... | python | chosen |
[
{
"from": "human",
"value": "Add XMPP relay message bot.\n"
},
{
"from": "gpt",
"value": "import os,sys,xmpp\n\ncurrentUser = None\nxmppClient = None\nnicks = {}\n\n###### Bot Command\ndef commandNick():\n pass\n \ndef commandHelp(client, user):\n message = \"\"\"\n !help - See this menu.\n ... | python | chosen |
[
{
"from": "human",
"value": "Test plugin integration with IVersionedDatastoreDownloads\n"
},
{
"from": "gpt",
"value": "from pathlib import Path\n\nfrom ckanext.nhm.plugin import NHMPlugin\n\n\ndef test_download_modify_email_templates():\n plugin = NHMPlugin()\n\n original_plain = 'origina... | python | chosen |
[
{
"from": "human",
"value": "Add covnergence test for multiple spheres\n"
},
{
"from": "gpt",
"value": "import numpy\nfrom convergence_lspr import (run_convergence, picklesave, pickleload,\n report_results, richardson_extrapolation_lspr,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a (weird) test file for testing the javascript comment stripping\n\nI had this on my drive anyway so why not just add it to the repo.\n"
},
{
"from": "gpt",
"value": "import re\n\nreexpr = r\"\"\"\n ( # Capture code\n (?:\n... | python | chosen |
[
{
"from": "system",
"value": "Make README file extension lowercase so build will pass on case sensitive systems\n"
},
{
"from": "human",
"value": "from distutils.core import setup\n\nsetup(\n name='pyxdevkit',\n version='0.1dev',\n packages=['pyxdevkit',],\n license='MIT',\n autho... | python | chosen |
[
{
"from": "human",
"value": "Add script to download AppVeyor artifacts"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Downloads AppVeyor artifacts to the local directory.\n#\n# This script is a bit hacky. But it gets the job done.\n\nimport sys\n\nimport requests\n\n\ndef make_request... | python | chosen |
[
{
"from": "human",
"value": "Add tests for noncommutative symbols.\n\n - complex\n - conjugate\n - expand\n - factor\n - radsimp\n - simplify\n - subs\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for noncommutative symbols and expressions.\"\"\"\n\nfrom sympy import (\n conjugate,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add first admin levels script\n\nConnects #573.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport csv\nimport json\n\nstates = set()\n\nwith open('2015_06_29_NNHS_2015_Selected EA_Final.xlsx - EA_2015.csv') as csvfile:\n reader = csv.reader(csvfile,... | python | chosen |
[
{
"from": "human",
"value": "Add tests for null sink developed previously in cycamore repository\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n\nfrom nose.tools import assert_false\nimport os\nimport tables\nimport numpy as np\nfrom tools import check_cmd\n\n\"\"\" Tests \"\"\"\ndef test_... | python | chosen |
[
{
"from": "human",
"value": "Define a basic interface and successfully recognize +2 pattern\n"
},
{
"from": "gpt",
"value": "def constant(diffs):\r\n val = diffs.pop()\r\n for d in diffs:\r\n if d != val:\r\n return False\r\n return val\r\n\r\ndef pat1(seq): # con... | python | chosen |
[
{
"from": "human",
"value": "Add file with usage of Mixed Integer Programming with Pulp\n"
},
{
"from": "gpt",
"value": "# Copyright 2016 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the Lic... | python | chosen |
[
{
"from": "human",
"value": "Add fuel dataset for CUB200_2011\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Feb 11 00:57:05 2017\n\n@author: sakurai\n\"\"\"\n\nfrom fuel.datasets import H5PYDataset\nfrom fuel.utils import find_in_data_path\nfrom fuel.schemes im... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for compile builtin.\n"
},
{
"from": "gpt",
"value": "# test compile builtin\n\ntry:\n compile\nexcept NameError:\n print(\"SKIP\")\n import sys\n sys.exit()\n\nc = compile(\"print(x)\", \"file\", \"exec\")\n\ntry:\n exec(c)\nexcept Nam... | python | chosen |
[
{
"from": "human",
"value": "Add test for source file generation\n"
},
{
"from": "gpt",
"value": "from random import random\n\nimport h5py\nimport numpy as np\nimport openmc\n\n\ndef test_source_file(run_in_tmpdir):\n # Create source particles\n source = []\n n = 1000\n for i in rang... | python | chosen |
[
{
"from": "human",
"value": "Test export epub script added\n"
},
{
"from": "gpt",
"value": "from gnowsys_ndf.ndf.models import *\nfrom gnowsys_ndf.ndf.views.export_to_epub import *\nn = node_collection.one({'_id': ObjectId('5752b5392e01310424dcf6cc')})\ncreate_epub(n.name, n.collection_dict)"
... | python | chosen |
[
{
"from": "system",
"value": "Add Arduino USB Vendor and product IDs\n"
},
{
"from": "human",
"value": "\nARDUINO_SENSOR_TYPE=\"arduino\"\nSIMULATED_SENSOR_TYPE=\"simulated\"\nAUTO_DETERMINE_SENSOR=\"auto\"\n\n# TODO - put this as a CNAME and an SRV record in DNS instead\nIN_PROCESS_DESTINATION=... | python | chosen |
[
{
"from": "human",
"value": "Add test for contingency table fix\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import assert_equal\nfrom gala import evaluate as ev\n\ndef test_contingency_table():\n seg = np.array([0, 1, 1, 1, 2, 2, 2, 3])\n gt = np.array([1, 1, 1,... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests around the Union type\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase, skip\n\nfrom polygraph.exceptions import PolygraphValueError\nfrom polygraph.types.basic_type import Union\nfrom polygraph.types.scalar import Float, Int, String\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for calculating brew house yield\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport unittest\n\nfrom brew.utilities.efficiency import calculate_brew_house_yield\nfrom fixtures import recipe\n\n\nclass TestEfficiencyUtilities(unittest.TestCase)... | python | chosen |
[
{
"from": "human",
"value": "Structure for density ratio estimators\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Carl is free software; you can redistribute it and/or modify it\n# under the terms of the Revised BSD License; see LICENSE file for\n# more details.\n\n\"\"\"Density... | python | chosen |
[
{
"from": "human",
"value": "Add tests to sanity check command\n"
},
{
"from": "gpt",
"value": "\nimport os\nimport mock\n\nfrom django.core.management import call_command\nfrom django.db.utils import DatabaseError\nfrom django.test import TestCase\n\n\ndevnull = open(os.devnull, 'w')\n\n\n@mock... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add example of adding widgets to plugin\n"
},
{
"from": "gpt",
"value": "from skimage import data\nfrom skimage.filter import canny\n\nfrom skimage.viewer import ImageViewer\nfrom skimage.viewer.widgets import Slider\nfrom skimage.viewer.plugins.overlayplugin im... | python | chosen |
[
{
"from": "human",
"value": "Add tool for sending Github payloads to a local instance\n\nThis is very useful for testing our Github integration.\n\n(imported from commit c61fd883c599395d31416a25090e57594fddeadf)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport sys\nimport os\nimport si... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert CybOX XML to CybOX JSON.\n"
},
{
"from": "gpt",
"value": "#!\\usr\\bin\\env python\n\nimport os\nimport sys\n\nimport cybox.bindings.cybox_core_1_0 as core_binding\nfrom cybox.core import Observables\n\ndef from_file(filename):\n cybox_obj = ... | python | chosen |
[
{
"from": "human",
"value": "Add helpers to create websocket requests\n"
},
{
"from": "gpt",
"value": "# Oxypanel\n# File: util/web/websockets.py\n# Desc: helpers to make authed websocket requests\n\nfrom uuid import uuid4\n\nimport config\nfrom app import redis_client\nfrom util.web.user import... | python | chosen |
[
{
"from": "human",
"value": "Implement 2019 day 13 part 1\n"
},
{
"from": "gpt",
"value": "from typing import TextIO\n\nfrom aoc2019.intcode import Computer, read_program\n\n\ndef part1(data: TextIO) -> int:\n computer = Computer(read_program(data))\n\n computer.run()\n\n screen = {}\n\... | python | chosen |
[
{
"from": "human",
"value": "Add simple smoketest for clipboard access\n"
},
{
"from": "gpt",
"value": "import nose.tools as nt\n\nfrom IPython.core.error import TryNext\nfrom IPython.lib.clipboard import ClipboardEmpty\nfrom IPython.utils.py3compat import unicode_type\n\ndef test_clipboard_get(... | python | chosen |
[
{
"from": "human",
"value": "Use MAL API to get watched show information.\n"
},
{
"from": "gpt",
"value": "def get_user_info(username):\n\n\t\"\"\" Retrieves information via MyAnimeList's API about a user's viewed anime and the\n\tcorresponding ratings. It only takes into account non-zero rating... | python | chosen |
[
{
"from": "human",
"value": "Add rudimentary unit test for APDUError\n"
},
{
"from": "gpt",
"value": "\nimport unittest\n\nfrom u2flib_host import exc\n\n\nclass APDUErrorTest(unittest.TestCase):\n def test_init(self):\n error = exc.APDUError(0x3039)\n self.assertEqual(error.arg... | python | chosen |
[
{
"from": "system",
"value": "Fix formatting bug in repr\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport six\nimport numpy as np\nimport pandas as pd\n\n\nclass TimeSlice(object):\n \"\"\"\n A slice of time: has a start time, a duration, and a reference to an Audio obje... | python | chosen |
[
{
"from": "system",
"value": "Allow meta and debug tasks to not be named\n\nFixes #176\n"
},
{
"from": "human",
"value": "# Copyright (c) 2016 Will Thames <will@thames.id.au>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated doc... | python | chosen |
[
{
"from": "human",
"value": "Add test case for variable registration\n"
},
{
"from": "gpt",
"value": "import angr\nimport nose\n\ndef test_registration():\n s = angr.SimState(arch='AMD64')\n\n a1 = s.solver.BVS('a', 64, key=(1,), eternal=True)\n a2 = s.solver.BVS('a', 64, key=(1,), eter... | python | chosen |
[
{
"from": "human",
"value": "Add tests for expected errors\n"
},
{
"from": "gpt",
"value": "import logging\nimport json\nimport inspect\nimport pytest\nfrom mappyfile.parser import Parser\nfrom mappyfile.pprint import PrettyPrinter\nfrom mappyfile.transformer import MapfileToDict\nfrom lark.comm... | python | chosen |
[
{
"from": "human",
"value": "Add module that parses and loads target descriptions.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFunctions for managing targets.\n\"\"\"\n\nimport json\nimport logging\nimport os\nimport glob\n\nimport services\nfrom services import *\n\n\nclass Target(object):\n de... | python | chosen |
[
{
"from": "human",
"value": "Add couple of random tests, just to achieve 100% test coverage \\o/.\n"
},
{
"from": "gpt",
"value": "import pycron\n\n\ndef test_parse_arg():\n assert pycron._parse_arg('1/5', 0) is False\n assert pycron._parse_arg('asd-dsa', 0) is False\n\n\ndef test_no_dt():... | python | chosen |
[
{
"from": "human",
"value": "Add a couple simple pytest tests for roster class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport pytest\nfrom datetime import datetime\nfrom mlbgame import roster\n\nteam_id = 117\nr = roster.Roster(team_id)\n\ndef test_roster_url():\n roster_url =... | python | chosen |
[
{
"from": "human",
"value": "Implement the general_poly function that reurns a function, applies a number, and returns a value\n"
},
{
"from": "gpt",
"value": "# Problem 7\n# 20.0 points possible (graded)\n# Write a function called general_poly.\n\ndef general_poly(L):\n \"\"\" L, a list of num... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for header image validator\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport mezzanine.core.fields\nimport website.jdpages.models\n\n\nclass Migr... | python | chosen |
[
{
"from": "human",
"value": "Add example script for image labelling\n"
},
{
"from": "gpt",
"value": "\"\"\"\n===================\nLabel image regions\n===================\n\nThis example shows how to segment an image with image labelling.\n\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport matp... | python | chosen |
[
{
"from": "human",
"value": "Add a Syzygy fetch config.\n\nReview URL: https://codereview.chromium.org/1749213002\n\ngit-svn-id: fd409f4bdeea2bb50a5d34bb4d4bfc2046a5a3dd@299057 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",
"value": "# Copyright 2016 The Chromium Authors. All rights... | python | chosen |
[
{
"from": "human",
"value": "Add script to list all jenkins jobs\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nimport glob\nimport os\nimport re\nimport json\n\nJOBS_PATH = './'\n\nos.chdir(JOBS_PATH)\n\njobs = {\n 'job': [],\n 'pipelineJob': []\n}\n\nfor job_fi... | python | chosen |
[
{
"from": "human",
"value": "Add snippet to remove overlaps on TTF with skia-pathops\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python3\n\n# Example script to remove overlaps in TTF using skia-pathops\n\n\nimport sys\nfrom fontTools.ttLib import TTFont\nfrom fontTools.pens.recordingPen imp... | python | chosen |
[
{
"from": "human",
"value": "Allow to call manage.py as python -m pretix\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"pretix.settings\")\n\n from django.core.management import execute_from_comma... | python | chosen |
[
{
"from": "human",
"value": "Add a test for contrib.messagelog's _log() method\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# vim: ai ts=4 sts=4 et sw=4\n\n\nfrom rapidsms.conf import settings\nimport rapidsms.contrib.messagelog.app\n\n\ndef test_messagelog():\n app = rapidsms.cont... | python | chosen |
[
{
"from": "human",
"value": "Add initial stub of documentation command\n"
},
{
"from": "gpt",
"value": "#\n# Copyright 2017 Import.io\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a co... | python | chosen |
[
{
"from": "human",
"value": "Test showing that users cannot be updated.\n"
},
{
"from": "gpt",
"value": "import json\n\ndef test_patch_user(app, ACCOUNTS):\n from mongokit import Document, Connection\n from hummedia import config\n from hummedia.models import User\n from bson.objectid import... | python | chosen |
[
{
"from": "human",
"value": "Add test case for AcousticMaterial.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport pyfds as fds\n\n\ndef test_acoustic_material():\n water = fds.AcousticMaterial(1500, 1000)\n water.bulk_viscosity = 1e-3\n water.shear_viscosity = 1e-3\n asser... | python | chosen |
[
{
"from": "human",
"value": "Allow to specify function signature\n"
},
{
"from": "gpt",
"value": "from functools import wraps\nfrom six import iteritems\n\nfrom .properties import Property\n\n_do_type_check = False\n\ndef _type_check(func, type_spec):\n pass\n\ndef sig(**type_spec):\n for ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for EnvironmentBase class\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the csdms.dakota.environment.base module.\"\"\"\n\nfrom nose.tools import raises, assert_true, assert_equal\nfrom csdms.dakota.environment.base import EnvironmentBase\n\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add migration that back populates the new commit field in the HqDeploy model\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.13 on 2020-07-30 18:59\n\nfrom django.db import migrations\nfrom corehq.util.django_migrations import skip_on_fresh_install\n\n\n@s... | python | chosen |
[
{
"from": "human",
"value": "Create sample image generation script\n"
},
{
"from": "gpt",
"value": "from subprocess import Popen, PIPE\nimport tempfile, logging, os\n\ndef create_image_from_map(map_file, dll_location):\n\n of = tempfile.NamedTemporaryFile(delete=False, suffix=\".png\", prefix... | python | chosen |
[
{
"from": "human",
"value": "DOC: Add an example configuration file.\n"
},
{
"from": "gpt",
"value": "c = get_config()\n\n# Tell IPython to use PostgresContentsManager.\nc.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'\n\n# Set the url for the database used t... | python | chosen |
[
{
"from": "human",
"value": "Add script to change password for API user\n"
},
{
"from": "gpt",
"value": "import click\nfrom flask import Flask\nimport models\n\n# create the application object\napp = Flask(__name__)\napp.config.from_pyfile('config.py')\nmodels.db.init_app(app)\n\n@click.command(... | python | chosen |
[
{
"from": "human",
"value": "PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib\n"
},
{
"from": "gpt",
"value": "#\n# pymoku example: Plotting Oscilloscope with pyqtgraph\n#\n# This example demonstrates how you can configure the Oscilloscope instru... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 437. Path Sum III\n\n437. Path Sum III: https://leetcode.com/problems/path-sum-iii/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\n# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# ... | python | chosen |
[
{
"from": "human",
"value": "Resolve migration conflict via merge\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 ('survey', ... | python | chosen |
[
{
"from": "human",
"value": "Add a simple script which just dumps any IGMP traffic which it sees.\nThis exercises the centralized IGMP receive path.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom pcs.packets.localhost import *\nfrom pcs.packets.ethernet import *\nfrom pcs.packets... | python | chosen |
[
{
"from": "human",
"value": "Add script to raw decode messages\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\"\"\"Raw decode sequence of messages with protoc.\n\nPass hex string (including variant length). Multiple messages\nare supported.\n\"\"\"\n\nimport os\nimport sys\nimport bin... | python | chosen |
[
{
"from": "human",
"value": "Allow `import chainer.testing` without pytest\n"
},
{
"from": "gpt",
"value": "import unittest\n\n\ntry:\n import pytest # NOQA\n _error = None\nexcept ImportError as e:\n _error = e\n\n\nif _error is None:\n from chainer.testing._distribution_test impor... | python | chosen |
[
{
"from": "human",
"value": "Add a test for our fix\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Tests for email generation.\"\"\"\n\nfrom __future__ import unicode_literals\n\nfrom future.backports.email.mime.multipart import MIMEMultipart\nfrom future.backports.email.mime.te... | python | chosen |
[
{
"from": "human",
"value": "Add (empty, for now) data collator\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http... | python | chosen |
[
{
"from": "human",
"value": "Add migration files for new userprofile models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2018-03-23 17:47\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migration... | python | chosen |
[
{
"from": "human",
"value": "Implement Longest Increasing Subsequence in Python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\n\n\ndef read(fn):\n return fn(sys.stdin.readline())\n\n\ndef ceil(array, value):\n \"\"\"\n Returns the smallest index i such that array[... | python | chosen |
[
{
"from": "human",
"value": "Add test to detect Enums without enumeration.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\n# OpenFisca -- A versatile microsimulation software\n# By: OpenFisca Team <contact@openfisca.fr>\n#\n# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team\n# h... | python | chosen |
[
{
"from": "human",
"value": "Add utility script for modifying run mask.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Tobey Carman\n# Dec 2016\n\nimport netCDF4 as nc\nimport argparse\nimport textwrap\n\ndef show_mask(file, note):\n with nc.Dataset(file, 'r') as mask:\n print \... | python | chosen |
[
{
"from": "human",
"value": "Add recipe for board pin values\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as GPIO\nfrom hcsr04sensor import sensor\n\n# Created by Al Audet\n# MIT License\n\ndef main():\n '''Calculate the distance of an object in centimeters using a HCSR04 sensor\n a... | python | chosen |
[
{
"from": "human",
"value": "Replace title_abr_idx with new unique index that includes geometry_application_reference\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 1815829d365\nRevises: 3fcddd64a72\nCreate Date: 2016-02-09 17:58:47.362133\n\n\"\"\"\n\n# revision identifier... | python | chosen |
[
{
"from": "human",
"value": "Add interface script for bluetooth module\n"
},
{
"from": "gpt",
"value": "import rospy\nimport serial\nimport Adafruit_BBIO.UART as UART\nfrom std_msgs.msg import String\nimport binascii\n\nclass Hc05InterfaceNode(object):\n def __init__(self):\n rospy.ini... | python | chosen |
[
{
"from": "human",
"value": "Support for localized permissions on top of the static django model.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\n openslides.utils.translation_ext\n ~~~~~~~~~~~~~~~~~~~~~~~~\n\n Localizable descriptions for django... | python | chosen |
[
{
"from": "human",
"value": "Add get message unit tests\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom utils import get_message\n\nclass GetMessageUnitTests(unittest.TestCase):\n def test_get_message_is_callable(self):\n self.assertTrue(callable(get_message))\n\n\nif __name__ =... | python | chosen |
[
{
"from": "human",
"value": "Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects\n"
},
{
"from": "gpt",
"value": "import unittest\nimport astar\n\nclass BasicTests(unittest.TestCase):\n\n def test_bestpath(self):\n \"\"\"ensur... | python | chosen |
[
{
"from": "human",
"value": "Add a test for overriden __table_args__\n"
},
{
"from": "gpt",
"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: andraz@reciprocityla... | python | chosen |
[
{
"from": "human",
"value": "Add example for filter search\n"
},
{
"from": "gpt",
"value": "\"\"\"Module giving some examples how to use PyDOV to query boreholes.\"\"\"\n\n\ndef get_description():\n \"\"\"The description gives information about the Boring type.\"\"\"\n from pydov.search.gr... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for prxtransfer.org DNS records\n"
},
{
"from": "gpt",
"value": "import boto3\n\nclient = boto3.client(\"route53\")\n\n\n# List the FTP subdomains that should have explicit DNS records added\nsubdomains = [\n \"wxyz\",\n]\n\nchanges = []\n\nfo... | python | chosen |
[
{
"from": "system",
"value": "Remove \"active\" statements from constructor\n"
},
{
"from": "human",
"value": "import logging\n\nfrom config_resolver import Config\nimport cv2\n\nfrom camera import USBCam\nfrom processing import detect\nfrom raspicam.webui import make_app\n\n\nclass Application... | python | chosen |
[
{
"from": "human",
"value": "Add python plot generator (pyplot).\n"
},
{
"from": "gpt",
"value": "__author__ = 'Anti'\n\nimport scipy.signal\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\ndef getWave(freq, time, duty=0.5):\n np_square_wave_period = 2 * np.pi\n return [i if i != ... | python | chosen |
[
{
"from": "human",
"value": "Put my back-of-the-envelope math here to check against.\n"
},
{
"from": "gpt",
"value": "# Guess how many guesses it will take to guess a password.\n\nfrom __future__ import unicode_literals\n\nfrom ._implementation import words\n\ndef how_long(length=4, choices=len(... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for MGI client\n"
},
{
"from": "gpt",
"value": "from indra.databases import mgi_client\n\n\ndef test_lookups():\n assert mgi_client.get_id_from_name('Braf') == '88190'\n assert mgi_client.get_name_from_id('1926283') == 'Pgap6'\n assert mgi_cli... | python | chosen |
[
{
"from": "human",
"value": "[IMP] Migrate report_qweb_element_page_visibility module to 9.0\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#########################################################################\n# ... | python | chosen |
[
{
"from": "human",
"value": "Test regressions for the task extension\n\n* tests for testing regression of 19ad64a\r\n* fix edge case for test running within 3 minutes of the start of the hour"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n\nTests for discord.ext.tasks\n\n\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Disable compressor in test suite (compressor makes the test suite run 50% slower)\n"
},
{
"from": "human",
"value": "from django.conf import settings\nimport base64\nimport os\nimport os.path\n\n\ndef pytest_configure(config):\n if not settings.configured:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for load_component function\n\nIt uses the hydrotrend plugin, which is a default installed with pymt.\nThis might make the tests fragile.\n"
},
{
"from": "gpt",
"value": "from bmi_tester.bmipytest import load_component\n\n\nentry_point = 'pymt_hydrotrend.bm... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.