conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add new security group operation source code\n"
},
{
"from": "gpt",
"value": "from cloudify import ctx\nfrom cloudify import exceptions as cfy_exc\nfrom cloudify.decorators import operation\nfrom vcloud_plugin_common import with_vcd_client, wait_for_task\nfrom networ... | python | chosen |
[
{
"from": "human",
"value": "Add networkx graph display utilities.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nGraph manipulation and visualization tools\n\"\"\"\n\nimport tempfile\nimport os\n\nimport matplotlib.pyplot as plt\nimport networkx as nx\n\ndef imdisp(f):\n \... | python | chosen |
[
{
"from": "human",
"value": "Add script for filtering lines of IRTGs with multiple language preterms/terminals\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nfrom sets import Set\n\n#Should be used on IRTGs with multiple language preterms/terminals\ndef filter_lines(fn):\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for config.py functions and constants.\n\nSigned-off-by: Xavier Figueroa <2556c6f4facc1e5829d3394b9ce7316a84702c26@gmail.com>\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ imp... | python | chosen |
[
{
"from": "human",
"value": "Add a script to export Flaure DB\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\n\nfrom datetime import datetime\n\n# Config\ndbs = [\"F_ST_ETIENNE_CMPP\", \"F_ST_ETIENNE_CAMSP\", \"F_ST_ETIENNE_SESSAD\", \"F_ST_ETIENNE_SESSAD_TED\"]\ntables = [\... | python | chosen |
[
{
"from": "human",
"value": "Add the find input plugin, which will produce entries from a local directory that match a mask.\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1616 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n"
},
{
"from": "gpt",
"value": "import logging\r\nfrom flexget.plugin im... | python | chosen |
[
{
"from": "human",
"value": "Create Data resource for sending data from the server\n"
},
{
"from": "gpt",
"value": "from google.protobuf.json_format import MessageToDict\nfrom grpc.messages import data_pb2\nimport config\nfrom flask_restful import Resource\nfrom flask import request, Flask\nimpo... | python | chosen |
[
{
"from": "human",
"value": "Add an example Flask app\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Install dependencies with:\n# pip install flask requests requests_oauth2\nimport os\nimport logging\nimport requests\n\nfrom requests_oauth2.services import GoogleClient\nfrom request... | python | chosen |
[
{
"from": "human",
"value": "Add test with epsilon rules\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 19.08.2017 16:34\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom unittest import TestCase, main\nfrom grammpy import *\nfrom gr... | python | chosen |
[
{
"from": "human",
"value": "Add tests for oct enc/dec\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport unittest\nfrom quantized_mesh_tile.utils import octDecode, octEncode\n\n\nclass TestUtils(unittest.TestCase):\n\n def testOctDecode(self):\n vec3 = octDecode(0, 0)\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for geometry module\n"
},
{
"from": "gpt",
"value": "from gaphas.geometry import (\n distance_rectangle_point,\n intersect_line_line,\n point_on_rectangle,\n)\n\n\ndef test_distance_rectangle_point():\n assert distance_rectangle_point((2, 0, 2, ... | python | chosen |
[
{
"from": "system",
"value": "Use '0.0.0.0' to ensure your API is reachable outside localhost.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n Eve Demo\n ~~~~~~~~\n\n A demostration of a simple API powered by Eve REST API.\n\n The live demo is available at eve-... | python | chosen |
[
{
"from": "human",
"value": "Move 'TimeStampedModel' to 'base' so it can be used in other apps\n"
},
{
"from": "gpt",
"value": "from django.db import models\n\n\nclass TimeStampedModel(models.Model):\n \"\"\"\n An abstract base class model that provides self-updating\n ``created`` and `... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new reverse\n\nThis adds the tests that should have gone with commit 16250bf.\n"
},
{
"from": "gpt",
"value": "from nose.tools import eq_\n\nfrom fjord.base.tests import TestCase\nfrom fjord.base.urlresolvers import reverse\n\n\nclass TestReverse(TestCa... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for create a space.\n"
},
{
"from": "gpt",
"value": "#/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2010-2012 Cidadania S. Coop. Galega\n#\n# This file is part of e-cidadania.\n#\n# e-cidadania is free software: you can redistr... | python | chosen |
[
{
"from": "human",
"value": "Add wsgi file for 468\n"
},
{
"from": "gpt",
"value": "\"\"\"WSGI File for Web468\n\"\"\"\n\nimport os\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"marco.settings\")\nactivate_this = '/home/point97/env/marco_portal2/bin/activate_this.py'\nexecfile(activate_... | python | chosen |
[
{
"from": "system",
"value": "Bump version number because v5.0.0 was taken on pypi due to mistake\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nThis is a Django_ integration of Select2_.\n\nThe app includes Select2 driven Django Widgets and Form Fields.\n\n.. _Django: https... | python | chosen |
[
{
"from": "system",
"value": "Add version number to chainer module\n"
},
{
"from": "human",
"value": "from chainer import function\nfrom chainer import function_set\nfrom chainer.functions import basic_math\nfrom chainer import optimizer\nfrom chainer import variable\n\nVariable = variable.Varia... | python | chosen |
[
{
"from": "human",
"value": "Create a script to extract khan assessment resources.\n\nAnd place them into their own zip file. New zip file is compatible with\nkhan_assessment.zip from KA Lite releases 0.15.x and below.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nextract_khan_assessment\n\nCreates a... | python | chosen |
[
{
"from": "human",
"value": "Add sync menu backend init"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom PyQt4 import QtCore, QtGui\nfrom qt_interfaces.sync_menu_ui import Ui_SyncMenu\n\n# Synchronization menu section #\nclass SyncMenuUI(QtGui.QMainWindow):\n\n def __init__(self... | python | chosen |
[
{
"from": "human",
"value": "Add the missing migration left out from previous change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-11-08 14:32\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migratio... | python | chosen |
[
{
"from": "human",
"value": "Add a simple unit test for the config.\n\nBUG=http://code.google.com/p/chromium-os/issues/detail?id=14837\nTEST=It is a test. Ran it, with current and with a previous bad config.\n\nChange-Id: Ib20c89b6169dbc80a5c49487d732ccd20b7ab7cb\n"
},
{
"from": "gpt",
"value": ... | python | chosen |
[
{
"from": "human",
"value": "Add a test to check that delete cascade is working\n\nThis was a bit hard to get right, as there were lingering\nsessions. The session.remove() in the test is _critical_.\n"
},
{
"from": "gpt",
"value": "\nimport os\n\nimport py.test\n\nfrom tiddlyweb.config import c... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for image waiter\n\nThis commit adds unit tests for the image waiter in\ntempest.common.waiters. It adds tests for both the timeout case and\nthe success path.\n\nPartially implements bp unit-tests\n\nCo-Authored-With: Sean Dague <sean.dague@samsung.com>\n\nChange... | python | chosen |
[
{
"from": "human",
"value": "Add test module for header module.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n test_header\n ~~~~~~~~~~~\n\n Contains tests for the :mod:`~adbwp.header` module.\n\"\"\"\nimport pytest\n\nfrom adbwp import header\n\n\n@pytest.mark.xfail(reason='Not Implemented'... | python | chosen |
[
{
"from": "human",
"value": "Add file missed in 0c99863\n"
},
{
"from": "gpt",
"value": "\"\"\"\nManage AWS Lambda functions and their event sources\n\"\"\"\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os, sys, argparse, collections, random, str... | python | chosen |
[
{
"from": "human",
"value": "Add the tool to export the wiki pages from Planio\n"
},
{
"from": "gpt",
"value": "\"\"\"This script exports the wiki pages from Redmine.\n\nAll wiki pages on Redmine (https://cocomud.plan.io) are saved in the\n'doc' directory.\n\nRequirements:\n This script need... | python | chosen |
[
{
"from": "human",
"value": "Check closing the same file twice\n"
},
{
"from": "gpt",
"value": "from butter.eventfd import Eventfd\nfrom butter.fanotify import Fanotify\nfrom butter.inotify import Inotify\nfrom butter.signalfd import Signalfd\nfrom butter.timerfd import Timerfd\nimport pytest\ni... | python | chosen |
[
{
"from": "human",
"value": "Add digital ocean metadata grains\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: David Boucha\n :copyright: © 2014 by the SaltStack Team, see AUTHORS for more details.\n :license: Apache 2.0, see LICENSE for more details.\n\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Remove payable mixin - db migrations\n\n - nc-1554\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a conversion from the Hamiltonian cycle problem to SAT\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"\nConversion of the Hamiltonian cycle problem to SAT.\n\"\"\"\n\nfrom boolean import *\n\ndef hamiltonian_cycle(l):\n \"\"\"\n Convert a direc... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking file is valid utf8\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Check whether a file contains valid UTF-8\n# From http://stackoverflow.com/a/3269323\n\nimport codecs\nimport sys\n\n\ndef checkFile(filename):\n try:\n wit... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract Arduino IDE program size.\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# encoding: utf-8\n\n# In order to use this script from shell:\n# > ./build-samples >tempsizes\n# > cat tempsizes | ./stats.py >sizes\n# > rm tempsizes\n# Then sizes... | python | chosen |
[
{
"from": "human",
"value": "Add script to find undocumented translations.\n\nTo my knowledge there's no convenient way to find out if a string is missing a\ntranslation into a particular language. For us this means that it's not easy\nto check all of our strings and make sure they have documentation for ou... | python | chosen |
[
{
"from": "human",
"value": "Add CRUD model DB test cases for RBAC models.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regardin... | python | chosen |
[
{
"from": "human",
"value": "scripts: Add script to split kernel config files\n\nThis script is slightly modified from the ChromiumOS splitconfig\n\nIt takes a number of kernel config files and prints the common\non specific kernel config options to seperate files.\n\nSigned-off-by: Rolf Neugebauer <6fdd1d8... | python | chosen |
[
{
"from": "human",
"value": "Add SPDU build and parse functions related to HTTP.\n"
},
{
"from": "gpt",
"value": "import struct\nfrom .spdy import *\nfrom .vle import spdy_add_vle_string, spdy_read_vle_string\n\ndef build_syn_stream_frame(frame, stream_id, host, method, path):\n\n\thdr_len = str... | python | chosen |
[
{
"from": "human",
"value": "Test using bezier going through 4 specific points\n\n\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nimport sys\nimport os\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))\n#\n\n\nimport cocos\nfrom cocos.director import directo... | python | chosen |
[
{
"from": "system",
"value": "Add one more 'need root' phrase"
},
{
"from": "human",
"value": "patterns = ['permission denied',\n 'EACCES',\n 'pkg: Insufficient privileges',\n 'you cannot perform this operation unless you are root',\n 'non-root users c... | python | chosen |
[
{
"from": "human",
"value": "Add admin field to Medication model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-01-21 21:26\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio... | python | chosen |
[
{
"from": "human",
"value": "Add script to normalise program paths.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# vim: set sw=2 ts=2 softtabstop=2 expandtab:\n\"\"\"\nStrip prefix from \"program\" key. This\ncan be used if slightly different paths\nwere used to generate result sets a... | python | chosen |
[
{
"from": "system",
"value": "Fix small mistake; options is a argument, not a member.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, unicode_literals\n\n# Import the fastest implementation of\n# pickle package. This should be removed\n# when... | python | chosen |
[
{
"from": "human",
"value": "Add script for assigning wrapped string variables (for storing binary data)\n"
},
{
"from": "gpt",
"value": "\n\ndef assign_binary_data(variable_name, initial_indent, maximum_width, data_string):\n \"\"\"\n Assign :attr:`data_string` to :attr:`variable_name` us... | python | chosen |
[
{
"from": "human",
"value": "migrations: Add migration to revoke invites from old deactivated users.\n\nThis is a natural follow-up to\n93e8740218bef0a7fea43197dc818393a5e43928 - invitations sent by users\ndeactivated before the commit still need to be revoked, via a\nmigration.\n\nThe logic for finding the... | python | chosen |
[
{
"from": "human",
"value": "Add basic N of a kind evaluation function for final hand.\n"
},
{
"from": "gpt",
"value": "from collections import namedtuple\nimport itertools\n\n# rows: list of lists for top, middle, bottom rows\n# draw: whatever has been drawn\n# remaining: set of remaining cards... | python | chosen |
[
{
"from": "system",
"value": "Use test_client() as context manager\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom tests.conftest import set_config_values\n\n\n@pytest.mark.parametrize('check_proxy_header,header_value,expected_code', [\n (True, 'key_1', 200),\n (True, 'wrong_key',... | python | chosen |
[
{
"from": "human",
"value": "Add example file for witch-mercy\n"
},
{
"from": "gpt",
"value": "from collections import namedtuple\nimport math\n\nBox = namedtuple('Box', ['count', 'cost'])\n\nMAX_COUNT = 50\nPROBABILITY = 1.0 / 60\nTABLE = [\n Box(2, 2400),\n Box(5, 6000),\n Box(11, 120... | python | chosen |
[
{
"from": "human",
"value": "Add gpio clean up tool\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as GPIO\n\nGPIO.setup(16, GPIO.IN)\nGPIO.setup(20, GPIO.IN)\nGPIO.setup(23, GPIO.IN)\nGPIO.setup(18, GPIO.IN)\nGPIO.setup(17, GPIO.IN)\nGPIO.setup(27, GPIO.IN)\nGPIO.setup(5, GPIO.IN)\n\nGPIO.cle... | python | chosen |
[
{
"from": "human",
"value": "Copy unit tests for StandardLogging fixture from Nova\n\nThis comes from commit f96ec4411ce89606cf52211061003c14306dcfa1\nin Nova by Sean Dague <sean@dague.net>.\n\nThe StandardLogging fixture was already merged into Cinder,\nthis adds the unit tests that were missed when copyin... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 27\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"\nI don't have found a clever solution, this is a brute force analysis\n\"\"\"\n\nfrom math import sqrt, ceil\n\nprime_list = [0] * 20000\n\n\ndef isPrime(x):\n if x < 0:\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement same&replace courses info crawler\n"
},
{
"from": "gpt",
"value": "import json\nimport getpass\nimport logging.config\nfrom . import mysnu\nfrom django.conf import settings\n\nlogging.config.dictConfig(settings.LOGGING)\n\n\ndef crawl():\n userid = input... | python | chosen |
[
{
"from": "human",
"value": "telemetry: Add record per area measurement.\n\nThis patch adds a record per area measurement which hooks into\npicture record microbenchmark.\n\nR=nduca@chromium.org\nNOTRY=True\n\nReview URL: https://codereview.chromium.org/27051005\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d5... | python | chosen |
[
{
"from": "human",
"value": "test: Use selector event loop on windows.\n\nThis gets most of the tests working again on windows with py38.\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport sys\n\n# Use the selector event loop on windows. Do this in tornado/test/__init__.py\n# instead of run... | python | chosen |
[
{
"from": "human",
"value": "Add new letter rates for March 1, 2022.\n\n- second class postage will go up by 2 pence, plus VAT\n- international postage will go up by 7 pence, plus VAT\n- first class postage will go down by 6 pence, plus VAT\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID:... | python | chosen |
[
{
"from": "human",
"value": "Add ClientError exception to handle sending back web socket errors to the client.\n"
},
{
"from": "gpt",
"value": "import json\n\n\nclass ClientError(Exception):\n def __init__(self, code):\n super(ClientError, self).__init__(code)\n self.code = code... | python | chosen |
[
{
"from": "human",
"value": "Add spider for XPO Logistics\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport re\nimport ast\nfrom locations.items import GeojsonPointItem\n\nclass XPOLogisticsSpider(scrapy.Spider):\n name = \"xpo_logistics\"\n allowed_domains = ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 373. Find K Pairs with Smallest Sums\n\n373. Find K Pairs with Smallest Sums: https://leetcode.com/problems/find-k-pairs-with-smallest-sums/\n"
},
{
"from": "gpt",
"value": "import heapq\nclass Solution(object):\n def kSmallestPairs(self, nums1... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate jupyterhub secret vars.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport binascii\nimport os\n\ndef random_hex(nb):\n return binascii.hexlify(os.urandom(nb)).decode('ascii')\n\nwith open('jupyterhub.env', 'w') as f:\n f.... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate cptm corpus for manifesto data\n\nThe script uses frog to parse text.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nimport pandas as pd\nimport logging\nimport argparse\nimport os\nimport glob\n\nfrom cptm.utils.i... | python | chosen |
[
{
"from": "human",
"value": "Add basic testing for the mysql target\n"
},
{
"from": "gpt",
"value": "'''\n$ mysql\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 211\nServer version: 5.6.15 Homebrew\n\nCopyright (c) 2000, 2013, Oracle and/or its affiliate... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate JS translation files from PO\n"
},
{
"from": "gpt",
"value": "# Requires that 'po2json' be installed and in $PATH\n# http://search.cpan.org/~getty/Locale-Simple-0.011/bin/po2json\n\nfrom glob import glob\nimport os\nimport re\nimport subprocess... | python | chosen |
[
{
"from": "human",
"value": "Test for the gallery plugin\n"
},
{
"from": "gpt",
"value": "from __future__ import with_statement\n\nfrom ass2m.ass2m import Ass2m\nfrom ass2m.server import Server\n\nfrom unittest import TestCase\nfrom webtest import TestApp\n\nfrom tempfile import mkdtemp\nfrom PI... | python | chosen |
[
{
"from": "human",
"value": "Add Problem abstract base class\n"
},
{
"from": "gpt",
"value": "from abc import ABCMeta, abstractmethod\n\n\nclass Problem(object):\n\n __metaclass__ = ABCMeta\n\n @abstractmethod\n def init(self, *args, **kwargs):\n \"\"\"Initialize the problem\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for influxdb create_continuous_query\n\nCurrently marked as xfail, since we'll pull the existing changes into\nhere.\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport salt.modules.influxdbmod as influx_mod\nimport salt.states.influxdb_continuous_quer... | python | chosen |
[
{
"from": "human",
"value": "Add testcase for sequence unpacking.\n"
},
{
"from": "gpt",
"value": "# Basics\na, b = 1, 2\nprint(a, b)\na, b = (1, 2)\nprint(a, b)\n(a, b) = 1, 2\nprint(a, b)\n(a, b) = (1, 2)\nprint(a, b)\n\n# Tuples/lists are optimized\na, b = [1, 2]\nprint(a, b)\n[a, b] = 100, 2... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for serializing rules\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom recurrence import Recurrence, Rule\nimport recurrence\n\n\ndef test_rule_serialization():\n rule = Rule(\n recurrence.WEEKLY\n )\n\n serialized =... | python | chosen |
[
{
"from": "human",
"value": "[CHORE] Add tests for whoami resource\n"
},
{
"from": "gpt",
"value": "import unittest\nimport json\n\nfrom tests.base import Base\n\n\nclass TestWhoAmIResource(Base):\n def test_returns_user_info(self):\n self.client.post(\"/api/v1/auth/register\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for detect similarities in translation string\n"
},
{
"from": "gpt",
"value": "import json\nimport os\nimport click\nfrom difflib import SequenceMatcher\n\nROOT_PATH = os.path.dirname(os.path.dirname(__file__))\nDEFAULT_LOCALE_PATH = os.path.join(ROOT_PATH... | python | chosen |
[
{
"from": "human",
"value": "Add example usage with sqlite\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# coding: utf-8\n\nimport json # https://docs.python.org/3/library/json.html\nimport requests # https://github.com/kennethreitz/requests\nimport records # https://github.com/kennet... | python | chosen |
[
{
"from": "human",
"value": "Add migration for min-length validation change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.29 on 2021-11-04 16:08\nfrom __future__ import unicode_literals\n\nimport django.core.validators\nfrom django.db import migrations\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add the whole program nice job\n"
},
{
"from": "gpt",
"value": "import csv\nimport sys\nimport itertools\n\n\ndef count_iter(iterable):\n # count lines in terable\n return sum(1 for _ in iterable)\n\n\ndef setup_iter(reader):\n # Skip first row of the file\n... | python | chosen |
[
{
"from": "human",
"value": "Add keyword filtering test file\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n#\n# :authors: Arturo Filastò\n# :licence: see LICENSE\n\nfrom ooni.templates import httpt\nclass KeywordFiltering(httpt.HTTPTest):\n \"\"\"\n This test involves perform... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 4. Median of Two Sorted Arrays\n\n4. Median of Two Sorted Arrays: https://leetcode.com/problems/median-of-two-sorted-arrays/\n\nReference: https://discuss.leetcode.com/topic/16797/very-concise-o-log-min-m-n-iterative-solution-with-detailed-explanation\n"
},... | python | chosen |
[
{
"from": "human",
"value": "Add script for plotting karma distribution in a post\n"
},
{
"from": "gpt",
"value": "import praw\nimport praw.helpers\nimport matplotlib.pyplot as plt\nimport argparse\n\nparser = argparse.ArgumentParser(description='Plot karma distributions of comments in a post')\... | python | chosen |
[
{
"from": "human",
"value": "Add test for transfer control check balance\n"
},
{
"from": "gpt",
"value": "import httpretty\n\nfrom paystackapi.tests.base_test_case import BaseTestCase\nfrom paystackapi.tcontrol import TransferControl\n\n\nclass TestTransfer(BaseTestCase):\n\n @httpretty.activ... | python | chosen |
[
{
"from": "system",
"value": "Upgrade PySocks to fix Python 3.10 compatbility\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\n\n\nwith open('README.rst') as readme:\n long_description = ''.join(readme).strip()\n\n\nsetup(\n name='rsocks',\n version='0.3.3... | python | chosen |
[
{
"from": "human",
"value": "Add the second version of QCM\n"
},
{
"from": "gpt",
"value": "\"\"\"\n QCM Version n°2\n\"\"\"\nimport random\n\n\ndef afficher_question(question):\n \"\"\" Affiche les informations de la question : question, réponses et points\n que l'on peut gagner.\n... | python | chosen |
[
{
"from": "human",
"value": "Add an example with logging\n"
},
{
"from": "gpt",
"value": "import logging\nlogging.basicConfig(level=logging.DEBUG, format='[%(asctime)-15s] [%(levelname)s] %(message)s')\n\nfrom collector import GraphiteCollector\n\nserver = GraphiteCollector(\"shamir.wu\", prefix... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for line model\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import assert_equal, assert_raises, assert_almost_equal\nfrom skimage.measure import LineModel, CircleModel, EllipseModel\n\n\ndef test_line_model_invalid_input():\n... | python | chosen |
[
{
"from": "human",
"value": "Add script that scans all lua files, extracts localizations and write a base enUS localization file.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nmake-base-localizations.py\n\nCreated by Alkis Evlogimenos on 2009-03-28.\n\"\"\"\n\nfrom glob import ... | python | chosen |
[
{
"from": "system",
"value": "Fix for slush's problem, perhaps\n"
},
{
"from": "human",
"value": "from PyQt4.QtGui import *\nfrom i18n import _\n\nclass HistoryWidget(QTreeWidget):\n\n def __init__(self, parent=None):\n QTreeWidget.__init__(self, parent)\n self.setColumnCount(2)... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Building model\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom complaints.models import Building\n\n\nclass BuildingTestCase(TestCase):\n \"\"\" Tests for the Building model.\n \"\"\"\n def setUp(self):\n self.b1_... | python | chosen |
[
{
"from": "human",
"value": "Test for the DotSchema class\n\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom tests.delete_test_db import delete_test_db # module that deletes the DB :)\nimport database.main\nfrom tests.create_test_db import engine, session, Base\n\n\ndatabase.main.engine... | python | chosen |
[
{
"from": "human",
"value": "Add sample RPC client and server framework"
},
{
"from": "gpt",
"value": "# Python-to-Python RPC using pickle and HTTP\n\nimport os, urllib2, pickle\nfrom BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler\n\n# Server side\n\nclass ServiceRequestHandler(BaseHTT... | python | chosen |
[
{
"from": "human",
"value": "Test the descriptors and its helpers\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom pytest import fixture, raises\n\nfrom openvpn_status.descriptors import (\n LabelProperty, name_descriptors, iter_descriptors)\n\n\n@fixture\ndef f... | python | chosen |
[
{
"from": "human",
"value": "Create a class to simulate the emittance exchange dynamical process.\n"
},
{
"from": "gpt",
"value": "import numpy as _np\nimport pyaccel as _pa\nimport pymodels as _pm\n\n\nclass EmittanceExchangeSimul:\n\n def __init__(self, accelerator='bo'):\n\n ACC_LIS... | python | chosen |
[
{
"from": "human",
"value": "Add initial attempt at graystruct\n"
},
{
"from": "gpt",
"value": "import json\nimport logging\nimport os\nimport socket\nimport zlib\n\nfrom graypy.handler import SYSLOG_LEVELS, GELFHandler as BaseGELFHandler\nfrom graypy.rabbitmq import GELFRabbitHandler as BaseGEL... | python | chosen |
[
{
"from": "human",
"value": "Add script calculate Major scale\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Author: hvn@familug.org\n# Tested with Python3\n# python major_scale.py C\n# ['C', 'D', 'E', 'F', 'G', 'A', 'B', 'C']\n\nimport argparse\n\n__doc__ =... | python | chosen |
[
{
"from": "human",
"value": "Add directory where test case will be populated\n"
},
{
"from": "gpt",
"value": "# Copyright 2007-2014 University Of Southern California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for tags/social profiles\n\nReading the documentation for [Flask-Migrate][1] seems to imply that\nthe way to do migrations for us is a two step process:\n\npython app.py db migrate --message \"Some message here\"\n\nthen, to test the migration:\n\npython app.py db ... | python | chosen |
[
{
"from": "human",
"value": "Add unique constraint to threats slug\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 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: anze@reciprocitylabs.c... | python | chosen |
[
{
"from": "human",
"value": "Add migration to update custom schedule instances' recipient ids\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.24 on 2021-11-19 14:36\n\nfrom django.db import migrations\nfrom corehq.messaging.scheduling.scheduling_partitioned.models import CaseTimedSche... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Revert \"Added an extension to allow rendering of integration objects in a Jinja2 template.\"\"\n\nThis reverts commit 94199d05795323c2747a7ce2e671d92f3c0be91f.\n"
},
{
"from": "gpt",
"value": "from coffin.template import Library\nfrom django.template.loader... | python | chosen |
[
{
"from": "human",
"value": "Use upper,split,translate and so on.\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n#print 'Pirce is %d'% 43\n#print 'Pirce is %x'% 43\n#print 'Pirce is %o'% 43\n#from math import pi\n#print 'Pi is %.2f'%pi\n#print 'Repr %r'%42L\n#print 'Str %s'%42L\n#prin... | python | chosen |
[
{
"from": "human",
"value": "Add OCS jlab testbed file\n"
},
{
"from": "gpt",
"value": "from fabric.api import env\n\n#Management ip addresses of hosts in the cluster\nhost1 = 'root@172.21.0.10'\nhost2 = 'root@172.21.0.13'\nhost3 = 'root@172.21.0.14'\nhost4 = 'root@172.21.1.12'\nhost5 = 'root@17... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to transform multi-images into a video.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Zhixian MA <zxma_sjtu@qq.com>\n# MIT license\n\n\"\"\"\nA simple tool to translate a group of images to a video. In the gas track work,\nit is used to gather the ... | python | chosen |
[
{
"from": "human",
"value": "Package utility: takes all output and turns into single (compressed) output file suitable for easier transport.\n"
},
{
"from": "gpt",
"value": "import bz2\nimport json\nimport optparse\nimport os\nimport shutil\nimport sys\n\nif __name__ == '__main__':\n parser =... | python | chosen |
[
{
"from": "system",
"value": "Fix: Use `active_attachments_pro` instead of `active_comments`.\n"
},
{
"from": "human",
"value": "from django.db import models\n\nimport logging\nlogger = logging.getLogger(__name__)\n\nclass FMSProxy(models.Model):\n\n name = models.CharField(max_length=20, uni... | python | chosen |
[
{
"from": "system",
"value": "Add get_read_only and remove old change_view customization\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django_services import admin\nfrom ..models import Maintenance\nfrom ..service.maint... | python | chosen |
[
{
"from": "system",
"value": "Test that the anly allowed system to execute this script is OS X\n"
},
{
"from": "human",
"value": "from unittest import TestCase\nfrom ..dock_dodger import OSXDodger\n\n\nclass OSXDockDodgerTests(TestCase):\n def test_applications_folder_is_correct(self):\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.