conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to plot metrics of dataset"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport os\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n\nparent_dir = os.path.dirname(os.getcwd())\nmodels_dir = os.path.join(p... | python | chosen |
[
{
"from": "human",
"value": "Add a test to assert that transactions are balanced\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2012 The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache License, Version 2.0. See th... | python | chosen |
[
{
"from": "human",
"value": "Add a new file for constants and other utilities to be thrown into.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom snappy import *\nfrom math import log\n\n# Global constants:\nPARI_PRECISION = 100\nLINDEP_PRECISION = 50\nEPSILON = 1e-12\n\n# *** ATTENTIO... | python | chosen |
[
{
"from": "human",
"value": "Make it a python package\n"
},
{
"from": "gpt",
"value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='typesystem',\n version='0.1',\n description=\"An abstract type system\",\n long_description=\"\",\n classifiers=[\n \"Devel... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for our detail value validator(s).\n"
},
{
"from": "gpt",
"value": "import fmn.lib\n\n\nclass MockContext(object):\n def __init__(self, name):\n self.name = name\n\n\nemail = MockContext('email')\nirc = MockContext('irc')\n\n\nclass TestRegex... | python | chosen |
[
{
"from": "human",
"value": "Create DataApp app hook for CMS\n"
},
{
"from": "gpt",
"value": "from cms.app_base import CMSApp\nfrom cms.apphook_pool import apphook_pool\n\n\nclass DataApp(CMSApp):\n name = 'Data App'\n urls = ['cms_lab_data.urls']\n app_name = 'cms_lab_data'\n\napphook_... | python | chosen |
[
{
"from": "human",
"value": "Add migration for monthly data\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAdd _week_start_at field to all documents in all collections\n\"\"\"\nfrom backdrop.core.bucket import utc\nfrom backdrop.core.records import Record\nimport logging\n\nlog = logging.getLogger(__n... | python | chosen |
[
{
"from": "human",
"value": "Add file for testing libcwap from the python side\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport libcwap\n\ndef reader(size):\n print \"Got read\"\n return 'T' * size\n\ndef callback(name):\n def actual_callback(*args, **kwargs):\n p... | python | chosen |
[
{
"from": "human",
"value": "Add some color utility functions.\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*- \n\n# ***************************************************************************\n# Color.py\n# ------------------... | python | chosen |
[
{
"from": "human",
"value": "Add wrapper to allow easy loading of yaml files.\n\nFixes #327.\n\nSigned-off-by: Tim 'mithro' Ansell <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@mith.ro>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport io\nimport re\nimport yaml\nimport json\nimport un... | python | chosen |
[
{
"from": "human",
"value": "Add baseline test for initializing plugin\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright © 2017 Spyder Project Contributors\n# Licensed under the terms of the MIT License\n# (see LICENSE.txt for details)\n\"\"\"Tests for unittestplugin.py\"\... | python | chosen |
[
{
"from": "human",
"value": "Add minimal test for new postgresql.py module\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom mock import MagicMock\n\nimport zmon_aws_agent.postgresql as postgresql\n\n\ndef test_get_databases_from_clusters():\n pgclusters = [\n {\n 'id': '... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for override_config\n\nTest usage of override_config in different forms\nEnsure flexibility between decorator and context manager\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom constance import config\nfrom constance.test imp... | python | chosen |
[
{
"from": "human",
"value": "Add Natural Language API wrapper.\n"
},
{
"from": "gpt",
"value": "import httplib2\ntry:\n import simplejson as json\nexcept:\n import json\n\n\nfrom googleapiclient import discovery\nfrom oauth2client.client import GoogleCredentials\n\n\nOAUTH_SCOPE = ... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for get_calls\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport codecs, json\nfrom PokeFacts import RedditBot\nfrom PokeFacts import DataPulls\n\ndef getDataPullsObject():\n store = DataPulls.ItemStore({'term_property': 'term'})\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Tests: Add tests for Result object\n"
},
{
"from": "gpt",
"value": "import unittest\nimport librepo\nfrom librepo import LibrepoException\n\nclass TestCaseResult(unittest.TestCase):\n\n def test_result_getinfo(self):\n r = librepo.Result()\n self.ass... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test case for LawrenceTransitProvider\n"
},
{
"from": "gpt",
"value": "import busbus\nfrom busbus.provider.lawrenceks import LawrenceTransitProvider\n\nimport arrow\nimport pytest\n\n\n@pytest.fixture(scope='module')\ndef lawrenceks_provider():\n retu... | python | chosen |
[
{
"from": "human",
"value": "Add tests for vat utils functions\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function\n\nimport unittest\n\nimport numpy as np\n\nfrom cleverhans.utils_tf import kl_with_logits, l2_batch_normalize\n\n\ndef numpy_kl_with_l... | python | chosen |
[
{
"from": "human",
"value": "Add crop multi roi alternative script\n"
},
{
"from": "gpt",
"value": "# @DatasetService datasetservice\n# @ImageDisplayService displayservice\n# @ImageJ ij\n# @AbstractLogService log\n# @DefaultLegacyService legacyservice\n\nfrom ij import IJ\nfrom ij import Macro\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to download wheels from appveyor\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport asyncio\nimport json\nimport pathlib\nimport sys\nfrom tornado.httpclient import AsyncHTTPClient\n\nBASE_URL = \"https://ci.appveyor.com/api\"\n\n\nasync def... | python | chosen |
[
{
"from": "human",
"value": "Add command to print the syntax tree for a script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights least factorial problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Least Factorial (Core) Problem\n\n\ndef leastFactorial(n):\n def factGen():\n m, res = 1, 1\n while True:\n res *= m\n ... | python | chosen |
[
{
"from": "human",
"value": "Create test cases for the wifi_password_getter plugin\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom tests import PluginTest\nfrom plugins import wifi_password_getter\nfrom colorama import Fore\n\n\nclass TestWifiPasswordGetter(PluginTest):\n \"\"\"\n A... | python | chosen |
[
{
"from": "human",
"value": "Add script to print time of most recent gobble."
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom optparse import OptionParser\nfrom urllib2 import urlopen\n\nfrom BeautifulSoup import BeautifulSoup\n\n\nif __name__ == '__main__':\n usage = \"%pro... | python | chosen |
[
{
"from": "human",
"value": "Add script to get count of objects in a collection.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n\nimport sys, os\nimport argparse\nfrom deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo\n\ndef main(argv=None):\n\n parser = a... | python | chosen |
[
{
"from": "human",
"value": "Add command line tool to import metadata\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\nimport csv\n\nfrom django.core.management.base import BaseCommand\n\nfrom emgapimetadata import models as m_models\n\n\nclass Command(Ba... | python | chosen |
[
{
"from": "human",
"value": "Create script to log imu values\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom sense_hat import SenseHat\nfrom pymongo import MongoClient\nimport time\n\n\nDELAY = 1 # in seconds\n\nsense = SenseHat()\nclient = MongoClient(\"mongodb://192.168.0.128... | python | chosen |
[
{
"from": "human",
"value": "Add a demo script for gym continous tasks\n"
},
{
"from": "gpt",
"value": "import argparse\n\nimport chainer\nfrom chainer import serializers\nimport gym\nimport numpy as np\n\nimport random_seed\nfrom train_a3c_continuous import phi, A3CLSTMGaussian\nimport env_modi... | python | chosen |
[
{
"from": "human",
"value": "Test for objs with strs rather than unicode\n"
},
{
"from": "gpt",
"value": "def has_str(obj):\n if type(obj) == str:\n return True\n # Check for an iterable\n if hasattr(obj, '__iter__'):\n for item in obj:\n item_has_str = has_str(... | python | chosen |
[
{
"from": "human",
"value": "Add initial settings test file\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom isort import exceptions\nfrom isort.settings import Config\n\n\nclass TestConfig:\n def test_init(self):\n assert Config()\n\n def test_invalid_pyversion(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use wraps decorator for requires_nltk_corpus\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''Custom decorators.'''\n\nfrom __future__ import absolute_import\nfrom textblob.exceptions import MissingCorpusException\n\n\nclass cached_property(object):\n ... | python | chosen |
[
{
"from": "human",
"value": "Test case for the failure to compile code including unicode characters.\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\"\"\"These tests have to be run separately from the main test suite (iptest),\nbecause that sets the default encoding to utf-8, and it cannot be... | python | chosen |
[
{
"from": "system",
"value": "Enforce better security in sample ReST renderer.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\ntry:\n from docutils.core import publish_parts\n def render_rest(markup, **docutils_settings):\n parts = publish_parts(source=... | python | chosen |
[
{
"from": "human",
"value": "Add the dataset for online products dataset\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Feb 14 17:30:49 2017\n\n@author: sakurai\n\"\"\"\n\nfrom fuel.datasets import H5PYDataset\nfrom fuel.utils import find_in_data_path\nfrom fuel... | python | chosen |
[
{
"from": "human",
"value": "ADD attributeExploration algorithm wrapped in a class\n"
},
{
"from": "gpt",
"value": "#-------------------------------------------------------------------------------\n# Name: AttributeExploration.py\n# Purpose: class for attribute exploration\n#\n# Autho... | python | chosen |
[
{
"from": "human",
"value": "Add test for inheritance case.\n"
},
{
"from": "gpt",
"value": "import sqlalchemy as sa\nfrom sqlalchemy_continuum import version_class\nfrom tests import TestCase\n\n\nclass TestCommonBaseClass(TestCase):\n def create_models(self):\n class BaseModel(self.M... | python | chosen |
[
{
"from": "human",
"value": "Add FMI weather table timestamp fixing script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"This is a script for fixing odd weather timestamp values in the database. Sometimes\nthe timestamp is off by many hours from the previous and this script fi... | python | chosen |
[
{
"from": "human",
"value": "Add script to detect changed options.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# file: changed_options.py\n# vim:fileencoding=utf-8:fdm=marker:ft=python\n#\n# Author: R.F. Smith <rsmith@xs4all.nl>\n# Created: 2018-03-26 20:53:13 +0200\n# Last modified... | python | chosen |
[
{
"from": "human",
"value": "Add script to transform ExtensionTemplate legilation\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n''' xml_to_json_extension_template.py : Parse XML parameter files for Extension-Template and convert them to YAML files. Comments are NOT transformed.\n\n... | python | chosen |
[
{
"from": "human",
"value": "Clear all NLCD19 2019 TR-55 results\n\nSince we're switching TR-55 projects back to NLCD11 2011,\nthis migration clears the results for all TR-55 projects\nmade since 1.33.0, which switched the default to NLCD19 2019.\nThese results will be recalculated with NLCD11 2011 whenever... | python | chosen |
[
{
"from": "human",
"value": "Add tool to generate .manhole files.\n\nThis is cleaner than creating them one by one.\n\nR=cmp@chromium.org\nBUG=\nTEST=\n\n\nReview URL: http://codereview.chromium.org/8347006\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@106120 0039d316-1c4b-4281-b951-d872f2087c98\n... | python | chosen |
[
{
"from": "human",
"value": "Add utility function for retrieving get parameters\n"
},
{
"from": "gpt",
"value": "\"\"\"Module for retrieving a GET request query parameter.\"\"\"\n\nfrom django.http import Http404\n\n\ndef retrieve_query_parameter(request, parameter, valid_options=None):\n \"\... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 423. Reconstruct Original Digits from English\n\n423. Reconstruct Original Digits from English: https://leetcode.com/problems/reconstruct-original-digits-from-english/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solutio... | python | chosen |
[
{
"from": "human",
"value": "Add a small script for rapidly verifyinh IGV screenshots\n"
},
{
"from": "gpt",
"value": "import os\nimport click\nimport cv2\nfrom AppKit import NSScreen\n\n\ndef check_image(filename, height):\n image = cv2.imread(filename)\n image_name = os.path.basename(fil... | python | chosen |
[
{
"from": "system",
"value": "Use a thread lock to patch contexts.\n\nThis fixes #3185\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom sentry.utils.imports import import_string\n\n\nclass PatchContext(object):\n def __init__(self, target, callback):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove stale i18n strings\n"
},
{
"from": "gpt",
"value": "import re\nimport json\nimport glob\nfrom collections import OrderedDict\n\nlocale_folder = \"../locales/\"\nlocale_files = glob.glob(locale_folder + \"*.json\")\nlocale_files = [filename.split(... | python | chosen |
[
{
"from": "human",
"value": "Add a script showing usage in examples\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport string\nfrom dynmen import Menu\nrofi = Menu(command=('rofi', '-fullscreen', '-dmenu', '-i'))\n\nd_string = vars(string)\nd_string = {k:v for k,v in d_string.items()... | python | chosen |
[
{
"from": "human",
"value": "Add tests for current arg parsing."
},
{
"from": "gpt",
"value": "from argparse import Namespace\nfrom unittest import TestCase\n\nfrom azure_publish_tools import (\n DELETE,\n get_option_parser,\n LIST,\n PUBLISH,\n )\n\nclass TestOptionParser(TestCas... | python | chosen |
[
{
"from": "human",
"value": "Make migrations for changes to models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.utils.timezone import utc\nimport django.core.validators\nimport datetime\... | python | chosen |
[
{
"from": "human",
"value": "Add test for event type parser\n"
},
{
"from": "gpt",
"value": "import unittest2\n\nfrom models.event import Event\nfrom helpers.event_helper import EventHelper\n\nclass TestUsfirstEventTypeParser(unittest2.TestCase):\n def test_parse(self):\n self.assertEq... | python | chosen |
[
{
"from": "human",
"value": "Add script to configure omerok8s for public_group and public_user\n"
},
{
"from": "gpt",
"value": "\"\"\"Configure Omero on a k8s server for the way it is used in IMPC\n\n\"\"\"\nimport sys\nimport argparse\n\nimport omero.cli # For some reason if I do not do this ne... | python | chosen |
[
{
"from": "human",
"value": "Implement an example of the modified SerialIterator\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Jan 21 21:16:43 2017\n\n@author: ryuhei\n\"\"\"\n\nimport numpy as np\n\nfrom chainer.datasets import TupleDataset\nfrom sklearn.prepr... | python | chosen |
[
{
"from": "human",
"value": "Migrate dask array odo backend from dask.\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function\n\nimport numpy as np\nfrom datashape import discover\nfrom toolz import merge, accumulate\nfrom datashape.dispatch import disp... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights range bit count problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Range Bit Count (Core) Problem\n\n\ndef rangeBitCount(a, b):\n return (''.join([bin(n) for n in range(a, b + 1)])).count('1')\n\n\ndef main():\n te... | python | chosen |
[
{
"from": "human",
"value": "Add example using callbacks/IRQs for easier debug\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nLog radiation hits or noise signals to the console.\n\nReleased under MIT License. See LICENSE file.\n\nBy Yoan Tournade <y@yoan... | python | chosen |
[
{
"from": "human",
"value": "Add script to view URL in HTMLViewer\n\nThis script takes advantage of the fact that Mojo binaries are published in the\ncloud to add functionality for viewing a URL in HTMLViewer embedded in the\nkiosk window manager.\n\nReview URL: https://codereview.chromium.org/982523004\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for name injection\n\nSince the name injection facility could taint the entire global\nnamespace of the module, its test is put into a separate module.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test for the name inject utility.\"\"\"\n\nfrom drudge import Drud... | python | chosen |
[
{
"from": "human",
"value": "Add tests for epsilon greedy explorers\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_library\nstand... | python | chosen |
[
{
"from": "human",
"value": "Print the logs for a certain date\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n#\n# cat_logs.py\n#\n# Print out the logs for a certain date\n#\n# Usage: cat_logs.py <factory> YY/MM/DD [hh:mm:ss]\n#\n\nimport sys,os,os.path,time\nsys.path.append(\"lib\")\nsys.p... | python | chosen |
[
{
"from": "human",
"value": "Add more tests for mkdir.\n"
},
{
"from": "gpt",
"value": "from __future__ import with_statement\n\nfrom nose.tools import (\n eq_ as eq,\n )\n\nfrom fs.test.util import (\n maketemp,\n assert_raises,\n )\n\nimport errno\nimport os\n\nimport fs\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Create a form for the JobTemplate\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Layout, Div\n\n\nclass JobTemplateForm(forms.Form):\n name = forms.CharField(max_length=400)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add management command to update custom recipient type\n"
},
{
"from": "gpt",
"value": "from django.core.management import BaseCommand\nfrom corehq.messaging.scheduling.scheduling_partitioned.models import (\n CaseTimedScheduleInstance,\n TimedScheduleInstance,... | python | chosen |
[
{
"from": "human",
"value": "Add first training data generator.\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport json\nimport numpy as np\n\nMAX_ACTIONS = 20\nPLAYER_RANGE = (4, 7)\n\ndef init_vec(num_players):\n input_vec = [0]*8\n input_vec[num_players - PLAYER_RANGE[0]] = ... | python | chosen |
[
{
"from": "human",
"value": "Add custom implementation from stack overflow.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\nshows = []\n\nfor line in sys.stdin:\n line = line.strip()\n key_value = line.split(',')\n\n if key_value[1] == 'ABC':\n if key_v... | python | chosen |
[
{
"from": "human",
"value": "Create Tool-info module for LibKluzzer"
},
{
"from": "gpt",
"value": "\"\"\"\nBenchExec is a framework for reliable benchmarking.\nThis file is part of BenchExec.\n\nCopyright (C) 2007-2019 Dirk Beyer\nAll rights reserved.\n\nLicensed under the Apache License, Versi... | python | chosen |
[
{
"from": "human",
"value": "Add example for repeatable url fetcher implemented on top of streams\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport aiohttp\n\n\ndef fetch_url(client, url):\n resp = yield from client.get(url)\n try:\n text = yield from resp.text()\n retu... | python | chosen |
[
{
"from": "human",
"value": "Test of shared variables. Used in UNITY operations.\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nsys.path.append(os.path.abspath(\"../helper_functions\"))\nsys.path.append(os.path.abspath(\"../core\"))\nsys.path.append(os.path.abspath(\"../agent_types\"))\... | python | chosen |
[
{
"from": "human",
"value": "Add test for cuda.cusolver_enabled flag\n"
},
{
"from": "gpt",
"value": "import unittest\r\n\r\nfrom cupy import cuda\r\n\r\n\r\nclass TestCusolver(unittest.TestCase):\r\n\r\n def test_cusolver_enabled(self):\r\n self.assertEqual(cuda.runtime.runtimeGetVers... | python | chosen |
[
{
"from": "human",
"value": "Add test for generic parametrization\n"
},
{
"from": "gpt",
"value": "from tests.mapper import get_symbols, SOURCE_PAIR, SOURCE_FULL\nfrom thinglang.lexer.values.identifier import Identifier\nfrom thinglang.symbols.symbol import Symbol\n\n\ndef test_simple_parameteri... | python | chosen |
[
{
"from": "human",
"value": "Add webhook column to project.\n"
},
{
"from": "gpt",
"value": "\"\"\"add webhook column\n\nRevision ID: 188c85878d36\nRevises: a9ecd1c767\nCreate Date: 2014-11-06 11:06:28.337421\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '188c85878d36'\ndown_... | python | chosen |
[
{
"from": "human",
"value": "Add solution for Problem 62.\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\n'''\nProblem 62\n30 January 2004\n\nThe cube, 41063625 (345^(3)), can be permuted to produce two other cubes: 56623104 (384^(3)) and 66430125 (405^(3)). In fact, 41063625 is the smallest ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 593. Valid Square\n\n593. Valid Square: https://leetcode.com/problems/valid-square/\n"
},
{
"from": "gpt",
"value": "from operator import itemgetter\nclass Solution(object):\n def validSquare(self, p1, p2, p3, p4):\n \"\"\"\n :typ... | python | chosen |
[
{
"from": "human",
"value": "Add an example script to illustrate how to use the API library.\n"
},
{
"from": "gpt",
"value": "# ATCA Rapid Response Service\n# Jamie.Stevens@csiro.au\n\n# example1.py\n# This example script shows how to make a schedule and request time for it from\n# the web servi... | python | chosen |
[
{
"from": "human",
"value": "Add script to print all text in folia xml file\n\nExtract text in acts from folia xml files. Processes all folia xml files\nin the input directory and put output texts in the output directory.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-... | python | chosen |
[
{
"from": "human",
"value": "Add tests for no formatting cases\n"
},
{
"from": "gpt",
"value": "import pytest\n\nimport wee_slack\n\n\n@pytest.mark.parametrize(\"text\", [\n \"\"\"\n * an item\n * another item\n \"\"\",\n \"* Run this command: `find . -name '*.exe'`\",\n])\ndef te... | python | chosen |
[
{
"from": "human",
"value": "Create Combination like 001 for Leetcode\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def combine(self, n, k):\n \"\"\"\n :type n: int\n :type k: int\n :rtype: List[List[int]]\n \"\"\"\n if n < 1:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add mgmt cmd to generate anonymized ID mapping\n\nSo that instructors have easy access to the mapping from anonymized\nIDs (a simple MD5 hash of the user ID that's used when integrating\nwith third-party services like Qualtrics) to user IDs, we have a\nsimple Django management c... | python | chosen |
[
{
"from": "human",
"value": "Add bamova phi plotting script\n"
},
{
"from": "gpt",
"value": "import sys\n\nimport numpy as np\nfrom sklearn.neighbors.kde import KernelDensity\nimport matplotlib\nfrom matplotlib import pyplot\n\ndef estimate_distribution(matrix, locus, h=0.2, n_points=100):\n\tkd... | python | chosen |
[
{
"from": "human",
"value": ":sparkles: Add migration for python debug SQL functions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\\\n- Add SQL function `pypath`\n- Add SQL function `pyimport`\n\n\"\"\"\n\ndef up(cursor):\n # Add SQL function `pypath`\n cursor.execute(\"... | python | chosen |
[
{
"from": "human",
"value": "Add script to parse the results\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# coding: utf-8\n\nimport fileinput\nimport sys\n\nbuffer_size = 0\nthreshold = 0\nelapsed_time = 0.0\n\nfor line in fileinput.input():\n l = line.split()\n if l:\n if l[... | python | chosen |
[
{
"from": "human",
"value": "Add driving component as an example\n"
},
{
"from": "gpt",
"value": "'''\t\n\tDriving component\n'''\n\nclass Drive(object):\n\n\tdef __init__(self, robotDrive):\n\t\tself.robotDrive = robotDrive\n\n\t#\n\t# Verb functions\n\t#\n\n\tdef move(self, x, y, z):\n\t\tself... | python | chosen |
[
{
"from": "human",
"value": "gpu: Add WebGL robustness telemetry test\n\nThis patch adds a telemetry-based WebGL robustness test. It executes an\noptional test from the WebGL conformance test suite to trigger a GPU\ncontext loss and verifies this doesn't crash the browser.\n\nTo run the test for example on ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for modified RegexValidator\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport project.teams.models\nimport django.core.validators\n\n\nclass Migration(mi... | python | chosen |
[
{
"from": "human",
"value": "Add the ability to do basic testing locally\n"
},
{
"from": "gpt",
"value": "import BaseHTTPServer\nimport sys\nimport time\nimport json\nfrom irc_hooky.github.main import handler as gh_handler\n\n\nHOST_NAME = sys.argv[1]\nPORT_NUMBER = int(sys.argv[2])\n\n\ndef han... | python | chosen |
[
{
"from": "human",
"value": "Add filter program to remove small polygons\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Polyfilter - filters polygon files for very small polygons\n\nimport sys\n\nf = open(sys.argv[1])\n\ndef PolygonArea(corners):\n n = len(corners) # of corners\n ... | python | chosen |
[
{
"from": "human",
"value": "Add problem 33, digit cancelling fractions\n"
},
{
"from": "gpt",
"value": "from time import time\nimport fractions\n\n\ndef digit_cancel():\n digit_cancelling_fractions = []\n for numerator in range(10, 100):\n for denominator in range(numerator+1, 100)... | python | chosen |
[
{
"from": "human",
"value": "Add script for network CIA installation using FBI\n"
},
{
"from": "gpt",
"value": "import os, socket, sys, struct, getopt\n\ndef sendfile(filename, ip):\n\tstatinfo = os.stat(filename)\n\tfbiinfo = struct.pack('!q', statinfo.st_size)\n\twith open(filename, 'rb') as f... | python | chosen |
[
{
"from": "human",
"value": "Add script to fix plugins with vim.org ID duplicates\n\nSummary:\nIf you look at vimawesome.com/?p=3 right now, you will see many duplicated\n\"taglist.vim\" plugins.\n\nA long time ago, when we scraped a github repo whose homepage was a vim.org\nplugin, we would assume that was... | python | chosen |
[
{
"from": "human",
"value": "Add first monitoring state - experimental\n"
},
{
"from": "gpt",
"value": "'''\nDisk monitoring state\n\nMonitor the state of disk resources\n'''\n\ndef status(name, max=None, min=None):\n '''\n Return the current disk usage stats for the named device\n '''\... | python | chosen |
[
{
"from": "human",
"value": "Add naive code for generating and rendering casual model and state graph visualization\n"
},
{
"from": "gpt",
"value": "from graphviz import Digraph\n#Add the path of graphviz to render the graph\nimport os\nos.environ[\"PATH\"] += os.pathsep + 'C:/Program Files/grap... | python | chosen |
[
{
"from": "human",
"value": "Add the answer to the fifth question of Assignment 3\n"
},
{
"from": "gpt",
"value": "\"\"\" Q5- Define a function isVowel(char) that returns True if char is a vowel ('a', 'e', 'i', 'o', or 'u'), and False\notherwise. You can assume that char is a single letter of an... | python | chosen |
[
{
"from": "human",
"value": "Update migrations to match current model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.4 on 2017-08-20 01:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport main.models\n\n\nclass Mig... | python | chosen |
[
{
"from": "human",
"value": "Add script to calculate activity frequencies\n"
},
{
"from": "gpt",
"value": "from parliament.models import *\n\ntypes = MemberActivityType.objects.all()\nst_count = 0\nstart_date = '2014-02-06'\nstart_date = '2011-04-20'\nfor t in types:\n act_qs = MemberActivity... | python | chosen |
[
{
"from": "human",
"value": "Add bathy download script for Gulf\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Simple implementation of a file fetcher\"\"\"\n\nimport sys\nimport os\nimport urllib\nimport subprocess\n\ndef get_bathy(url, destination=os.getcwd(), force=False):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add letter logo for environment agency\n\nDepends on:\nhttps://github.com/alphagov/notifications-template-preview/pull/87\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0160_another_letter_org\nRevises: 0159_add_historical_redact\nCreate Date: 2... | python | chosen |
[
{
"from": "human",
"value": "Test response oject for dict into dict into dict\n"
},
{
"from": "gpt",
"value": "from nose.tools import eq_\n\nfrom buffer.response import ResponseObject\n\ndef test_reponse_check_for_inception():\n '''\n Given a dict with a dict, it should convert all the dicts... | python | chosen |
[
{
"from": "human",
"value": "Add db model for TestMessage database\n\nSummary:\nAdds a model for the testmessage table and support for getting the\nmessage\n\nDepends on D206477\nDepends on D206407\n\nReviewers: anupc, paulruan\n\nReviewed By: paulruan\n\nSubscribers: changesbot, kylec\n\nDifferential Revis... | python | chosen |
[
{
"from": "human",
"value": "Add migration for native postgres JSON type\n"
},
{
"from": "gpt",
"value": "\"\"\"Use native postgres JSON type for Entry.content\n\nRevision ID: 588336e02ca\nRevises: 2b7f5e38dd73\nCreate Date: 2014-01-09 22:40:07.690000\n\n\"\"\"\n\n# revision identifiers, used by... | python | chosen |
[
{
"from": "human",
"value": "Add (currently empty) test placeholder.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright 2020 Google 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... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 170\n"
},
{
"from": "gpt",
"value": "# Definition for singly-linked list.\n# class ListNode:\n# def __init__(self, x):\n# self.val = x\n# self.next = None\n\nclass Solution:\n # @param head: the list\n # @pa... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.