conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Store extra data in JSON format, also add method to extend extra values to store. Closes gh-30\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\nfrom django.db import models\nfrom django.utils import simplejson\n\n\nclass JSONField(... | python | chosen |
[
{
"from": "human",
"value": "Add script to summarize WPT test directories with failing tests."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Copyright 2019 The Servo Project Developers. See the COPYRIGHT\n# file at the top-level directory of this distribution.\n#\n# Licensed under the... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for nodes with incorrect piwik_site_id set.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\n\"\"\"\n\nimport logging\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(\n os.path.join(os.path.dirname(__file__), os.pardir)\n))\n\nfrom modula... | python | chosen |
[
{
"from": "system",
"value": "Fix decoding of empty responses.\n\nWhen an empty response was given by the web server, we were\ndecoding to '{}', which is problematic when you are expecting\nan empty response for things like empty text/plain files. This\nfixes the problematic assumption we were making.\n\nRe... | python | chosen |
[
{
"from": "human",
"value": "Add a script for Search w/ just LTR\n"
},
{
"from": "gpt",
"value": "from features import formatFeature\n\nbaseQuery = {\n \"query\": {\n \"ltr\": {\n \"model\": {\n \"stored\": \"\" # Model name\n },\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Remove non-existing field from WeightBasedForm\"\n\nThis reverts commit af712fedf4963d66f56f5ab9054318c493572ab1.\n"
},
{
"from": "human",
"value": "from django import forms\n\nfrom oscar.core.loading import get_model\n\n\nclass WeightBasedForm(forms.ModelF... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for modified repr as per review.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for debugging machinery.\n\"\"\"\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012, The IPython Development Team.\n#\n# ... | python | chosen |
[
{
"from": "system",
"value": "Update null log handling for py26\n\nPython 2.6 does not have a NullHandler in the logging\nmodule, so introduce a little class that does the same\nwork.\n\nAlso add __all__ to the package init so extra names are\nnot exported.\n\nResolves issue #2\n\nChange-Id: Id59d394cd02372... | python | chosen |
[
{
"from": "human",
"value": "Add QuickUnion algorithm(a better algorithm)\n"
},
{
"from": "gpt",
"value": "#-*- coding:utf-8 -*-\n\n\nclass QuickFind(object):\n\tdef __init__(self,objnum):\n\t\tself.id=[i for i in range(0,objnum)]\n\tdef union(self,p,q):\n\t\tqid=self.id[q]\n\t\tpid=self.id[p]\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for article content field verbose name introduction\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport wagtail.wagtailcore.fields\n\n\nclass Migration(mig... | python | chosen |
[
{
"from": "human",
"value": "Examples: Add a simple single-frame data acquisition example\n"
},
{
"from": "gpt",
"value": "from pymoku import Moku, MokuException, NoDataException\nfrom pymoku.instruments import *\nimport time, logging, traceback\n\nlogging.basicConfig(format='%(asctime)s:%(name)... | python | chosen |
[
{
"from": "system",
"value": "Add crm_security.xml file entry in update_xml section\n\nbzr revid: mga@tinyerp.com-80638551c5a66adf0a49181f6ff6ae283ced3709"
},
{
"from": "human",
"value": "{\n\t\"name\" : \"Customer & Supplier Relationship Management\",\n\t\"version\" : \"1.0\",\n\t\"author\" : \... | python | chosen |
[
{
"from": "human",
"value": "Add target for unit tests + basic test\n\nSummary: Add target for unit tests + basic test\n\nReviewed By: vkhalidov\n\nDifferential Revision: D20429230\n\nfbshipit-source-id: 36bee00d2dd57a350e2a6f3dd58a87f0c9c8227e\n"
},
{
"from": "gpt",
"value": "# Copyright (c) Fa... | python | chosen |
[
{
"from": "human",
"value": "Create ConnectionSettings for all Repeaters\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\nfrom corehq.motech.repeaters.models import Repeater\n\n\ndef _migrate_to_connectionsettings(apps, schema_editor):\n for repeater in iter_repeaters():\n... | python | chosen |
[
{
"from": "system",
"value": "Allow auditor to create relationship in context\n\nThis allows the auditor to map objects to the audit but not to unmap them while\nnot giving him edit permissions on the audit.\n"
},
{
"from": "human",
"value": "# Copyright (C) 2015 Google Inc., authors, and contri... | python | chosen |
[
{
"from": "human",
"value": "Add an abstract parent of all filesystem tasks.\n\nIt defines the initializer, which should not vary among filesystem tasks.\n\nInclude a convenience class for simple unimplemented filesystem tasks.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\... | python | chosen |
[
{
"from": "human",
"value": "Add OPG to letter organisations\n\nLogo was added here:\nhttps://github.com/alphagov/notifications-template-preview/pull/19\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0105_opg_letter_org\nRevises: 0104_more_letter_orgs\nCreate Date: 2017-06-... | python | chosen |
[
{
"from": "human",
"value": "Add some tests of SecurityAnnounceParser\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nimport os, sys\nsys.path.append(os.... | python | chosen |
[
{
"from": "human",
"value": "Add script to delete user login events older than a number of days\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Delete login user events older than a given number of days.\n\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see L... | python | chosen |
[
{
"from": "human",
"value": "Add script usable for cron/queue-ing retrievable of automatically polled stations\n\ngit-svn-id: 138413ff556ff9267caefd2d209ba774763e85fb@8 696a86c2-f982-11dd-8259-6defae454439\n"
},
{
"from": "gpt",
"value": "from weathertracking.models import WeatherStation, Weathe... | python | chosen |
[
{
"from": "human",
"value": "Implement a basic test with cookies.bake()\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\n@pytest.fixture\ndef context():\n return {\n \"project_name\": \"My Test Project\",\n \"repo_name\": \"my_test_project\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add Python tutorial about time series\n"
},
{
"from": "gpt",
"value": "## \\file\n## \\ingroup tutorial_graphs\n## \\notebook -js\n## This macro illustrates the use of the time axis on a TGraph\n## with data read from a text file containing the SWAN usage\n## statist... | python | chosen |
[
{
"from": "human",
"value": "Add an example script in NaCle\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport yaml\nimport numpy as np\n\ndata = yaml.load(open(\"qpoints.yaml\"))\ndynmat = []\ndynmat_data = data['phonon'][0]['dynamical_matrix']\nfor row in dynmat_data:\n vals =... | python | chosen |
[
{
"from": "human",
"value": "Add script for adding RTP process events\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright 2019 the HERA Collaboration\n# Licensed under the 2-clause BSD License\n\n\"\"\"\nScript to add an RTP process event record to M&C.\n... | python | chosen |
[
{
"from": "human",
"value": "Add demo of DAX analysis and MA\n"
},
{
"from": "gpt",
"value": "#-*-coding:utf-8-*-\n#!/usr/bin/python\n# coding: UTF-8\n\nimport numpy as np\nimport pandas as pd\nimport pandas_datareader.data as web\nimport math\n\n#从雅虎财经获取DAX指数的数据\nDAX = web.DataReader(name='^GDA... | python | chosen |
[
{
"from": "human",
"value": "Add script to dump S-file PC-CORA data\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys, os\nsys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora'))\nfrom pccora import *\nimport math\n\ndef dump_values(obj):\n for key in obj:... | python | chosen |
[
{
"from": "human",
"value": "tests: Add testcase for yielding from a stopped generator.\n"
},
{
"from": "gpt",
"value": "# Yielding from stopped generator is ok and results in None\n\ndef gen():\n return 1\n # This yield is just to make this a generator\n yield\n\nf = gen()\n\ndef run()... | python | chosen |
[
{
"from": "human",
"value": "Add test for making sure equal_to is case-insensitive\n"
},
{
"from": "gpt",
"value": "from nose.tools import istest, assert_equal\n\nfrom mammoth import document_matchers\n\n\n@istest\ndef equal_to_matcher_is_case_insensitive():\n matcher = document_matchers.equa... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for adding seasons\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.8 on 2016-08-27 22:21\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef _get_seasons():\n return '2012 2013 20... | python | chosen |
[
{
"from": "human",
"value": "Add a script that uses a genetic algorithm to find slow queries\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -.- coding: utf-8 -.-\n\n# Zeitgeist\n#\n# Copyright © 2011 Collabora Ltd.\n# By Trever Fischer <trever.fischer@collabora.co.uk... | python | chosen |
[
{
"from": "human",
"value": "Add idealness experiment py script\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom string import printable\nfrom generate_huffman import get_huffman_tree\n\n\ndef get_ideal_tree(freq_list):\n freq_list = sorted(freq_list, reverse=True)\n output... | python | chosen |
[
{
"from": "human",
"value": "Add migration for previous commit\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 ('events', '00... | python | chosen |
[
{
"from": "human",
"value": "api: Add test for the \"auth\" module\n"
},
{
"from": "gpt",
"value": "import base64\n\nfrom flask import Response\nfrom flask.testing import FlaskClient\nimport pytest\n\nimport config\nfrom skylines.api import auth\nfrom skylines.app import SkyLines\nfrom skylines.... | python | chosen |
[
{
"from": "human",
"value": "Add test to verify custom name functionality\n"
},
{
"from": "gpt",
"value": "from .base import ServiceTestCase\n\nclass VServiceTests(ServiceTestCase):\n def verifyCustomName(self):\n self.assertEquals(self.service.name, 'VService')\n self.assertEqu... | python | chosen |
[
{
"from": "human",
"value": "Implement a tool to crawl bug pages.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport os\nimport re\nimport subprocess\n\nbugIds = []\ndef prepareCookieData():\n out = subprocess.call(\"curl --cookie-jar cookie.data \\\"https://bugzilla-hostname/index.cg... | python | chosen |
[
{
"from": "human",
"value": "Add plotting of launch times\n"
},
{
"from": "gpt",
"value": "# Helper script for making run-time plots.\n#\n# Requires a Python installation with the full numeric stack (Numpy, Matplotlib)\n# including Seaborn (for prettier plots).\n#\n# Eli Bendersky [http://eli.th... | python | chosen |
[
{
"from": "human",
"value": "Add tests for end finding and walk through a skeleton\n"
},
{
"from": "gpt",
"value": "\n'''\nTests for functions in fil_finder.width_profiles.\n'''\n\nimport pytest\n\nimport numpy as np\nimport numpy.testing as npt\n\n\nfrom ..width_profiles.profile_line_width impo... | python | chosen |
[
{
"from": "human",
"value": "Add a telemetry-based gpu_tests folder\n\nBUG=143317\n\n\nReview URL: https://chromiumcodereview.appspot.com/12252020\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@183915 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",
"value": "# Copyright (c) ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for oauth2 utils\n"
},
{
"from": "gpt",
"value": "# Yith Library Server is a password storage server.\n# Copyright (C) 2014 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>\n#\n# This file is part of Yith Library Server.\n#\n# Yith Library Server is free... | python | chosen |
[
{
"from": "human",
"value": "Add a number of unittests for registering and deregistering task definitions\n"
},
{
"from": "gpt",
"value": "import copy\nimport os\n\nfrom ecs_deplojo import main\n\nBASE_DIR = os.path.dirname(os.path.abspath(__file__))\n\n\ndef test_register_task_definitions(clust... | python | chosen |
[
{
"from": "human",
"value": "Add migration for admin change\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2017-07-18 14:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n... | python | chosen |
[
{
"from": "system",
"value": "Remove admin.autodiscover() call, it's called automatically in 1.7+\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import patterns, include, url\nfrom dja... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for DeviceCredentials\n"
},
{
"from": "gpt",
"value": "import unittest\nimport mock\nfrom ..device_credentials import DeviceCredentials\n\n\nclass TestDeviceCredentials(unittest.TestCase):\n\n @mock.patch('auth0.v2.device_credentials.RestClient')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for meta options\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0010_cu... | python | chosen |
[
{
"from": "human",
"value": "Android: Add list of files with licenses not wanted in webview.\n\nThe script which merges Chromium code into the Android tree needs to\nknow which directories to remove for licensing reasons; it's much easier\nif this is just a static list in the tree which can subsequently be\... | python | chosen |
[
{
"from": "human",
"value": "Create StoredMessageMapper from MessageStorageHandler code\n"
},
{
"from": "gpt",
"value": "class StoredMessageMapper:\n def from_api(self, message):\n data = message.data.copy()\n self.__replace_with_id_if_present(data, \"from\")\n self.__rep... | python | chosen |
[
{
"from": "human",
"value": "Add company register number validation for Austria\n"
},
{
"from": "gpt",
"value": "# businessid.py - functions for handling Austrian company register numbers\n#\n# Copyright (C) 2015 Holvi Payment Services Oy\n# Copyright (C) 2012, 2013 Arthur de Jong\n#\n# This lib... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for pickle renderer\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask_webapi import WebAPI, APIView, renderer, route\nfrom flask_webapi.renderers import PickleRenderer\nfrom unittest import TestCase\n\n\nclass TestRenderer(TestCase):... | python | chosen |
[
{
"from": "human",
"value": "Add the prototype of the parser of letters\n"
},
{
"from": "gpt",
"value": "#coding=utf-8\nimport json\nFILE_PATH = '/file-path'\nFILE_NAME = 'file-name'\n\ndef main():\n fp = open(FILE_PATH + FILE_NAME + '.txt', 'r')\n out = {}\n line = fp.readline()\n o... | python | chosen |
[
{
"from": "system",
"value": "Fix Resident Advisor regex to match new page design\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\n# Gets stuff from Resident Advisor's awesome 'RA Recommends' section\n# Note: this is just regexing the HTML... so may stop working if page structure changes\... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate webhooks\n"
},
{
"from": "gpt",
"value": "import requests\n\n\nURL = \"https://stripe.com/docs/api/curl/sections?all_sections=1&version=2019-02-19&cacheControlVersion=4\"\nresponse = requests.get(URL)\n\ndata = response.json()\n\nevent_types = ... | python | chosen |
[
{
"from": "human",
"value": "Test ansi escape sequence function\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Test the cprint function.\"\"\"\n\nfrom colorise.nix.color_functions import to_ansi\nimport pytest\n\n\n@pytest.mark.skip_on_windows\ndef test_... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for bbox.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom coral import bbox\n\nclass TestBBox(unittest.TestCase):\n\n def setUp(self):\n self.a = bbox.BBox((20, 30), (50, 40))\n self.b = self.a.scale(2)\n self.c = self.... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for util\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Package: mininet\n Test functions defined in mininet.util.\"\"\"\n\nimport unittest\n\nfrom mininet.util import quietRun\n\nclass testQuietRun( unittest.TestCase ):\n \"\"\"T... | python | chosen |
[
{
"from": "human",
"value": "Add a sqlite3 gevent wrapper\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mo... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for removing unused curriculum models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-02-07 15:46\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migr... | python | chosen |
[
{
"from": "human",
"value": "Add the answer to the second question of Assignment 3\n"
},
{
"from": "gpt",
"value": "def evalQuadratic( a, b, c, x ):\n\n\ta = int ( a )\n\tb = int ( b )\n\tc = int ( c )\n\tx = int ( x )\n\n\ts = (a * (x ** 2)) + (b * x) + c\n\treturn s\n\na = input( \"Enter a: \"... | python | chosen |
[
{
"from": "human",
"value": "Add tests for send / get / remote op on parameters\n"
},
{
"from": "gpt",
"value": "import random\n\nimport torch\nimport torch.nn.functional as F\nfrom torch.nn import Parameter\nimport syft\n\nfrom syft.frameworks.torch.tensors import LoggingTensor\n\n\nclass TestL... | python | chosen |
[
{
"from": "human",
"value": "Add test for ResetPassword email subject"
},
{
"from": "gpt",
"value": "from contacts.views.activation import ResetPassword\nfrom django.conf import settings\n\n\ndef test_reset_password_subject_contains_site_name():\n assert '{0}: password recovery'.format(settin... | python | chosen |
[
{
"from": "human",
"value": "Add test for general scoping case in nested blocks\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom thinglang.execution.errors import UnknownVariable\nfrom thinglang.runner import run\n\n\ndef test_stack_resolution_in_block():\n assert run(\"\"\"\nthing Prog... | python | chosen |
[
{
"from": "human",
"value": "Add new Class Based Movment\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as gpio\nimport time\nclass move:\n\n def __init__(self, RF,RB,LF,LB,SLEEP):\n self.RF = RF\n self.RB = RB\n self.LF = LF\n self.LB = LB\n self.SLEEP = SLEEP... | python | chosen |
[
{
"from": "human",
"value": "Test async objects for __repr__ as well\n"
},
{
"from": "gpt",
"value": "from butter.asyncio.eventfd import Eventfd_async\nfrom butter.asyncio.fanotify import Fanotify_async\nfrom butter.asyncio.inotify import Inotify_async\nfrom butter.asyncio.signalfd import Signal... | python | chosen |
[
{
"from": "human",
"value": "Add a script to fix the Ward names + slugs in the database\n\nThe ward names imported from \"Final Constituencies and Wards Description.pdf\"\nhave strange formatting where the ward names are separated\nby a '/' or a '-', where they have random whitespace after them\nand none be... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for the first 4 problems\n"
},
{
"from": "gpt",
"value": "# Hack to allow import of ProjectEulerAnswers while it is still at top level.\nfrom os import path\nimport sys\nsys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__ )))))... | python | chosen |
[
{
"from": "system",
"value": "Remove unnecessary config mock property\n"
},
{
"from": "human",
"value": "from scoring_engine.config_loader import ConfigLoader\n\n\nclass MockConfig(object):\n def __init__(self, location):\n self.file_location = location\n\n @property\n def config... | python | chosen |
[
{
"from": "human",
"value": "Add management command to report computed stats\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom dimagi.ext.couchdbkit import Document\n\nfrom corehq.util.metrics import metrics_gauge\n\n\nclass Command(BaseCommand):\n h... | python | chosen |
[
{
"from": "human",
"value": "Add first example: cheapest destinations\n"
},
{
"from": "gpt",
"value": "'''\nFinds the cheapest fares filed to a given city\n\nExample:\n python cheapest-destinations.py YTO\n\nResult:\n FLL 165.62\n MCO 165.62\n JFK 172.36\n LGA 191.12\n'''\n\nimpor... | python | chosen |
[
{
"from": "human",
"value": "Add tests for SA synonym\n"
},
{
"from": "gpt",
"value": "import sqlalchemy as sa\nfrom sqlalchemy.ext.hybrid import hybrid_property\nfrom wtforms_alchemy import ModelForm\nfrom tests import ModelFormTestCase\n\n\nclass TestSynonym(ModelFormTestCase):\n def test_s... | python | chosen |
[
{
"from": "human",
"value": "Allow starting IPython as `python -m IPython`.\n\nCloses #2541.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\"\"\"Terminal-based IPython entry point.\n\"\"\"\n#-----------------------------------------------------------------------------\n# Copyright (c) 201... | python | chosen |
[
{
"from": "human",
"value": "Add functions to calculate Fisher information.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nFisher information matrix of a Dirichlet distribution.\n\n\"\"\"\nfrom __future__ import division\n\nimport numpy as np\n\nimport scipy\nfrom scipy.special import polygamma\n\nimp... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Automount LUKS devices when they have been unlocked\"\n\nThis reverts commit d67f8c7284e8d3bff2e7c81711a9fece952aea46.\n"
},
{
"from": "human",
"value": "\"\"\"\nUdiskie automounter daemon.\n\"\"\"\n__all__ = ['AutoMounter']\n\nclass AutoMounter(object):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a smoke test for negated phrase matches."
},
{
"from": "gpt",
"value": "\"\"\"Tests for string searches\"\"\"\n\nfrom nose.tools import eq_\n\nfrom dxr.testing import SingleFileTestCase, MINIMAL_MAIN\n\n\nclass StringTests(SingleFileTestCase):\n source = \"\"\... | python | chosen |
[
{
"from": "system",
"value": "Use a version of flask < 0.10\n\n* Flask 0.10 has a bunch of changes which break nereid\n"
},
{
"from": "human",
"value": "#This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of\n#this repository contains the full copyright notices and license... | python | chosen |
[
{
"from": "human",
"value": "Add ColumnPooler test for debugging\n"
},
{
"from": "gpt",
"value": "# ----------------------------------------------------------------------\n# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement\n# w... | python | chosen |
[
{
"from": "system",
"value": "Update dependencies to make it installable.\n"
},
{
"from": "human",
"value": "\"\"\"\nsetup.py\n\"\"\"\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='SATOSA',\n version='2.1.1',\n description='Protocol proxy (SAML/OIDC).',\n author='DI... | python | chosen |
[
{
"from": "human",
"value": "Solve problem 1 in Python\n"
},
{
"from": "gpt",
"value": "sum = 0\n\nfor i in range(1, 1000):\n if i % 3 == 0 or i % 5 == 0:\n sum += i\n #print(\"i:\", i)\n\nprint(\"Result:\", sum)\n"
}
] | python | chosen |
[
{
"from": "system",
"value": "Make sure test watcher picks up source code file changes\n"
},
{
"from": "human",
"value": "from invocations.docs import docs, www, sites, watch_docs\nfrom invocations.testing import test, coverage, integration, watch_tests\nfrom invocations.packaging import vendori... | python | chosen |
[
{
"from": "human",
"value": "Add module for reading sandboxed python from a file\n"
},
{
"from": "gpt",
"value": "# Copyright 2013 John Reese\n# Licensed under the MIT license\n\nimport json\n\nfrom os import path\n\ndef read_config(filepath, defaults=None):\n \"\"\"Read configuration from a ... | python | chosen |
[
{
"from": "human",
"value": "Add unittests module for cat2cohort\n\nI want to have unit tests for the methods in cat2cohort.\n\nAdd empty module implementing unittest.\n"
},
{
"from": "gpt",
"value": "\"\"\"Unit tests for cat2cohort.\"\"\"\n\nimport unittest\nfrom cat2cohort import api_url\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests to ensure seed values result in different samples\n\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom SALib.sample import fast_sampler, finite_diff, latin, saltelli\nfrom SALib.sample.morris import sample as morris_sampler\n\n\ndef problem_setup()... | python | chosen |
[
{
"from": "human",
"value": "Remove cascading deletes from quote foreign keys\n"
},
{
"from": "gpt",
"value": "revision = '72a56f6f1148'\ndown_revision = 'be28e555a2da'\nbranch_labels = None\ndepends_on = None\n\nimport alembic\nimport sqlalchemy\n\ndef upgrade():\n\t# Remove cascading deletes f... | python | chosen |
[
{
"from": "system",
"value": "Clean handling of lack of $EDITOR\n\nProblem: If EDITOR is not set, and vim is not installed, rbt post exits with\njust \"CRITICAL: [Errno 2] No such file or directory\" as an error message, which\ndoes not indicate where the problem lies nor how to solve it.\n\nvim is not inst... | python | chosen |
[
{
"from": "human",
"value": "Test file that works 4 me. Adding some info on the doc in a second.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Code based on:\n https://github.com/mvillalba/python-ant/blob/develop/demos/ant.core/03-basicchannel.py\n in the python-ant repository and\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for computing total project size.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\n\n\ndef compute_project_size(project_id, conn):\n total = 0\n for f in r.table('project2datafile').g... | python | chosen |
[
{
"from": "human",
"value": "Add text plot 1d test case.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom numpy import alltrue, arange\nfrom enable.compiled_path import CompiledPath\n\n# Chaco imports\nfrom chaco.api import (ArrayDataSource, DataRange1D, LinearMapper,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing file to git\n"
},
{
"from": "gpt",
"value": "import random\n\ndef random_choice(p=0.5):\n \"\"\"\n Return 'C' wit probability `p`, else return 'D'\n\n Emulates Python's random.choice(['C', 'D']) since it is not consistent\n across Python 2.7 t... | python | chosen |
[
{
"from": "human",
"value": "Add metadata to subscription request for welcome message setting\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-03-30 13:57\nfrom __future__ import unicode_literals\n\nimport django.contrib.postgres.fields.jsonb\nfrom dj... | python | chosen |
[
{
"from": "human",
"value": "Add rough time so when Felix adds time since last play, he can use\nthis to show it.\n"
},
{
"from": "gpt",
"value": "def _DoRough(time, big, bigname, little, littlename):\n b = int(time / big / little)\n l = int(((time + little / 2) / little) % big)\n# prin... | python | chosen |
[
{
"from": "human",
"value": "Create function for parameter correction.\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef param_correction(start, params, order):\n pos = np.round(start.copy())\n oldpos = np.round(start.copy())\n pos_not_rounded = np.round(start.copy())\n fo... | python | chosen |
[
{
"from": "human",
"value": "Add stub for test auth providers\n"
},
{
"from": "gpt",
"value": "# Allow out-of-tree auth submodules.\nfrom pkgutil import extend_path\nfrom inbox.util.misc import register_backends\n__path__ = extend_path(__path__, __name__)\nmodule_registry = register_backends(__n... | python | chosen |
[
{
"from": "human",
"value": "Add draft of the mixed operator for the gravity wave problem\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\n\nfrom function_spaces import generate_function_spaces\nfrom vertical_normal imp... | python | chosen |
[
{
"from": "human",
"value": "Add a snippet (Python OpenCV).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nOpenCV - Read image: read an image given in arguments\n\nRequired: opencv library (D... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration to users\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-06-08 10:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.utils.timezone\n\n\nclass Mig... | python | chosen |
[
{
"from": "human",
"value": "Add initial version of game parser test script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport requests\nfrom lxml import html\n\nfrom parsers.game_parser import GameParser\n\n\ndef test_2013_centre_bell():\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add snippet with code to generate new features\n"
},
{
"from": "gpt",
"value": "from sklearn.preprocessing import PolynomialFeatures\nfrom sklearn.decomposition import PCA\nimport numpy as np\n\nX = np.arange(9).reshape(3, 3)\nprint X\n\npoly = PolynomialFeatures(2)\... | python | chosen |
[
{
"from": "human",
"value": "Add basic ast to json converter\n"
},
{
"from": "gpt",
"value": "\"\"\"Parse python code into the abstract syntax tree and represent as JSON\"\"\"\nfrom __future__ import print_function\nimport ast\nfrom itertools import chain, count\nimport json\nimport sys\n\n\ndef... | python | chosen |
[
{
"from": "human",
"value": "Add tool to fix up parsing tables\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nA utility to fix PLY-generated lex and yacc tables to be Python 2 and\n3 compatible.\n\"\"\"\n\nimport os\n\nfor root, dirs, files in os.walk(os.path.join(os.path.dirn... | python | chosen |
[
{
"from": "human",
"value": "Add test suite for coin simulation.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport random\nimport math\n\nimport sims\n\nTRIALS = 1000 # number of trials to run per test case\nMAX_DEGREE = 1.5 # max degree of freedom; refer to https://en.wikipedia.org/wiki/... | python | chosen |
[
{
"from": "human",
"value": "Add fractional knapsack greedy algorithm\n\nImplemented in Python\n"
},
{
"from": "gpt",
"value": "def FractionalKnapsack(capacity, values, weights):\n rel_value = [val / weight for val, weight in zip(values, weights)]\n sorted_items = [i for _,i in sorted(zip(... | python | chosen |
[
{
"from": "human",
"value": "Add UUID serialization test case (NC-1214)\n"
},
{
"from": "gpt",
"value": "from urlparse import urlparse\n\nfrom django.contrib.auth import get_user_model\nfrom django.core.urlresolvers import resolve\nfrom django.test import TestCase\n\nfrom rest_framework.test imp... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.