conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test for accessibility statement last review\n\nThis is a proposal of a way to test that changes\nto this page include updates to the 'last\nreviewed' date, if needed.\n"
},
{
"from": "gpt",
"value": "import re\nimport subprocess\nfrom datetime import datetime\n\... | python | chosen |
[
{
"from": "human",
"value": "Add sample for using Property collector to assist in filtering VMs\n\nThe property collector can be used to fetch a subset of properties\nfor a large amount of objects with fewer round trips that iterating.\n\nThis sample shows how it could be used to fetch the power state of\na... | python | chosen |
[
{
"from": "human",
"value": "Add script to download files from Commons\n\nThis command line script interfaces with the commonsdownloader module.\n\nIt provides two ways to download files:\n-give file names to the command line\n-give a text file listing all the files to download\n"
},
{
"from": "gpt"... | python | chosen |
[
{
"from": "human",
"value": "CBPS-210: Add a script for periodic compaction of Seriesly databases\n\nChange-Id: I95123c116c0dcdce4b4df02974d2a9fdeaef55dc\nReviewed-on: http://review.couchbase.org/69249\nTested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>\nReviewed-by: Pavel Paulau <... | python | chosen |
[
{
"from": "human",
"value": "Add try-catch-finally and exception demo.\n"
},
{
"from": "gpt",
"value": "import json\ndef div(a, b):\n try:\n print(\"calculating {}/{}: \".format(a, b))\n result = a / b\n except ZeroDivisionError as ex:\n print(ex)\n else:\n p... | python | chosen |
[
{
"from": "human",
"value": "Test case for saying hello to target and get platform information from it\n"
},
{
"from": "gpt",
"value": "import os\nfrom oeqa.oetest import oeRuntimeTest\n\nclass Mraa_hello(oeRuntimeTest):\n '''Say hello to mraa library and get platform name through it'''\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement basic FAQ command with remote config\n"
},
{
"from": "gpt",
"value": "import json\nimport logging\nimport urllib.request\n\nfrom discord.ext import commands\nfrom discord.ext.commands import CommandError, Context\n\nfrom cogbot import checks\nfrom cogbot.co... | python | chosen |
[
{
"from": "human",
"value": "Create this file as a simple example of closure\n\ni have added full working of example with comments so that whoever reads this can understand closure. This is the simplest closure example i can find."
},
{
"from": "gpt",
"value": "def printMsg(msg):\n#This is the m... | python | chosen |
[
{
"from": "human",
"value": "Add small script to retrieve lexers from pygments\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom pygments.lexers import (get_all_lexers)\n\nfor lexname, aliases, _, mimetypes in get_all_lexers():\n\tprint \"%s\" % (lexname)\n\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Implement top level function 'save_data()', 'load_data()'\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport shelve\n\n\nDATA_FILE = 'guestbook.dat'\n\n\ndef save_data(name, comment, create_at):\n \"\"\"投稿データを保存します\n \"\"\"\n database = shelv... | python | chosen |
[
{
"from": "human",
"value": "Add text-file.py to make minimal records from whole text files.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys\nfrom pyspark.sql import SparkSession, Row\nfrom pyspark.sql.functions import col\n\nif __name__ == \"__main__\":\n i... | python | chosen |
[
{
"from": "human",
"value": "Add a benchmark report to show the speed performance.\n"
},
{
"from": "gpt",
"value": "'''\nMake a report showing the speed of some critical commands\nCheck whether it is fast enough for your application\n'''\nfrom __future__ import print_function\nfrom unrealcv impo... | python | chosen |
[
{
"from": "human",
"value": "Add a filter class for Entries\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nimport django_filters\n\nfrom trex.models import Entry\... | python | chosen |
[
{
"from": "human",
"value": "Add script to end positions which meet the given criteria\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nimport sys\n\nfrom django.core.management.base import NoArgsCommand, CommandError\nfrom django_date_extensions.fields import ApproximateDate\n... | python | chosen |
[
{
"from": "human",
"value": "KE: Add a script for hiding people on Mzalendo, as requested\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\n\nfrom django.core.management.base import NoArgsCommand, CommandError\nfrom django.db.models import Q\n\nfrom pombola.core.models import Pe... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 599. Minimum Index Sum of Two Lists\n\n599. Minimum Index Sum of Two Lists: https://leetcode.com/problems/minimum-index-sum-of-two-lists/\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nclass Solution(object):\n def findRe... | python | chosen |
[
{
"from": "human",
"value": "Add API test for profile type show/list\n\nChange-Id: Ibb260e41f5ddcc9ac1e6603a8e749167927efc54\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. Yo... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot excitation distribution from output.\n\nI think this is useful enough to warrant a script in the repo.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n'''Plot excitation distribution from dmqmc output.'''\n\nimport os\nimport sys\nimport ma... | python | chosen |
[
{
"from": "human",
"value": "Add test for default_db schema\n\n"
},
{
"from": "gpt",
"value": "# -*- mode: python; coding: utf-8 -*-\n# Copyright 2016 the HERA Collaboration\n# Licensed under the 2-clause BSD license.\n\n\"\"\"\nTest that default database matches code schema.\n\"\"\"\nfrom sqlal... | python | chosen |
[
{
"from": "human",
"value": "Add basic core admin on Channel\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom datetime import datetime\nfrom django.contrib import admin\n\nfrom opps.core.models import Channel\n\nclass ChannelAdmin(admin.ModelAdmin):\n\n prepopulated_fields = {\"... | python | chosen |
[
{
"from": "human",
"value": "Test for record dshape <-> dtype conversions.\n"
},
{
"from": "gpt",
"value": "from ndtable import RecordDecl\nfrom ndtable import float32, int32\nfrom numpy import dtype\n\nclass Simple(RecordDecl):\n foo = int32\n bar = float32\n\n __dummy = True\n\ndef te... | python | chosen |
[
{
"from": "human",
"value": "Test to verify behaviour when key not found\n"
},
{
"from": "gpt",
"value": "from hfetch import *\nimport time\n\n\ncontact_names = ['127.0.0.1']\nnodePort = 9042\nkeyspace = 'test'\ntable = 'particle'\n\ntoken_ranges = [(8070430489100699999,8070450532247928832)]\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add Sniffer thread class sketch\n"
},
{
"from": "gpt",
"value": "import threading\nfrom time import sleep\n\n\nclass Sniffer(threading.Thread):\n def __init__(self, arg):\n # Set thread to run as daemon\n self.daemon = True\n\n # Initialize ob... | python | chosen |
[
{
"from": "human",
"value": "Add ean check free code\n"
},
{
"from": "gpt",
"value": "#!environment python\n# -*- coding: utf-8 -*-\n###############################################################################\n#\n# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).\n#\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add HWRNG performance test script\n"
},
{
"from": "gpt",
"value": "#!/bin/python\n\nimport logging\nfrom netrng import NetRNGServer\n\n\nlog = logging.getLogger(__name__)\nlog.setLevel(logging.DEBUG)\nmainHandler = logging.StreamHandler()\nmainHandler.setFormatter(lo... | python | chosen |
[
{
"from": "human",
"value": "Add a coverage test using the sample text files in gflanguages\n"
},
{
"from": "gpt",
"value": "from glyphsets.codepoints import CodepointsInSubset\nfrom fontTools.unicodedata.Scripts import NAMES\nimport pytest\nimport unicodedata\nfrom collections import defaultdic... | python | chosen |
[
{
"from": "human",
"value": "Add fibonacci nth num computation w/ DP in python\n"
},
{
"from": "gpt",
"value": "# computes the n_th number of the fibonacci sequence\n# with the help of dynamic programming to avoid recursive recomputations\ndef dyn_fib(n, memo):\n if n < 1:\n return 0\n... | python | chosen |
[
{
"from": "human",
"value": "Add a management script to set stream colors for a domain.\n\n(imported from commit 186e8226b57d385bbbed756615c0c63315c9d463)\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\n\nfrom django.core.management.base import BaseCommand\nfrom django.db.mode... | python | chosen |
[
{
"from": "human",
"value": "Add script to import income data\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport transaction\n\nimport pandas as pd\n\nfrom sqlalchemy import engine_from_config\n\nfrom pyramid.paster import (\n get_appsettings,\n setup... | python | chosen |
[
{
"from": "human",
"value": "Add script to validate system libs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Checks that the options mentioned in syslibs_configure.bzl are consistent with the valid options in workspace.bzl\n# Expects the tensorflow source folder as the first argum... | python | chosen |
[
{
"from": "human",
"value": "Tests: Add class to abstract parser memoization.\n"
},
{
"from": "gpt",
"value": "from compiler import error, parse\n\n\nclass ParserDB():\n \"\"\"A class for parsing with memoized parsers.\"\"\"\n\n parsers = {}\n\n @classmethod\n def _parse(cls, data, s... | python | chosen |
[
{
"from": "human",
"value": "Add script to update user location\n"
},
{
"from": "gpt",
"value": "from google.cloud import firestore\nimport argparse\nimport datetime\nimport helpers\nimport random\n\n\ndef updateLocation(db, user, ref_lat, ref_lon, range):\n doc_ref = db.collection(u'users').do... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test for function lifetime\n"
},
{
"from": "gpt",
"value": "\nfrom __future__ import print_function, absolute_import\n\nimport gc\nimport weakref\n\nfrom numba import unittest_support as unittest\nfrom numba.utils import IS_PY3\nfrom numba import jit, ty... | python | chosen |
[
{
"from": "human",
"value": "Patch applier. This is useful when you need to revert or switch a branch on a dependent project and need to re-apply\npatches without going through the ./run script's full update/patch cycle for all projects.\n\ngit-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@513 e27351fd-9... | python | chosen |
[
{
"from": "human",
"value": "Add a test file which tests the various decorator functions.\n"
},
{
"from": "gpt",
"value": "\nimport py.test\n\nfrom tiddlyweb.model.policy import UserRequiredError\nfrom tiddlywebplugins.utils import (entitle, do_html, require_role, \n require_any_user)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Make MBSolve inherit from OBSolve\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport sys\n\nfrom numpy import linspace, insert\n\nfrom maxwellbloch import ob_solve\n\nclass MBSolve(ob_solve.OBSolve):\n\n def __init__(self, ob_atom={}, t_min=0.0, t_... | python | chosen |
[
{
"from": "human",
"value": "Create subclass of ImageViewCanvas for pdsspect\n"
},
{
"from": "gpt",
"value": "from ginga.qtw.ImageViewCanvasQt import ImageViewCanvas\n\n\nclass PDSImageViewCanvas(ImageViewCanvas):\n\n def __init__(self):\n super(PDSImageViewCanvas, self).__init__(rende... | python | chosen |
[
{
"from": "system",
"value": "Use midline ellipsis for dir shortening\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport re\nimport socket\n\nfrom powerline.lib.vcs import guess\n\n\ndef hostname():\n\tif not os.environ.get('SSH_CLIENT'):\n\t\treturn None\n\treturn s... | python | chosen |
[
{
"from": "system",
"value": "Handle the situation where in old message the 'username' key does not exists\n\nWith this commit processing an old message with fedmsg_meta will not break\nif that old message does not have the 'username' key.\n"
},
{
"from": "human",
"value": "# This file is part o... | python | chosen |
[
{
"from": "human",
"value": "feat: Add scripts which Define a function that takes an image and a list of templates as inputs then searches the image and returns the a list of bounding boxes for matched templates\n"
},
{
"from": "gpt",
"value": "# Code given by Udacity, complete by Andres Guijarr... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate partition ids.\n\n"
},
{
"from": "gpt",
"value": "import sys\nimport random\n\nif len(sys.argv) != 3:\n print >> sys.stderr, \"USAGE: python generate_partitions.py nodes partitions_per_node\"\n sys.exit()\n\nFORMAT_WIDTH = 10\n\nnodes = i... | python | chosen |
[
{
"from": "human",
"value": "Add wrapper script for UL-CSeq tool\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nBenchExec is a framework for reliable benchmarking.\nThis file is part of BenchExec.\nCopyright (C) 2007-2015 Dirk Beyer\nAll rights reserved.\nLicensed under the Apa... | python | chosen |
[
{
"from": "human",
"value": "Add mngmnt command to delete all cases for a user\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nfrom django.core.management.base import NoArgsCommand, BaseCommand\nfrom couchdbkit import ResourceNotFound\nfrom casexml.apps.case.models import Comm... | python | chosen |
[
{
"from": "human",
"value": "Move importing code into dedicated class\n"
},
{
"from": "gpt",
"value": "from urllib.request import urlopen\r\n\r\nfrom anki.notes import Note\r\nfrom aqt import mw\r\n\r\nfrom bs4 import BeautifulSoup\r\n\r\nfrom ir.util import getInput, setField\r\n\r\n\r\nclass I... | python | chosen |
[
{
"from": "human",
"value": "Add utilities for testing bmi.\n"
},
{
"from": "gpt",
"value": "import os\nimport tempfile\nimport shutil\n\nfrom scripting.contexts import cd\n\nfrom . import Bmi, INPUT_FILE\n\n\ndef setup_func():\n # globals().update(bmi=Bmi())\n # bmi.initialize(INPUT_FILE)... | python | chosen |
[
{
"from": "system",
"value": "Remove find_packages import, it's not in distutils\n"
},
{
"from": "human",
"value": "import os\nfrom distutils.core import setup, find_packages\n\n# Utility function to read the README file.\n# Used for the long_description. It's nice, because now 1) we have a top... | python | chosen |
[
{
"from": "human",
"value": "Write test case for profiler\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport mock\n\nfrom cupy import cuda\n\n\nclass TestProfile(unittest.TestCase):\n\n def test_profile(self):\n start_patch = mock.patch('cupy.cuda.profiler.start')\n stop... | python | chosen |
[
{
"from": "human",
"value": "Add 2 image formats and 1 image type.\n\nAdd 2 image formats 'tar.gz' and 'tar.xz'.\nAdd 1 image type 'docker'.\n\nJIRA: PDC-1341\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrat... | python | chosen |
[
{
"from": "human",
"value": "Add soja find, a easy find files tools.\n"
},
{
"from": "gpt",
"value": "import fnmatch\nimport os\n\n\ndef find_files(path, types):\n \"\"\"\n Find files from path with types\n :param path: Where you will find.\n :param types: Which types you will find.\... | python | chosen |
[
{
"from": "human",
"value": "Configure integration tests for GoDaddy provider\n"
},
{
"from": "gpt",
"value": "# Test for one implementation of the interface\nfrom unittest import TestCase\nfrom lexicon.providers.godaddy import Provider\nfrom integration_tests import IntegrationTests\n\nimport p... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 486. Predict the Winner\n\n486. Predict the Winner: https://leetcode.com/problems/predict-the-winner/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def PredictTheWinner(self, nums):\n \"\"\"\n :type nums: List[int]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to create and single media.json file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport sys, os\nimport argparse\nimport logging\nimport json\nfrom s3stash.nxstash_mediajson im... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to dump all messages on public streams for a realm.\n\n(imported from commit f4f8bfece408b466af4db93b2da15cf69b68e0a3)\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nfrom django.core.management.base import BaseCommand\nfro... | python | chosen |
[
{
"from": "system",
"value": "Use codecs to open the readme\n"
},
{
"from": "human",
"value": "from setuptools import setup\nimport re\nimport upsidedown\n\nVERSION = str(upsidedown.__version__)\n(AUTHOR, EMAIL) = re.match('^(.*?)\\s*<(.*)>$', upsidedown.__author__).groups()\nURL = upsidedown.__... | python | chosen |
[
{
"from": "human",
"value": "testsuite: Add tests for helloworld bot in contrib_bots.\n\nAdd test file 'test_helloworld.py'.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nour_dir... | python | chosen |
[
{
"from": "human",
"value": "Make it a Python package\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='regulations-configs',\n version='0.1.0',\n description='CFPB-specific configuration for the eRegulations parser',... | python | chosen |
[
{
"from": "human",
"value": "Check that bogus return values from write callback are correctly handled (still)\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n\nimport os.path\nimport pycurl\nimport sys\nimport unittest\n\nclass WriteAbortTest(... | python | chosen |
[
{
"from": "human",
"value": "Add basic package management support.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\n\nimport glob, re, subprocess, sys\nfrom distutils.core import setup\n\ndef run_setup():\n try:\n version = subprocess.check_output(['git', 'describe', '--tags'... | python | chosen |
[
{
"from": "human",
"value": "Add web form submit emailer\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozi... | python | chosen |
[
{
"from": "human",
"value": "Add a tiny example workflow to support manual testing\n"
},
{
"from": "gpt",
"value": "from toil.common import Toil\nfrom toil.job import Job\n\nclass HelloWorld(Job):\n def __init__(self, message):\n Job.__init__(self, memory=\"2G\", cores=2, disk=\"3G\")... | python | chosen |
[
{
"from": "human",
"value": "Add unit test file for lesson 3: calculator.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom lessons.lesson_3_calculator import calculator\n\n\nclass AddTestCase(unittest.TestCase):\n def test_add_returns_sum_of_two_numbers(self):\n five = calculat... | python | chosen |
[
{
"from": "human",
"value": "Add CycleOps Fluid2 power calculator"
},
{
"from": "gpt",
"value": "from AbstractPowerCalculator import AbstractPowerCalculator\n\n\n'''\nLinear interpolation. Numpy could be used here,\nbut the app should be kept thin\n'''\ndef interp(x_arr, y_arr, x):\n for i, x... | python | chosen |
[
{
"from": "human",
"value": "Add script for converting genotype matrix to libsequence-friendly FASTA\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"A script to take a genotyping matrix with population assignment and produce\nFASTA files for each population. This was written with K... | python | chosen |
[
{
"from": "human",
"value": "10: Test all scripts on Windows \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/10"
},
{
"from": "gpt",
"value": "######\n# Create Cluster Servers for an additional Node\n#\n# Author: Christoph Stoettner\n# Mail: christoph.stoettner@s... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 337. House Robber III\n\n337. House Robber III: https://leetcode.com/problems/house-robber-iii/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd or it's a left-to-right\n... | python | chosen |
[
{
"from": "human",
"value": "Add categorization behavior adaptor for better widget\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\nfrom collective.z3cform.widgets.token_input_widget import TokenInputFieldWidget\nfrom plone.app.dexterity.behaviors.metadata import ICategorization\nfrom p... | python | chosen |
[
{
"from": "human",
"value": "Add test capturing expectation that entry points will be visible after installing packages.\n"
},
{
"from": "gpt",
"value": "import pytest\nimport pkg_resources\n\nfrom rwt import deps\n\n@pytest.mark.xfail(reason=\"Technique fails to load entry points\")\ndef test_e... | python | chosen |
[
{
"from": "human",
"value": "Add a script to list instances\n\nThis is a quick and dirty script to list out instances from an\nenvironment.\n"
},
{
"from": "gpt",
"value": "import sys\nfrom boto import ec2\n\n\ndef get_instances(conn, environment):\n for reservation in conn.get_all_reservatio... | python | chosen |
[
{
"from": "human",
"value": "Add existing script to benchmark embed\n"
},
{
"from": "gpt",
"value": "import nltk\nimport plac\nimport os\nfrom os import path\nimport io\nimport gzip\nfrom collections import defaultdict\nimport cProfile\nimport pstats\n\nfrom thinc.neural.eeap import Embed\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add example to show how to get a flask context within a task.\n"
},
{
"from": "gpt",
"value": "from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore\nfrom flask import Flask\nfrom flask_apscheduler import APScheduler\nfrom flask_sqlalchemy import SQLAlchemy... | python | chosen |
[
{
"from": "human",
"value": "Test lazy shape as well\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\n\nfrom t3f import initializers\nfrom t3f import shapes\n\n\nclass ShapesTest(tf.test.TestCase):\n\n def testLazyShapeOverflow(self):\n large_shape = [10] * 20\n tensor = initiali... | python | chosen |
[
{
"from": "human",
"value": "Add script for checking csv files\n"
},
{
"from": "gpt",
"value": "import sys\nimport argparse\nimport csv\n\n\ndef examine_log(filename, save_raw=False):\n \"\"\"\n Download job log files from Amazon EC2 machines\n\n parameters:\n filename - beginning da... | python | chosen |
[
{
"from": "human",
"value": "Add FK tests for user affiliations\n\ncc @nmonga91\n"
},
{
"from": "gpt",
"value": "from dataactcore.models.domainModels import CGAC\nfrom dataactcore.models.lookups import PERMISSION_TYPE_DICT\nfrom dataactcore.models.userModel import User, UserAffiliation\nfrom tes... | python | chosen |
[
{
"from": "human",
"value": "Add back create vm on opensteak\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport os\nimport pprint\nimport novaclient.v1_1.client as novaclient\npp = pprint.PrettyPrinter(indent=4)\n\ndef p(value):\n \"\"\"Shortcut for pretty printing\"\"\"\n pp.pprin... | python | chosen |
[
{
"from": "human",
"value": "Add a data migration to iterate over forks and find where the last log is a fork log and set the last_logged date on the node to the date of that log.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2018-10-29 17:01\nfrom __... | python | chosen |
[
{
"from": "human",
"value": "Add tutorial geometries, with plot\n\ngit-svn-id: 30e8e193f18ae0331cc1220771e45549f871ece9@871 b426a367-1105-0410-b9ff-cdf4ab011145\n"
},
{
"from": "gpt",
"value": "\nfrom shapely.geometry import Point, LineString, Polygon\n\npolygon = Polygon(((-1.0, -1.0), (-1.0, 1... | python | chosen |
[
{
"from": "human",
"value": "Implement automatic upload, enabled via AVALON_UPLOAD\n"
},
{
"from": "gpt",
"value": "from pyblish import api\nfrom avalon.api import Session\n\n\nclass UploadAvalonAsset(api.InstancePlugin):\n \"\"\"Write to files and metadata\n\n This plug-in exposes your da... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for write module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Tests for dakota_utils.write.\n#\n# Call with:\n# $ nosetests -sv\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nfrom nose.tools import *\nimport os\nimport tempfile\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add second markov text generator v2 with order parameter\n"
},
{
"from": "gpt",
"value": "#!python3\n\nimport string\nimport random\nimport time\nimport re\nimport sys\n\n\n'''\nThis is an implementation of a markov chain used for text generation.\nJust pass a file n... | python | chosen |
[
{
"from": "human",
"value": "Deploy staged files by using scp\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nfrom subprocess import check_output, call\nimport argparse\n\ndef main():\n args = process_args()\n output = check_output(['git', 'status', '--porcelain', '-uno'])\n filelis... | python | chosen |
[
{
"from": "system",
"value": "Fix Azure to use it's ip-detect script rather than AWS'\n"
},
{
"from": "human",
"value": "import pkg_resources\n\nimport yaml\n\nentry = {\n 'must': {\n 'resolvers': '[\"168.63.129.16\"]',\n 'ip_detect_contents': yaml.dump(pkg_resources.resource_st... | python | chosen |
[
{
"from": "human",
"value": "Add script to copy over project files to a directory tree.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom optparse import OptionParser\nimport rethinkdb as r\nimport sys\nimport shutil\nimport os\nimport errno\n\n\ndef mkdirp(path):\n try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add long description content type.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\n\nimport skosprovider\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\npackages = [\n 'sko... | python | chosen |
[
{
"from": "human",
"value": "test: Add a simple login test case\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom controller import db\nfrom model.user import User\n\nfrom test import C3BottlesTestCase, NAME, PASSWORD\n\n\nclass LoginViewTestCase(C3BottlesTestCase):\n\n def test_login(se... | python | chosen |
[
{
"from": "human",
"value": "Add Reshift class which connect to redshift\n"
},
{
"from": "gpt",
"value": "import psycopg2\nimport pandas as pd\n\ndef create_engine(dbname, user, password, host, port):\n return Redshift.create_engine(dbname, user, password, host, port)\n\nclass Redshift(object... | python | chosen |
[
{
"from": "human",
"value": "Add test for tip.json view.\n"
},
{
"from": "gpt",
"value": "import json\nfrom nose.tools import assert_equal\n\nfrom gittip.testing import TestClient\nfrom gittip import db\n\n\nCREATE_ACCOUNT = \"INSERT INTO participants (id) VALUES (%s);\"\n\n\ndef test_get_amount... | python | chosen |
[
{
"from": "human",
"value": "Add migration for zabbix tables\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\nTABLES = (\n 'monitoring_resourceitem',\n 'monitoring_resourcesla',\n 'monitoring_resourceslastatetransition',\n 'waldur_zabbix_usergroup',\n 'waldur_z... | python | chosen |
[
{
"from": "human",
"value": "Print Hello, World on the first line, and the contents of input on the second line.\n"
},
{
"from": "gpt",
"value": "# Read a full line of input from stdin and save it to our dynamically typed variable, input_string.\ninputString = raw_input()\n\n# Print a string lit... | python | chosen |
[
{
"from": "human",
"value": "DOC: Add simple line chart with markers example\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSimple Line Chart with Markers\n------------------------------\nThis chart shows the most basic line chart with markers, made from a dataframe with two\ncolumns.\n\"\"\"\n# categ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 516. Longest Palindromic Subsequence\n\n516. Longest Palindromic Subsequence: https://leetcode.com/problems/longest-palindromic-subsequence/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def longestPalindromeSubseq(self, s):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to translate riverComponents jsx => js\n"
},
{
"from": "gpt",
"value": "from react import jsx\n\n# For a single file, you can use a shortcut method.\njsx.transform('website/public/js/riverComponents.jsx', js_path='website/public/js/riverComponents.js')\n"
... | python | chosen |
[
{
"from": "human",
"value": "Add Python Class Test Functionality\n\nAdd some refreshers around Python classes.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Topics: Classes, Inheritance, and Related\n#\n# Background: Use of classes, including inheritance, instance variables, e... | python | chosen |
[
{
"from": "human",
"value": "Add test to check if all tests are runnable\n"
},
{
"from": "gpt",
"value": "import glob\nimport os\nimport unittest\n\nfrom chainer import testing\n\n\nclass TestRunnable(unittest.TestCase):\n\n def test_runnable(self):\n cwd = os.path.dirname(__file__)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add random build graph generator\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright 2016 Codethink Ltd.\n# Apache 2.0 license\n\n'''Generate a random build graph in 'node-link' JSON format.'''\n\n\nimport networkx\nimport networkx.readwrite.json_gra... | python | chosen |
[
{
"from": "human",
"value": "Remove field color from allelecolor\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 ('disease', ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for show_weights.py\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for the show_weights.py script\n\"\"\"\nimport cPickle\nimport os\n\nfrom pylearn2.testing.skip import skip_if_no_matplotlib\nfrom pylearn2.models.mlp import MLP, Linear\nfrom pylearn2.s... | python | chosen |
[
{
"from": "human",
"value": "Add tests for KeystoneContextMiddleware and NoAuthMiddleware\n\nChange-Id: I3fa40ae111c48810f1f2c5774925c1460c958163\n"
},
{
"from": "gpt",
"value": "# Copyright 2012 Managed I.T.\n#\n# Author: Kiall Mac Innes <kiall@managedit.ie>\n#\n# Licensed under the Apache Lice... | python | chosen |
[
{
"from": "system",
"value": "Prepare for next development cycle.\n"
},
{
"from": "human",
"value": "from distutils.core import setup\n\nsetup(\n name='udiskie',\n version='0.4.1',\n description='Removable disk automounter for udisks',\n author='Byron Clark',\n author_email='byron... | python | chosen |
[
{
"from": "human",
"value": "Add network api test case"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\nimport unittest\nimport json\nfrom docker import session\nfrom docker import network\n\nfrom docker_test import base_test\n\nclass NetworkTest(unittest.TestCase):\n \n def setUp(self):\n... | python | chosen |
[
{
"from": "system",
"value": "Fix bug with date filtering of offers\n\nOffers with no end date were not being picked up.\n"
},
{
"from": "human",
"value": "from django.utils.timezone import now\n\nfrom django.db import models\n\n\nclass ActiveOfferManager(models.Manager):\n \"\"\"\n For se... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.