conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add initial version of GPU-based port mapper class.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nPort mapper for GPU memory.\n\"\"\"\n\nimport numpy as np\nimport pycuda.gpuarray as gpuarray\n\nfrom plsel import BasePortMapper\n\nclass GPUPortMap... | python | chosen |
[
{
"from": "system",
"value": "Update trove classifiers with generic language versions\n"
},
{
"from": "human",
"value": "import multiprocessing # noqa # stop tests breaking tox\nfrom setuptools import setup\n\nimport tvrenamr\n\n\nrequires = ['pyyaml', 'requests']\nsetup_requires = ('minimock',... | python | chosen |
[
{
"from": "human",
"value": "Update for Fire Emblem Heroes\n"
},
{
"from": "gpt",
"value": "import requests, json, sys\nfrom bs4 import BeautifulSoup\n\ndef print_stats(data, hero, stats):\n\tprint(hero + \" \" + stats)\n\theader = [\"Rarity: \", \"HP: \", \"ATK: \", \"SPD: \", \"DEF: \", \"RES... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for celery.py task\n\nThis file isn't being run by any of the tests so we have no guarantee\nthat it's even valid Python. Let's at least run it a little bit.\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom mock import patch\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a schema migration for Mozilla Phabricator External Account.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-07-20 10:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add first working attempt at Hippo CMS signature\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis signature contains tests to see if the site is running on Hippo CMS.\n\"\"\"\n__author__ = \"Jeroen Reijn\"\n__copyright__ = \"CM Fieldguide\"\n__credits__ = [\"Jeroen Reij... | python | chosen |
[
{
"from": "human",
"value": "Add test for logging callback handler\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division\nimport logging\nimport mock\nimport workflows.logging\n\ndef test_callback_handler_works_within_logging_framework():\n cbmock = mock.Mock()\n lo... | python | chosen |
[
{
"from": "human",
"value": "Add form for getting event data on Arkistoija app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom uni_form.helper import FormHelper\nfrom uni_form.layout import Submit, Layout, Fieldset, ButtonHolder\nfrom django.core.except... | python | chosen |
[
{
"from": "human",
"value": "[hacks] Compress folder with small files\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n\"\"\"\n\nCompress and delete a folder if 50% of the files inside it are less than 2MB.\n\nIt only considers files in the first level of the folder.\n\n\"\"\"\nimport os\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add dark cal scale test\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom .. import dark_scale\n\ndef test_dark_temp_scale():\n scale = dark_scale.dark_temp_scale(-10., -14)\n assert np.allclose(scale, 0.70)\n\n scale = dark_scale.dark_temp_scale(-10... | python | chosen |
[
{
"from": "human",
"value": "Add create alias queue sample\n"
},
{
"from": "gpt",
"value": "'''\n This sample will create a new alias queue.\n MQWeb runs on localhost and is listening on port 8081.\n'''\nimport sys\nimport json\nimport httplib\nimport socket\nimport argparse\n\nparser = argparse... | python | chosen |
[
{
"from": "human",
"value": "Add a crasher for the thread-unsafety of file objects.\n"
},
{
"from": "gpt",
"value": "# An example for http://bugs.python.org/issue815646\n\nimport thread\n\nwhile 1:\n f = open(\"/tmp/dupa\", \"w\")\n thread.start_new_thread(f.close, ())\n f.close()\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add tests for back end\n"
},
{
"from": "gpt",
"value": "import pytest\nimport os\nimport numpy as np\n\nimport sys\nmyPath = os.path.dirname(os.path.abspath(__file__))\nsys.path.insert(0, os.path.join(myPath, '..'))\n\nfrom DBNlogic.sets import exists, DataSet, MNIST... | python | chosen |
[
{
"from": "human",
"value": "Add org end to end testing\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests updating config of a real org and repo under the dothub-sandbox organization\"\"\"\n\nimport pytest\nfrom click.testing import CliRunner\nimport tempfile\nfrom dothub._main import dothub\nfrom do... | python | chosen |
[
{
"from": "human",
"value": "Write solution to Chef and Apples problem.\n"
},
{
"from": "gpt",
"value": "# http://www.codechef.com/DEC14/problems/CAPPLE\n\ndef pluck(trees):\n\n\t# find the biggest and the second biggest number in the list\n\tmaximum = max(trees)\n\tsecond_max = max( map(lambda ... | python | chosen |
[
{
"from": "human",
"value": "Make code that simply finds chrome tabs to attach to.\n"
},
{
"from": "gpt",
"value": "from util import *\nimport json\n\nclass ChromeTabFinder(object):\n def __init__(self, host, port):\n self._next_seq = 0\n self._timer = Timer(250)\n self._timer.tick.add... | python | chosen |
[
{
"from": "human",
"value": "Add a minimal alternative to `cargo graph`\n\nI tried `cargo graph` and some of its successors,\nbut didn’t manage to make them produce what I wanted\n(or in some cases make them work at all.)\n\nThis Python script reimplements similar functionality\nbased on parsing the (JSON) ... | python | chosen |
[
{
"from": "system",
"value": "[Python] Fix the sample python plugin.\n\nPyGI doesn't handle default values for introspected methods,\nso we need to specify all the arguments for pack_start()\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# ex:set ts=4 et sw=4 ai:\n\nimport gobject\n... | python | chosen |
[
{
"from": "human",
"value": "Add the proximity warning detector class\n"
},
{
"from": "gpt",
"value": "import Edison.i2c as I2C\nimport sharp2y0a21\nimport ads1015\nimport time\nimport thread\n\nclass proximity_warning:\n\n def __init__(self, sensorid, calibration, sensing_freq):\n sel... | python | chosen |
[
{
"from": "human",
"value": "Add test that an Apply generator can be spawned and the spawned version produces the same elements\n"
},
{
"from": "gpt",
"value": "import pytest\n#from .exemplar_generators import EXEMPLAR_PRIMITIVE_GENERATORS\nfrom .context import tohu\nfrom tohu.v6.primitive_gener... | python | chosen |
[
{
"from": "human",
"value": "Implement 'Guess The Animal' game in Python 3\n\nResolves #6\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport sys\nimport json\n\nTEXT_FILE_PATH = './text.json'\nmessages = None\n\ndef traverse(parent, path):\n node = parent[path]\n\n if (isinstanc... | python | chosen |
[
{
"from": "human",
"value": "Add meek fronted requests test\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n#\n# :licence: see LICENSE\n\nfrom twisted.python import usage\nfrom ooni.templates import httpt\nfrom ooni.utils import log\n\nclass UsageOptions(usage.Options):\n optParam... | python | chosen |
[
{
"from": "human",
"value": "Add experiment utils function tests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function\n\nfrom unittest.mock import patch\n\nimport os\n\nfrom experiments.utils import (\n create_experiment_lo... | python | chosen |
[
{
"from": "human",
"value": "Add a utility script to print duplicates\n\nAdd a utility script to print duplicates"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport json\nimport os\nimport random\n\nscriptpath = os.path.dirname(__file__)\ndata_dir = os.path.join(scriptpath, 'data')\... | python | chosen |
[
{
"from": "human",
"value": "Add example of a 2-D histogram, illustrating mutual information.\n"
},
{
"from": "gpt",
"value": "from skimage.viewer import ImageViewer\nfrom skimage import data, img_as_float\n\nfrom skimage.viewer.plugins.plotplugin import PlotPlugin\nfrom skimage.viewer.widgets i... | python | chosen |
[
{
"from": "system",
"value": "Raise hard error when API key is invalid\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.utils.crypto import constant_time_compare\nfrom rest_framework.authentication impo... | python | chosen |
[
{
"from": "human",
"value": "BENCH: Add simple scalar math benchmarks\n"
},
{
"from": "gpt",
"value": "from .common import Benchmark, TYPES1\n\nimport numpy as np\n\n\nclass ScalarMath(Benchmark):\n # Test scalar math, note that each of these is run repeatedly to offset\n # the function ca... | python | chosen |
[
{
"from": "human",
"value": "Add parser to parse the mapping between seqid and author assigned PDB\nindexes from PDBML format.\n"
},
{
"from": "gpt",
"value": "import gzip\nfrom xml.parsers import expat\n\nclass PDBMap(object):\n \"\"\"Parse PDBML file for mappings between indexes of auth_seq... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton unittest file for util.py .\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n\nimport unittest\n\nsys.path.append(\n os.path.join(\n os.path.dirname(\n os.path.realpath(\n __file__)),\n \"..\",\n \"li... | python | chosen |
[
{
"from": "human",
"value": "Add a script to easily view new submitted plugins\n\nSummary: That is, submitted plugins that we don't already know about and are non-empty.\n\nTest Plan:\n- imported the `submitted_plugins` table from prod\n- ran `PYTHONPATH=. python tools/clean_submitted_plugins.py`\n- saw the... | python | chosen |
[
{
"from": "human",
"value": "Add one-off script to get a csv of agency data\n"
},
{
"from": "gpt",
"value": "import csv\nfrom django.core.management.base import BaseCommand\nfrom corehq.apps.locations.models import SQLLocation\nfrom corehq.apps.users.models import CommCareUser\n\n\nclass Command... | python | chosen |
[
{
"from": "human",
"value": "Create Common functions used for cleaning up items used for testing\n\nCreates common functions used to cleanup secrets, containers, and\norders used in client functional tests.\n\nChange-Id: I3c37ab78c8c2c1d9a6e5299f303d11d786f39b5e\n"
},
{
"from": "gpt",
"value": "... | python | chosen |
[
{
"from": "human",
"value": "Change MNIST example for future API\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport plac\n\nfrom thinc.neural.vec2vec import ReLu, Softmax\nfrom thinc.api import clone, chain\n\nfrom thinc.extra import datasets\nfrom thinc.neural.loss i... | python | chosen |
[
{
"from": "system",
"value": "Add Project.first_event to API serializer\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.models import OrganizationMemberType, Project, Team\n\n\n@register(Project)\nc... | python | chosen |
[
{
"from": "human",
"value": "[skip ci] Add simple script to write tasks_list file\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"\nA tool to generate a tasks_list.... | python | chosen |
[
{
"from": "human",
"value": "ADd a sample for converting mac to lla\n"
},
{
"from": "gpt",
"value": "def mac_to_lladdr(mac):\n macpieces = []\n mac = mac.replace('-', ':')\n for byte in mac.split(':'):\n macpieces.append(int(byte, 16))\n macpieces[0] = macpieces[0] ^ 2\n... | python | chosen |
[
{
"from": "human",
"value": "Add a custom kernel for repairing continuity of broken solutions\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\n\nmesh = UnitSquareMesh(2, 2)\n\nRT = FiniteElement(\"RT\", triangle, 1)\nBR... | python | chosen |
[
{
"from": "human",
"value": "Add Azure disk integration test\n\nTest that we can actually create a disk in an Azure VM. This is very\nsimilar to the GCP and AWS disk integration tests.\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Google Inc. All rights reserved.\n#\n# Licensed under the Apa... | python | chosen |
[
{
"from": "human",
"value": "Add tests for string.Template engine.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport unittest\n\n\nimport engines\n\n\nHANDLE = 'string.Template'\n\n\nclass TestStringTemplate(unittest.TestCase):\n\n def t... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the PyScss filter.\n\nThe new webassets master adds configuration values that make the filter\nusable with Flask-Assets.\n"
},
{
"from": "gpt",
"value": "from nose.tools import assert_raises\nfrom helpers import TempEnvironmentHelper\n\n\nclass TestFil... | python | chosen |
[
{
"from": "human",
"value": "Add test for simdata and GOT relocations\n"
},
{
"from": "gpt",
"value": "import nose\nimport cle\n\nimport os\ntest_location = os.path.join(os.path.dirname(os.path.realpath(__file__)),\n os.path.join('..', '..', 'binaries'... | python | chosen |
[
{
"from": "human",
"value": "Add test script to create gpt partition for test\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Windows Azure Linux Agent\n#\n# Copyright 2014 Microsoft Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not u... | python | chosen |
[
{
"from": "human",
"value": "Add Ripper class to utils\n"
},
{
"from": "gpt",
"value": "'''\nExtremely light-weight serialiser for very simple cases.\n'''\nfrom operator import attrgetter\nfrom collections import namedtuple\n\n\nclass Ripper(object):\n def __init__(self, *args, **kwargs):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating error code handling in GLCLient\n"
},
{
"from": "gpt",
"value": "import inspect\nimport string\nimport sys\nimport os\nglobaleaks_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')\nsys.path.append(globaleaks_path)\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add a script to test keras functional models\n\nWe have a C++ script to test functional models using lwtnn, this adds\na short script to test the same model in Keras. At the moment it only\ntests a dummy \"ramp\" pattern, i.e. np.linspace(-1, 1, n_features).\n"
},
{
"fro... | python | chosen |
[
{
"from": "human",
"value": "feat: Include module for probability manipulations\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed May 3 12:12:53 2017\n\n@author: daniele\n\"\"\"\n\nimport numpy as np\n\n\ndef minmaxlog(value):\n \"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for pivoted cholesky\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 torch\nimport unittest\nfrom torch.au... | python | chosen |
[
{
"from": "human",
"value": "Add a build for django_compressor."
},
{
"from": "gpt",
"value": "import sys\nfrom base import BaseBuild\nfrom pony_build import client as pony\n\nclass PonyBuild(BaseBuild):\n\n def __init__(self):\n super(PonyBuild, self).__init__()\n self.repo_url... | python | chosen |
[
{
"from": "human",
"value": "Add an example of how to use the USB driver\n"
},
{
"from": "gpt",
"value": "\"\"\"\nInterrogate stick for supported capabilities.\n\n\"\"\"\n\nimport sys\n\nfrom ant.core import driver\nfrom ant.core import node\n\nfrom config import *\n\n# Initialize\nstick = drive... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract top couplings\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport numpy as np\nimport optparse\n\n\ndef main():\n parser = optparse.OptionParser(usage=\"%prog [options] coupling_matrix\")\n parser.add_option(\"-s\", \"--min-se... | python | chosen |
[
{
"from": "human",
"value": "Add basic state machine and game mechanics.\n"
},
{
"from": "gpt",
"value": "import sys\nimport random\nimport argparse\n\nfrom gostop import GameState, HumanAgent, RandomAgent\n\n\ndef main(argv):\n parser = argparse.ArgumentParser(formatter_class=argparse.Argume... | python | chosen |
[
{
"from": "human",
"value": "Add check script for canny\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, division\nimport imgaug as ia\nimport imgaug.augmenters as iaa\n\n\ndef main():\n black_and_white = iaa.RandomColorsBinaryImageColorizer(\n color_fg=255, colo... | python | chosen |
[
{
"from": "human",
"value": "Add model for polls db\n"
},
{
"from": "gpt",
"value": "import datetime\nfrom flask import url_for\nfrom Simpoll import db\n\n\nclass Poll(db.Document):\n created_at = db.DateTimeField(default=datetime.datetime.now, required=True)\n question = db.StringField(ma... | python | chosen |
[
{
"from": "human",
"value": "Add unit test cases for k8s expr starter\n\n1, start_expr\n\nSigned-off-by: chensong <ae7d166f23a6fc29809e39146fc64585e5c46680@linuxep.com>\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nThis file is covered by the LICENSING file in the root of thi... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating coverage.py commands.\n\nIt's only correct for Linux for now.\n\nBug: chromium:844647\nChange-Id: I8fce28d88a4d060553e30fe0862d34815988ba61\nReviewed-on: https://webrtc-review.googlesource.com/79149\nReviewed-by: Mirko Bonadei <d2c43c210eae6feef04f53bae... | python | chosen |
[
{
"from": "human",
"value": "Add module to create markdown/HTML table entry and update ipynb.\n"
},
{
"from": "gpt",
"value": "#import pylab\n#import numpy as npf\nfrom sumatra.projects import load_project\nfrom texttable import Texttable\nfrom sumatra.formatting import HTMLFormatter\n\ndef mark... | python | chosen |
[
{
"from": "human",
"value": "Add script computing exact_match and f1_match for Quasar-T"
},
{
"from": "gpt",
"value": "import string\n\npct = string.punctuation\narticles = ['a','an','the']\n\ndef _clean_string(x):\n # lowercase, remove articles, remove punctuation, \n # and return as a si... | python | chosen |
[
{
"from": "human",
"value": "Test script for machanical and optical limit switches on GPIO\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as GPIO\nimport time\n\n# Use GPIO numbers, not pin numbers (alt=BOARD for the numbers on the GPIO header pins)\nGPIO.setmode(GPIO.BCM)\n\n#set up the GPIO ... | python | chosen |
[
{
"from": "human",
"value": "Add multipatch logfile unit tests\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom acq4.modules.MultiPatch.logfile import MultiPatchLog, IrregularTimeSeries\n\n\ndef test_timeseries_index():\n \n ts1 = [\n (10, 0.5),\n (12, 13.4),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add code for the mechanical aspects of sending te emails via AWS.\n"
},
{
"from": "gpt",
"value": "\nimport boto3\nimport os\n\ndef get_aws_creds():\n \"\"\"\n Pulls the AWS credentials from the current environment.\n This assumes the following two environme... | python | chosen |
[
{
"from": "human",
"value": "mangement: Create command for creating default stream groups.\n"
},
{
"from": "gpt",
"value": "\nfrom typing import Any\n\nfrom argparse import ArgumentParser\nfrom confirmation.models import Confirmation, create_confirmation_link\nfrom zerver.lib.management import Z... | python | chosen |
[
{
"from": "human",
"value": "Implement dynamic shape and raw_shape\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\n\n\ndef shape(tt):\n \"\"\"Returns the shape of a TensorTrain.\n\n This operation returns a 1-D integer tensor representing the shape of\n the input. For TT-matrices th... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for reuse\n"
},
{
"from": "gpt",
"value": "\nfrom django.template import TemplateSyntaxError\nfrom django.template.loader import get_template\nfrom django.test import SimpleTestCase\n\nfrom .utils import TemplateTestMixin\n\n\nclass TestReuse(Template... | python | chosen |
[
{
"from": "human",
"value": "Add first set of exercises\n"
},
{
"from": "gpt",
"value": "# Basic string exercises\n# Fill in the definitions for the required functions. The main functions and the testing \n# has been handled, so when you run a program, you will get an output of how many testcase... | python | chosen |
[
{
"from": "human",
"value": "[AC-8173] Add quick unit test for flag_smith_has_feature\n"
},
{
"from": "gpt",
"value": "from bullet_train import BulletTrain\nfrom mock import patch\nfrom django.test import TestCase\n\nfrom ..utils import flag_smith_has_feature\n\n\nclass TestUtils(TestCase):\n ... | python | chosen |
[
{
"from": "human",
"value": "Remove duplicates from an unsorted linked list\n"
},
{
"from": "gpt",
"value": "'''\nWrite code to remove duplicates from an unsorted linked list.\nFOLLOW UP\nHow would you solve this problem if a temporary buffer is not allowed?\n'''\n\n\nclass Node(object):\n de... | python | chosen |
[
{
"from": "human",
"value": "Add helpers to manage file names\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n# -------------------------------------------------------------------------------\n# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>\n# Grupo de Inteligencia Computational <www.eh... | python | chosen |
[
{
"from": "human",
"value": "Add empty module for html generation\n"
},
{
"from": "gpt",
"value": "'''\nCreated on 06 Jan 2016\n\n Copyright (c) 2014 Brendan Gray and Sylvermyst Technologies\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this softw... | python | chosen |
[
{
"from": "human",
"value": "Add basic Wunderground API wrapper.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n'''\nWunderground API command line script.\n'''\n\nimport sys\nimport requests\n\n# todo: raise error if no config file\nfrom config import WUAPI\n\n\nclass Wunder(object):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test for LineProfiler tool\n"
},
{
"from": "gpt",
"value": "import skimage.data as data\nfrom skimage.viewer import ImageViewer\nfrom numpy.testing import assert_equal, assert_allclose\n\n\ndef setup_line_profile(image):\n from skimage.viewer.plugins.lineprofi... | python | chosen |
[
{
"from": "human",
"value": "Test for lisp external-program functionality\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfh = open('/home/ben/dump.txt', 'w')\nimport sys\nfor ln in sys.stdin:\n print >> fh, \"here\"\n print >> fh, ln\nprint >> fh, \"input closed\"\nfh.close()\n\... | python | chosen |
[
{
"from": "system",
"value": "Update SUPPORTS_TRANSACTIONS attribute to what is expected by Django 1.2.\n\nPatch contributed by Felix Leong. Thanks.\n\nFixes Issue #162.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python2.4\n#\n# Copyright 2008 Google Inc.\n#\n# Licensed under the Apache Licen... | python | chosen |
[
{
"from": "human",
"value": "Add migrations that protects packages on category deletion\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.5 on 2019-09-27 16:16\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Write the Validation class (wrapper around the DataPackage class).\n"
},
{
"from": "gpt",
"value": "\"\"\"Validate data-packages\"\"\"\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ ... | python | chosen |
[
{
"from": "human",
"value": "Add ordering by family name to Family model.\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 ('g... | python | chosen |
[
{
"from": "human",
"value": "Add testing for shadow_stdout parser module\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport parser.log_file.shadow_stdout\n\ngood_shadow_text = '''root:!:16179:0:99999:7:::\nvagrant:$6$5M8f9rEy$nFWJvEnn2KFQwFsm6oRMyxva3mVixbyxZIE3cYTJ.ARFMt6Nq6gsnqScUkZ/slZ8... | python | chosen |
[
{
"from": "human",
"value": "Add a test for |pv| command.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for scripts/print_view_hierarchy.py.\"\"\"\nimport re\nimport unittest\n\nfrom test_utils import import_utils\nimport_utils.prepare_lldb_import_or_exit()\n\nimport lldb\n\nimport_utils.prepare_... | python | chosen |
[
{
"from": "human",
"value": "Subtract a rotation curve from a cube\n"
},
{
"from": "gpt",
"value": "\nfrom astropy.io import fits\nfrom spectral_cube import SpectralCube\nimport astropy.units as u\nimport numpy as np\nimport os\nfrom astropy.utils.console import ProgressBar\n\n'''\nSubtract a ro... | python | chosen |
[
{
"from": "human",
"value": "Testing: Add a test for QtWebEngineWidgets\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport pytest\n\n\ndef test_qtwebenginewidgets():\n \"\"\"Test the qtpy.QtWebSockets namespace\"\"\"\n from qtpy import QtWebEngineWidgets\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tool that will show the shared packages\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\nimport yaml\n\nimport paste.util.multidict\n\npossible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),\n os.pard... | python | chosen |
[
{
"from": "human",
"value": "Add a generic code edit example\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nA simple example that shows how to setup CodeEdit.\n\nIn this example, we install a syntax highlighter mode (based on pygments), a\nmode that high... | python | chosen |
[
{
"from": "human",
"value": "Add example of LVM cache creation\n\nUseful for testing as well as for users wondering how to do something like this.\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom examples.common import print_devices\n\nimport blivet\nfrom blivet.size import Size\nfrom blivet.u... | python | chosen |
[
{
"from": "human",
"value": "Add helper class for excel importing\n"
},
{
"from": "gpt",
"value": "from dimagi.utils.excel import WorkbookJSONReader\nfrom soil import DownloadBase\n\n\nclass ExcelImporter(object):\n # TODO make sure people can't instantiate ExcelImporter directly\n def __i... | python | chosen |
[
{
"from": "human",
"value": "Modify the segfaulting example to show why r53997 is not a solution to\nit.\n"
},
{
"from": "gpt",
"value": "\n# http://python.org/sf/1303614\n\nclass Y(object):\n pass\n\nclass type_with_modifiable_dict(type, Y):\n pass\n\nclass MyClass(object):\n \"\"\"Thi... | python | chosen |
[
{
"from": "system",
"value": "Use *_preview settings for OBI."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Settings for obi.1flow.net (test)\n\nimport os\nfrom sparks.django.settings import include_snippets\n\ninclude_snippets(\n os.path.dirname(__file__), (\n # no debug... | python | chosen |
[
{
"from": "human",
"value": "Add script to make json crop types look up\n\n- Without script if there's an update to the group_ids and crop type mapping\n you have to column copy paste the csv into `cropTypes.json`\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nimport c... | python | chosen |
[
{
"from": "human",
"value": "Support simplified requests for non-DB deployments\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.core.validators\n\n\nclass Migration(migrations.Migration):... | python | chosen |
[
{
"from": "human",
"value": "[Backport] Clean user role permissions: remove vote_issues in Role.permissions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-04-04 09:32\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add python example for NoveltyCurve use\n"
},
{
"from": "gpt",
"value": "import sys\nimport essentia.standard as es\nfrom essentia import *\nimport numpy\nimport pylab\n\n\ntry:\n input_file = sys.argv[1]\nexcept:\n print \"usage:\", sys.argv[0], \"<input_file>... | python | chosen |
[
{
"from": "human",
"value": "Add migration for date_modified field.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis will add a date_modified field to all nodes. Date_modified will be set equal to the date of the last log.\n\"\"\"\nimport sys\nimport logging\n\nfrom website import models\nfrom web... | python | chosen |
[
{
"from": "human",
"value": "Add tests and fixtures for the Roles API wrapper\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"pytest Roles API wrapper tests and fixtures.\"\"\"\n\n\nimport pytest\n\nimport ciscosparkapi\n\n\n# Helper Functions\n\ndef get_list_of_roles(api, max=... | python | chosen |
[
{
"from": "human",
"value": "Test for Amazon requests via a port forwarder.\n"
},
{
"from": "gpt",
"value": "import socket\r\nimport sys\r\nimport threading\r\nimport time\r\n\r\nSERVER_THREADS = []\r\n\r\n\r\ndef start_server(local_port, remote_host, remote_port, out_file=None):\r\n t = thre... | python | chosen |
[
{
"from": "human",
"value": "test: Add test for str in EnvironmentVariable\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom frigg.projects.models import EnvironmentVariable, Project\n\n\n@pytest.fixture\ndef project():\n return Project(owner='frigg', name='frigg-hq')\n\n\ndef test_envir... | python | chosen |
[
{
"from": "human",
"value": "Add script that downloads templates\n\nA script has been added to download the templates from GitHub. The\ntemplates are checked out as a Git repository, making it really easy to\ndownload changes later on.\n\nIf the repository does not exist yet, \"git clone\" is executed to cr... | python | chosen |
[
{
"from": "human",
"value": "Add migration fix published language\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.1.14 on 2022-03-11 15:06\n\nfrom django.conf import settings\nfrom django.db import migrations\n\n\ndef forward(apps, schema_editor):\n with schema_editor.connection.curs... | python | chosen |
[
{
"from": "human",
"value": "Test - Add a test for pre-commit compliance\n"
},
{
"from": "gpt",
"value": "import subprocess\nimport unittest\n\n\nclass TestPreCommitNormalization(unittest.TestCase):\n def test_normalization(self):\n \"\"\" We test if the code was properly formatted wit... | python | chosen |
[
{
"from": "human",
"value": "Add import script to read in profile json.\n"
},
{
"from": "gpt",
"value": "from warnings import warn\nimport json\n\nfrom django.core.management.base import LabelCommand, CommandError\n\nfrom pombola.core.models import Person\n\n# Expected JSON is an array of entrie... | python | chosen |
[
{
"from": "human",
"value": "Add map helpers for use in future melting pot version.\n\nPiperOrigin-RevId: 485877335\nChange-Id: I852247fa319f3aefb0cf82a914df674254001e3b\n"
},
{
"from": "gpt",
"value": "# Copyright 2022 DeepMind Technologies Limited.\n#\n# Licensed under the Apache License, Vers... | python | chosen |
[
{
"from": "human",
"value": "Add file level aggregation tests\n"
},
{
"from": "gpt",
"value": "# Copyright 2020 Google LLC\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 the L... | python | chosen |
[
{
"from": "human",
"value": "Test FileNotFound error from ModelLoader\n"
},
{
"from": "gpt",
"value": "from pytest import raises\nfrom smif.data_layer.model_loader import ModelLoader\n\n\ndef test_path_not_found():\n \"\"\"Should error if module file is missing at path\n \"\"\"\n loader... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.