conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add tests for example is prime action.\n" }, { "from": "gpt", "value": "from st2tests.base import BaseActionTestCase\n\nfrom pythonactions.isprime import PrimeCheckerAction\n\n\nclass PrimeCheckerActionTestCase(BaseActionTestCase):\n action_cls = PrimeCheckerActio...
python
chosen
[ { "from": "human", "value": "Add initial tests for models and factories\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom shop.models import Order\nfrom .factories import UserFactory, OrderFactory\n\nclass ShopModelsTestCase(TestCase):\n def setUp(self):\n pass\n\...
python
chosen
[ { "from": "human", "value": "Add Connect4 Q-learning tabular self-play example\n" }, { "from": "gpt", "value": "'''\nQ-learning via self-play is used to learn the state-action values, Q(s, a),\nfor the legal moves of a Connect 4 position.\n'''\n\nfrom capstone.environment import Environment\nfro...
python
chosen
[ { "from": "human", "value": "Add missing migration for Pixeler verbose name(s)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2017-11-06 13:18\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.M...
python
chosen
[ { "from": "human", "value": "Add a Parasitic Traceroute NetTest\n" }, { "from": "gpt", "value": "from twisted.python import usage\nfrom twisted.internet import defer, reactor\nfrom ooni.templates import scapyt\nfrom ooni.utils import log\nfrom ooni.utils.txscapy import ParasiticTraceroute\nfrom ...
python
chosen
[ { "from": "human", "value": "Add tests for save_bible_data function\n" }, { "from": "gpt", "value": "# tests.test_add_language.test_save_bible_data\n# coding=utf-8\n\nfrom __future__ import unicode_literals\nimport copy\nimport json\nimport os\nimport os.path\n\nimport nose.tools as nose\n\nimpo...
python
chosen
[ { "from": "human", "value": "Add migration for infrastructure model\n" }, { "from": "gpt", "value": "# Generated by Django 3.1.13 on 2021-07-21 15:40\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\...
python
chosen
[ { "from": "human", "value": "Add longest increasing subsequence algorithm in Python.\n" }, { "from": "gpt", "value": "def lis(a):\n\tdp = [1] * len(a)\n\tfor i in range(len(a)):\n\t\tfor j in range(i):\n\t\t\tif a[j] < a[i]:\n\t\t\t\tdp[i] = max(dp[i], dp[j] + 1)\n\treturn max(dp)\n\nn = int(inp...
python
chosen
[ { "from": "system", "value": "Make otp_init() race condition safe.\n\nA race condition in get_or_create() may have resulted in two devices\ncreated per user. Now we guarantee only one. Not that it matters real\nmuch...\n" }, { "from": "human", "value": "# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4...
python
chosen
[ { "from": "human", "value": "Add basic test for resultsets\n" }, { "from": "gpt", "value": "from app.logic import resultsets\nfrom sympy import sympify, Derivative, Integral, I, sqrt\n\ndef test_predicates():\n assert resultsets.is_approximatable_constant(sqrt(2))\n assert not resultsets.i...
python
chosen
[ { "from": "human", "value": "MAINT: Add script for generating docs.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom contextlib import contextmanager\nfrom glob import glob\nfrom path import path\nimport os\nfrom os.path import abspath, basename...
python
chosen
[ { "from": "human", "value": "Rearrange array numbers to form biggest number\n" }, { "from": "gpt", "value": "import unittest\n\"\"\"\nGiven an array of numbers, arrange them in a way that yields the maximum value.\nInput: 54 546 548 60\nOutput: 6054854654\nInput: 1 34 3 98 9 76 45 4\nOutput: 998...
python
chosen
[ { "from": "human", "value": "Add the helper script to import packages from Maven.\n\nTest: Tested the script locally.\n\nChange-Id: I0b3bf330d340a30f14ddbe5704668e9666577d8d\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n\"\"\"\nCopyright 2018 The Android Open Source Project\n\nLicensed u...
python
chosen
[ { "from": "human", "value": "Add an analysis file for 10x10 simulations\n\nNot finished, MPS Whole figure is quite ok.\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\nfrom pylab import *\nimport tables\n\n\"\"\"\nTODO\n- Faire tous les MPS\n- Faire tous les STS\n\n- Faire le déphasage\n...
python
chosen
[ { "from": "human", "value": "Add set background resolution and bit depth example\n" }, { "from": "gpt", "value": "\"\"\"Sets all Backgrounds in the currently active comp to 1920x1080 (32 bit).\n\nThis example shows how to list tool of a specific type and set some of its\ninputs. Additionally thi...
python
chosen
[ { "from": "human", "value": "Add management command for adding images to articles\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, unicode_literals\n\nimport csv\nfrom babel import Locale\nfrom django.core.management.base import BaseCommand\nfrom wagtail.wagtailimages.tes...
python
chosen
[ { "from": "human", "value": "Add test for Trapezoid1D model\n" }, { "from": "gpt", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import division\nimport numpy as np\nfrom numpy.testing import assert_allclose\nfrom .. import models\n\ntry:\n from sc...
python
chosen
[ { "from": "human", "value": "Access xgboost eval metrics by using sklearn" }, { "from": "gpt", "value": "##\n# This script demonstrate how to access the xgboost eval metrics by using sklearn\n##\n\nimport xgboost as xgb\nimport numpy as np\nfrom sklearn.datasets import make_hastie_10_2\n\nX, y ...
python
chosen
[ { "from": "human", "value": "Add test for landuse tiers.\n" }, { "from": "gpt", "value": "# http://www.openstreetmap.org/way/167274589\n# area 300363008\nassert_has_feature(\n 16, 10818, 21900, 'landuse',\n { 'kind': 'national_park', 'id': 167274589, 'tier': 1,\n 'min_zoom': 3 })\n\n#...
python
chosen
[ { "from": "human", "value": "Add test of groupby with immutable 'by'\n" }, { "from": "gpt", "value": "import sys\nimport unittest\nfrom dynd import nd, ndt\n\nclass TestGroupBy(unittest.TestCase):\n def test_immutable(self):\n a = nd.ndobject([\n ('x', 0),\n ...
python
chosen
[ { "from": "human", "value": "Add hide ip template tag\n" }, { "from": "gpt", "value": "import re\n\nfrom django import template\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef hide_ip(ip):\n m = re.match('\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}', str(ip))\n if m is not No...
python
chosen
[ { "from": "human", "value": "Add good code for lazy analysis\n" }, { "from": "gpt", "value": "import numpy as np\n\n#runas import numpy as np; r = np.arange(1000000); rosen(r)\n#pythran export rosen(float[])\n\ndef rosen(x):\n t0 = 100 * (x[1:] - x[:-1] ** 2) ** 2\n t1 = (1 - x[:-1]) ** 2\...
python
chosen
[ { "from": "human", "value": "Add initial URL history importer" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the...
python
chosen
[ { "from": "human", "value": "Add some code to capture IR for annotation\n" }, { "from": "gpt", "value": "# -*- coding: UTF-8 -*-\n\n\"\"\"\nCapture IR emissions.\n\"\"\"\n\nfrom __future__ import print_function, division, absolute_import\n\nimport collections\nfrom .annotate import SourceInterme...
python
chosen
[ { "from": "human", "value": "Add example to list all models written in Fortran or C/C++\n" }, { "from": "gpt", "value": "\"\"\"Queries the CSDMS model repository for all models written in C,\nC++, Fortran 77, or Fortran 90.\"\"\"\nfrom ask_api_examples import make_query\n\n\nquery = '[[Programmi...
python
chosen
[ { "from": "human", "value": "Add tests for transit features\n" }, { "from": "gpt", "value": "# way 91806504\nassert_has_feature(\n 16, 10470, 25316, 'transit',\n { 'kind': 'bus_stop' })\n\n# node 1241518350\nassert_has_feature(\n 16, 10480, 25332, 'transit',\n { 'kind': 'bus_stop' })...
python
chosen
[ { "from": "human", "value": "Add management command expire carts to expire carts [upstreamcand]. Well of course this should probably happen automatically, but a workaround for now to cronjob this every few minutes\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseComma...
python
chosen
[ { "from": "human", "value": "Add test for method call compilation\n" }, { "from": "gpt", "value": "from tests.compiler import compile_local, SELF_ID, LST_ID, VAL1_ID\nfrom thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushIndexImmediate, OpcodeCallInternal, OpcodePushMember, \\\n O...
python
chosen
[ { "from": "human", "value": "Add migration to switch to Uploadcare\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport pylinks.links.utils\n\n\nclass Migration(migrations.Migration):\n\n dependen...
python
chosen
[ { "from": "human", "value": "Add migration script for users with unconfirmed emails\n" }, { "from": "gpt", "value": "\"\"\"Removes User.username from User.emails for unregistered users.\n\n\"\"\"\n\nimport logging\nimport sys\n\nfrom modularodm import Q\nfrom nose.tools import *\n\nfrom website ...
python
chosen
[ { "from": "human", "value": "Add gittify-gitlab to detete projects by path\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport time\n\nimport click\nimport gitlab\n\n\ndef iter_projects(gl):\n page = 0\n while True:\n projects = gl.pr...
python
chosen
[ { "from": "human", "value": "Revert \"forgot to remove migration\"\n\nThis reverts commit 41c9fa093909eced94c18acd03a68a3843fb359f.\n\nReason for rollback: Assuming original commit was a mistake.\n" }, { "from": "gpt", "value": "\"\"\"Update Calendar index.\n\nRevision ID: 1c73ca99c03b\nRevises:...
python
chosen
[ { "from": "human", "value": "Add basic test for config module\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\n\"\"\"Test config\"\"\"\n\n\nimport unittest\n\nfrom imap_cli import config\n\n\nclass HelpersTest(unittest.TestCase):\n def setUp(self):\n self.config_filename =...
python
chosen
[ { "from": "human", "value": "Add skeleton of all 2D solver classes\n\n3 new classes have been added.\n\nSolver class - Top class for all solver child classes\nSteadyHeatSolver class - Steady state heat transfer solver\nSteadyStructureSolver class - Steady state structure solver" }, { "from": "gpt", ...
python
chosen
[ { "from": "human", "value": "Move Data Function for Python" }, { "from": "gpt", "value": "def move_data(token, member_id, from_path, to_path):\n\turl = 'https://api.dropboxapi.com/1/fileops/move'\n\theaders = {'Authorization': 'Bearer %s' % token, 'X-Dropbox-Perform-As-Team-Member': member_id}\n...
python
chosen
[ { "from": "human", "value": "Add migration files for previous previous commit (file graph link change)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.dev20160107235441 on 2017-01-10 21:22\nfrom __future__ import unicode_literals\n\nfrom django.db import migr...
python
chosen
[ { "from": "system", "value": "Fix for undocumented timestamp filtering in python-instagram\n" }, { "from": "human", "value": "from instagram import InstagramAPI\nfrom social.backends.instagram import InstagramOAuth2\nfrom yak.rest_social_auth.backends.base import ExtraDataAbstractMixin, ExtraAct...
python
chosen
[ { "from": "human", "value": "Add test for hashable objects\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\n\n\n@...
python
chosen
[ { "from": "human", "value": "Add pxemanager basic unit test\n" }, { "from": "gpt", "value": "from pxe_manager.pxemanager import PxeManager\nfrom resource_manager.client import ResourceManagerClient\nimport httpretty\n\n@httpretty.activate\ndef test_defaults():\n client = ResourceManagerClient...
python
chosen
[ { "from": "human", "value": "Create virtual builder for windows OS\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport platform\nimport shutil\nimport subprocess\nimport sys\n\nfrom os.path import dirname, isdir, join as join_path\n\nfile_path = dirname(__file__)\nrequirements_path = ...
python
chosen
[ { "from": "human", "value": "Add simple sanity check test for deconvolution\n" }, { "from": "gpt", "value": "\"\"\"\nSimple sanity check for deconvolution layer.\n\"\"\"\n\nimport numpy as np\nfrom numpy.testing import assert_array_almost_equal\nfrom pylearn2.models.mlp import MLP\nfrom pylearn2...
python
chosen
[ { "from": "human", "value": "Integrate with armacode Visual Studio project.\nThis generate htmlhelp CHM file to be distributed with armacode.\n" }, { "from": "gpt", "value": "\"\"\"\r\nThis routine is executed on Before Build every time user build a Visual Studio project.\r\n\r\nTODO:\r\n CHM...
python
chosen
[ { "from": "human", "value": "Remove duplicate psyarxiv custom subject.\n\n* Remove from existing preprints.\n* Replace with correct subject on new preprints.\n\nh/t @mfraezz\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport sys\nimport logging\n\nfrom dateutil.parser import parse\...
python
chosen
[ { "from": "human", "value": "Add script to pre-process data for deep learning\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Creates sentiment featuresets by preprocessing the data with nltk.\"\"\"\nimport pickle\nfrom nltk.tokenize import word_tokenize\nfrom nltk.stem import Wo...
python
chosen
[ { "from": "system", "value": "Change the default number of engines to 4.\n\nOnly 4 are needed for our current tests." }, { "from": "human", "value": "\"\"\"\nSimple runner for `ipcluster start` or `ipcluster stop` on Python 2 or 3, as\nappropriate.\n\"\"\"\n\nimport sys\nimport six\nfrom subproc...
python
chosen
[ { "from": "human", "value": "Add migration for database to add downloaded_at column\n" }, { "from": "gpt", "value": "\"\"\"add downloaded_at column to direct award projects\n\nRevision ID: 970\nRevises: 960\nCreate Date: 2017-09-04 09:25:41.968481\n\n\"\"\"\nfrom alembic import op\nimport sqlalc...
python
chosen
[ { "from": "human", "value": "Add initial structure for Unix support\n" }, { "from": "gpt", "value": "def read_device_file():\n from pathlib import Path\n event_files = Path('/dev/input/by-id').glob('*-event-kbd')\n\n for event_file in event_files:\n if '-if01-' not in event_file....
python
chosen
[ { "from": "human", "value": "Add library for monitoring RAM/GPU Memory\n\nPiperOrigin-RevId: 208935123\n" }, { "from": "gpt", "value": "\"\"\"Methods for tracking resource consumption of Colab kernels.\"\"\"\nimport csv\nimport os\nimport re\nimport subprocess\n\nfrom distutils import spawn\n\n_...
python
chosen
[ { "from": "human", "value": "Add mininet2 topology file for rftest2\n\nSigned-off-by: Joe Stringer <da02367898403910c66f5d62c3a247888772ce8a@gmail.com>\n" }, { "from": "gpt", "value": "\"\"\"Custom topology example\n\nauthor: Marcelo Nascimento (marcelon@cpqd.com.br)\n\nFour switches connected i...
python
chosen
[ { "from": "human", "value": "Add initial test for skin rainmeter section\n" }, { "from": "gpt", "value": "import sys\n\nfrom unittest import TestCase\n\nrainmeter_section = sys.modules[\"Rainmeter.completion.skin.rainmeter_section\"]\n\n\nclass TestFunctions(TestCase):\n\n def test_completion...
python
chosen
[ { "from": "human", "value": "Create integration test to verify KMS encryption\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom future.utils import bytes_to_native_str as n\n\nfrom base64 import b64decode\nimport os\n\nimport boto3\nimport py...
python
chosen
[ { "from": "human", "value": "Add dummy data to Survey model.\n" }, { "from": "gpt", "value": "from django.dispatch import dispatcher\nfrom django.db.models import signals\n\nfrom epiweb.apps.survey import models\n\ndef post_syncdb(sender, **kwargs):\n app = kwargs['app']\n created_models =...
python
chosen
[ { "from": "human", "value": "Add py solution for Search in Rotated Sorted Array\n\nSearch in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/\n" }, { "from": "gpt", "value": "class Solution(object):\n def search(self, nums, target):\n \"\"\"\n ...
python
chosen
[ { "from": "human", "value": "Plugin: Add date time util module\n\nChange-Id: I6ab1d8bb8df63b8590ce7800e60415d90ea3bad3\nSigned-off-by: George Keishing <bef0a9ecac45fb57611777c8270153994e13fd2e@in.ibm.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nr\"\"\"\nThis module contains fun...
python
chosen
[ { "from": "human", "value": "Add a command for manual certificate regeneration\n\nSometimes we may need to test or regenerate a certificate manually, in\ncase the procedure failed the first time.\n" }, { "from": "gpt", "value": "# coding=utf8\nfrom django.core.management.base import BaseCommand,...
python
chosen
[ { "from": "human", "value": "Check in my script for finding missing Miro IDs\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- encoding: utf-8 -*-\n\"\"\"\nThis is a diagnostic script for finding Miro records that have been\npushed into DynamoDB but aren't available in the API -- wh...
python
chosen
[ { "from": "human", "value": "Add a few utilities for printing results\n\n1) Copy over the ``tree`` function from sholsapp/powertools repository.\n\n2) Add a ``assemble_chain`` function for pretty printing verification\n results.\n" }, { "from": "gpt", "value": "def tree(node, _depth=1):\n \"\...
python
chosen
[ { "from": "human", "value": "Implement management command to import orders for existing resources.\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\n\nfrom waldur_core.core.models import User\nfrom waldur_mastermind.marketplace.models import Order, OrderItem, ...
python
chosen
[ { "from": "human", "value": "Add arc distance for theano.\n" }, { "from": "gpt", "value": "# Authors: Frederic Bastien\n# License: MIT\nimport theano\nimport theano.tensor as tensor\n\n\ndef arc_distance_theano_alloc_prepare(dtype='float64'):\n \"\"\"\n Calculates the pairwise arc distance...
python
chosen
[ { "from": "human", "value": "Solve the longest common prefix\n" }, { "from": "gpt", "value": "class Solution:\n # @param {string []} strs\n # @return {string}\n def longestCommonPrefix(self, strs):\n if not strs:\n return \"\"\n longestIndex = 0\n foundNo...
python
chosen
[ { "from": "human", "value": "Add testing utility to create activities.\n" }, { "from": "gpt", "value": "import logging\n\nfrom timetracker import models\n\n\ndef create_activity(title='Test Title', start_time=None, end_time=None,\n logger=None):\n \"\"\"Create an `Activity`...
python
chosen
[ { "from": "human", "value": "Add python script to make jenkins build all modules\n" }, { "from": "gpt", "value": "import os\nfrom subprocess import call\n\nmodules = os.listdir(\"../../modules\")\n\ncmd = [\"cmake\"]\ncmd.append(\"-DGHOUL_USE_DEVIL=OFF\")\nfor m in modules:\n cmd.append(\"-DO...
python
chosen
[ { "from": "human", "value": "Add TalkFor (to use color labels)\n" }, { "from": "gpt", "value": "from django import forms\n\nfrom .models import Label, Talk\n\n\nclass TalkForm(forms.ModelForm):\n\n def __init__(self, *args, **kwargs):\n super(TalkForm, self).__init__(*args, **kwargs)\n...
python
chosen
[ { "from": "human", "value": "Remove Incompatible Results from Scenarios\n\nThis patch provides a data migratin which removes incompatible results\nfrom scenarios created prior to\nhttps://github.com/WikiWatershed/model-my-watershed/pull/716.\n\nConnects #935\n" }, { "from": "gpt", "value": "# -*...
python
chosen
[ { "from": "human", "value": "Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107812 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "gpt", "value": "\"\"\"\nTest that breakpoint by symbol name works corr...
python
chosen
[ { "from": "human", "value": "Add r-filehash to test version naming.\n" }, { "from": "gpt", "value": "from spack import *\n\nclass RFilehash(Package):\n \"\"\"Implements a simple key-value style database where character string keys are associated with data values that are stored on the disk. A...
python
chosen
[ { "from": "human", "value": "Add KG graph building util.\n" }, { "from": "gpt", "value": "# coding=utf-8\n# Copyright 2020 Google LLC\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 copy ...
python
chosen
[ { "from": "human", "value": "Add tests for loadsuppliers statics methods\n" }, { "from": "gpt", "value": "from datetime import datetime\n\nfrom django.test import TestCase\n\nfrom jarbas.core.management.commands.loadsuppliers import Command\n\n\nclass TestStaticMethods(TestCase):\n\n def setU...
python
chosen
[ { "from": "human", "value": "Add test for decorated kwargs to decorated function\n" }, { "from": "gpt", "value": "\nfrom fastats.core.decorator import fs\n\n\ndef square(x):\n return x * x\n\n@fs\ndef cube(x):\n return x * x * x\n\n@fs\ndef func(x):\n a = square(x)\n return a / 2\n\n...
python
chosen
[ { "from": "human", "value": "Add tests for a few assembly graph operations\n" }, { "from": "gpt", "value": "import pytest # noqa\n\nfrom phasm.assembly_graph import (AssemblyGraph, remove_tips, node_path_edges,\n remove_transitive_edges, clean_graph)\n\n\ndef te...
python
chosen
[ { "from": "human", "value": "Add Sage benchmark for expand4\n" }, { "from": "gpt", "value": "print \"import...\"\nfrom timeit import default_timer as clock\nfrom sage.all import var\nvar(\"x\")\ne = 1\nprint \"constructing expression...\"\nfor i in range(1, 351):\n e *= (i+x)**3\nprint \"runn...
python
chosen
[ { "from": "human", "value": "Add unit tests for ensure_no_duplicate_names\n\nAdds minimal tests for validation of no duplicate names. Instead of\nmocking up the tree JSON directly, these tests build a minimal BioPython\ntree and use augur's own tree-to-JSON function to make the more verbose\nJSON structure ...
python
chosen
[ { "from": "human", "value": "Add effect test for notifications\n" }, { "from": "gpt", "value": "from django.core import mail\n\nfrom bluebottle.events.messages import EventClosedOwnerMessage\nfrom bluebottle.events.tests.factories import EventFactory\nfrom bluebottle.notifications.effects import...
python
chosen
[ { "from": "human", "value": "Add a python script that normalizes paths in the output of the include-what-you-use tool\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n\nimport fileinput\nimport re\nimport os.path\n\nenvisionRootDir = \"/fast/Envision\"\n\ncurrentFile = \"\" # This is the fil...
python
chosen
[ { "from": "human", "value": "Add example doc generator script.\n\nPiperOrigin-RevId: 244258412\n" }, { "from": "gpt", "value": "# Copyright 2015 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file excep...
python
chosen
[ { "from": "human", "value": "Add the Moksha WSGI Application.\n\nThis class handles resolving and dispatching to moksha applications.\nIt is instantiated and utilized by the MokshaMiddleware.\n" }, { "from": "gpt", "value": "# This file is part of Moksha.\n# \n# Moksha is free software: you can ...
python
chosen
[ { "from": "human", "value": "Add a test for issuing a delete during an update with replacement\n" }, { "from": "gpt", "value": "def check_resource_count(expected_count):\n test.assertEqual(expected_count, len(reality.all_resources()))\n\ndef check_c_count(expected_count):\n test.assertEqua...
python
chosen
[ { "from": "human", "value": "Add consumer written in Python\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport pika\n\n# Host in which RabbitMQ is running.\nHOST = 'localhost'\n\n# Name of the queue.\nQUEUE = 'pages'\n\n# Specifies what to do after consuming messages from RabbitMQ....
python
chosen
[ { "from": "human", "value": "Remove OSFWebsiteStatistics model in favor of using Keen data\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9 on 2017-01-30 19:56\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migra...
python
chosen
[ { "from": "system", "value": "Return the proper exit codes in event of failure or error\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport unittest\n\nfrom os.path import dirname, abspath\n\nimport tests\n\ndef runtests(*test_args):\n suite = unittest.TestLoader().lo...
python
chosen
[ { "from": "human", "value": "Add migration for gotify required by upgrade\n" }, { "from": "gpt", "value": "# Generated by Django 2.0.6 on 2018-06-26 07:18\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('gotify', '0001_initial'),\...
python
chosen
[ { "from": "human", "value": "Connect to and read twitch chat\n" }, { "from": "gpt", "value": "import socket\nimport sys\n\nserver = \"irc.twitch.tv\"\npassword = \"oauth:8nq3rymmy4zakeut4p90hx9axnpywj\"\nnickname = \"twitchlosescheckers\"\nchannel = \"#twitchlosescheckers\"\n\ntry:\n\tirc = sock...
python
chosen
[ { "from": "human", "value": "Add event listener to automatically update the copyright.\n" }, { "from": "gpt", "value": "# \n# Copyright (c) 2012 by Lifted Studios. All Rights Reserved.\n# \n\nimport sublime\nimport sublime_plugin\n\nclass AutoCopyrightEventListener(sublime_plugin.EventListener)...
python
chosen
[ { "from": "human", "value": "Add program to graph theoretical vs experimental COBS/R overhead\n\nI wrote this a long time ago, but didn't put it into version control\nuntil now.\n" }, { "from": "gpt", "value": "\nfrom matplotlib import pyplot as plt\nimport numpy as np\nfrom cobs import cobs\nfr...
python
chosen
[ { "from": "human", "value": "Test serving of frontend page.\n" }, { "from": "gpt", "value": "# pylint: disable=invalid-name,too-many-public-methods\nfrom django.core.urlresolvers import reverse\nfrom django.test import TestCase\n\n\nclass StrassengezwitscherTests(TestCase):\n def test_serves_...
python
chosen
[ { "from": "human", "value": "Add ability to load projects\n" }, { "from": "gpt", "value": "import json\nimport os\nfrom typing import Dict\n\nfrom app.util import cached_function\n\n\nclass Projects():\n def __init__(self) -> None:\n self.data: Dict[str, Dict[str, Dict[str, str]]] = {}...
python
chosen
[ { "from": "human", "value": "Add Flask equivalent for psserver and sample_rpc\n" }, { "from": "gpt", "value": "import pickle\n\nfrom flask import Flask, abort\napp = Flask(__name__)\n\nimport petstore_impl\nimport petstore_server\n\nstore = petstore_impl.PetStore()\nserver = petstore_server.PetS...
python
chosen
[ { "from": "human", "value": "Add example for \"memory\" recurrent task.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport climate\nimport logging\nimport matplotlib.pyplot as plt\nimport numpy.random as rng\nimport theanets\n\nclimate.enable_default_logging()\n\nTIME = 10\nBATCH_S...
python
chosen
[ { "from": "human", "value": "Add example for adding and listing baselines\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport datetime\n\nfrom teamscale_...
python
chosen
[ { "from": "human", "value": "Add a regression test for EPIPE IOErrors\n\nThis should prevent bug 69 from regressing in the future and provides a\nframework for testing the addition of new errnos to the ingore list.\n" }, { "from": "gpt", "value": "from __future__ import with_statement\n\nimport ...
python
chosen
[ { "from": "human", "value": "Add new response to show QRcode which original data is placed in GoogleDrive.\n" }, { "from": "gpt", "value": "# -*- encoding:utf8 -*-\n\nimport csv\nimport cStringIO\nimport settings\n\nfrom flask import url_for\n\nfrom model.googledrive import GoogleDrive\nfrom plu...
python
chosen
[ { "from": "human", "value": "Add bash script to install require packages in pvpython\n" }, { "from": "gpt", "value": "#!/bin/bash\n\ndie () {\n echo >&2 \"$@\"\n exit 1\n}\n\n[ \"$#\" -eq 1 ] || die \"Please provide path to pvpython\"\n\necho \"Installing requests ...\"\n\nREQUESTS_DIR=`mk...
python
chosen
[ { "from": "human", "value": "Add some tests for db URLs\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nfrom indra.databases import get_identifiers_url\n\n\ndef test_chembl():\n cid = '1229517'\n ass...
python
chosen
[ { "from": "human", "value": "Add helper utility for testing HTTP sites.\n" }, { "from": "gpt", "value": "from zope.interface import implements\n\nimport treq\nfrom twisted.internet import reactor\nfrom twisted.internet.defer import inlineCallbacks\n\nfrom vumi.tests.helpers import IHelper\n\n\nc...
python
chosen
[ { "from": "human", "value": "Add tests for longer and mixed English texts\n" }, { "from": "gpt", "value": "# coding: utf-8\n\"\"\"Test that longer and mixed texts are tokenized correctly.\"\"\"\n\n\nfrom __future__ import unicode_literals\n\nimport pytest\n\n\ndef test_tokenizer_handles_long_tex...
python
chosen
[ { "from": "human", "value": "Add start and end year in the academic year table and model - migrations file\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...
python
chosen
[ { "from": "human", "value": "Implement async github api client\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport base64\nimport logging\nimport json\n\nimport aiohttp\n\nlogger = logging.getLogger('cibopath')\n\nAPI_ROOT = 'https://api.github.com/'\nAPI_README = API_ROOT + 'repo...
python
chosen
[ { "from": "human", "value": "Add unittests for the plugin util\n" }, { "from": "gpt", "value": "# Copyright 2020 Mycroft AI Inc.\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 copy of...
python
chosen
[ { "from": "human", "value": "Add a management command to add the default groups we want\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand\n\nfrom django.contrib.auth.models import Group, Permission\n\n\nclass Command(BaseCommand):\n ...
python
chosen
[ { "from": "human", "value": "Add shinken plugin to check memory usage\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Autor : David Hannequin <david.hannequin@gmail.com>\n# Date : 29 Nov 2011\n\n#\n# Script init\n#\n\nimport sys\nimport os\nimport argparse\nimport getopt \n\n#\n# U...
python
chosen