conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a test file for Lotka-Volterra simulation.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nfrom nose.tools import assert_equal, assert_almost_equal, assert_true\nfrom numpy.testing import assert_array_equal\nimport os\nimport tables\nimport numpy as np... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the LineReader class\n"
},
{
"from": "gpt",
"value": "import glob\nfrom mrs.fileformats import LineReader\nimport sys\n\ntry:\n from cStringIO import StringIO as BytesIO\nexcept ImportError:\n from io import BytesIO\n\nPY3 = sys.version_info[... | python | chosen |
[
{
"from": "human",
"value": "Add an example test with visual testing asserts\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nu\"\"\"\nCopyright 2015 Telefónica Investigación y Desarrollo, S.A.U.\nThis file is part of Toolium.\n\nLicensed under the Apache License, Version 2.0 (the \"Lic... | python | chosen |
[
{
"from": "human",
"value": "Add import file from Ruben\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue May 10 11:33:13 2016\n@author: ruben\n\"\"\"\n\nfrom gwtsa.imports.dinodata import DinoGrondwaterstand\nfrom gwtsa.imports.knmidata import KnmiStation\nfrom py... | python | chosen |
[
{
"from": "human",
"value": "Test for opening same file multiple times\n"
},
{
"from": "gpt",
"value": "import nose\nimport angr\nimport os\n\nimport logging\nl = logging.getLogger(\"angr_tests\")\n\ntest_location = str(os.path.dirname(os.path.realpath(__file__)))\n\ndef run_test_file_struct_fun... | python | chosen |
[
{
"from": "human",
"value": "Add a test for Client.clone().\n"
},
{
"from": "gpt",
"value": "\"\"\"Test :meth:`icat.client.Client.clone`.\n\"\"\"\n\nfrom __future__ import print_function\nimport pytest\nimport icat\nimport icat.config\nfrom conftest import getConfig\n\n\ndef test_clone_minimal(s... | python | chosen |
[
{
"from": "human",
"value": "Add tests for '/' and '/status'\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n# Copyright (c) 2001-2019, Canal TP and/or its affiliates. All rights reserved.\n#\n# This file is part of Navitia,\n# the software to build cool stuff with public transport.\n#\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add implementation of RANSAC algorithm\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\n\ndef ransac(X, y, estimator_cls, min_samples, residual_threshold,\n is_data_valid=None, is_model_valid=None, max_trials=100,\n stop_n_inliers=np.inf, st... | python | chosen |
[
{
"from": "human",
"value": "Add catapult_base folder to tools/telemetry to make the refactor easier.\n\nThis will make some of the refactoring more obvious and easy to review, as\nwell as making the needed reafctoring after moving to the catapult repo easier.\n\nBUG=473414\n\nReview URL: https://codereview... | python | chosen |
[
{
"from": "human",
"value": "Add products for product feed task\n"
},
{
"from": "gpt",
"value": "products = [\n 'AN4EF3',\n 'AE93CR',\n 'A9Q4MK',\n 'AC97HP',\n 'AK967J',\n 'AB2S93',\n 'AB2JT9',\n 'AN67HP',\n 'AK54VQ',\n 'AD53ZH']\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights find email domain problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Find Email Domain Problem\n\n\ndef findEmailDomain(address):\n index = max([i for i, char in enumerate(address) if char == \"@\"])\n return addre... | python | chosen |
[
{
"from": "human",
"value": "Add script to migrate donors to premium\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom datetime import date, timedelta\n\nfrom paypal.standard.ipn import models\nfrom subscription.models import Subscription, UserSubscript... | python | chosen |
[
{
"from": "human",
"value": "Add interactive version of crop script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport click\nfrom PIL import Image\nfrom utils import get_file_list\n\n\n@click.command()\n@click.argument('path', type=click.Path(exists=True))... | python | chosen |
[
{
"from": "human",
"value": "Add a HBase metrics collector.\n\nThis change adds a basic hbase metrics collector that works in the same\nway that the hadoop collector does.\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\n\"\"\"\nDiamond collector for HBase metrics, see:\n\"\"\"\n\nfrom diamond... | python | chosen |
[
{
"from": "human",
"value": "Create basic structure for test data benchmark module\n"
},
{
"from": "gpt",
"value": "import os\nimport urllib.request\n'''\nChecks to see whether the data is present.\nTo be used to check whether to download OR not.\nInsert the name in the following format\n'os.pat... | python | chosen |
[
{
"from": "human",
"value": "Add script to create a \"quick projects\" directory, for fast access without having to dig into repo structure\n"
},
{
"from": "gpt",
"value": "import os\nrootdir = '/Users/work/development/repositories/pet-projects'\n\nlanguageDirectories = next(os.walk(rootdir))[1]... | python | chosen |
[
{
"from": "human",
"value": "Add tool as per request\n\n"
},
{
"from": "gpt",
"value": "#!/mesonet/python/bin/python\n# Generate a shapefile of the WOU outline.\n# 28 Aug 2004 port to iem40\n\nimport shapelib, dbflib, mx.DateTime, zipfile, os, sys, shutil, cgi\nfrom pyIEM import wellknowntext, i... | python | chosen |
[
{
"from": "human",
"value": "Add some simple unit tests.\n"
},
{
"from": "gpt",
"value": "from pyudl.tds import TDSCatalog\n\n\nclass TestCatalog(object):\n baseURL = 'http://thredds-test.unidata.ucar.edu/thredds/'\n\n def test_basic(self):\n url = baseURL + 'catalog.xml'\n c... | python | chosen |
[
{
"from": "human",
"value": "Add python script to generate MIDI note -> frequency tables\n"
},
{
"from": "gpt",
"value": "def midi_to_freq(note):\n return (2**((note-69)/12)) * 440\n\n\nprint(\"const uint16_t notemappings[] PROGMEM = {\")\nprint(\", \".join([str(round(midi_to_freq(note))) for... | python | chosen |
[
{
"from": "human",
"value": "Add module for Terminal tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\""
}
] | python | chosen |
[
{
"from": "human",
"value": "nrf/modules/scripts: Add file system formatting script.\n\nAdd a helper script _mkfs.py which automatically formats the file system if\nnrf.Flash() is located and a VFS file system has been included in the\ncompilation.\n\nThe precedence is: first LFS1, LFS2 then FAT.\n"
},
... | python | chosen |
[
{
"from": "human",
"value": "Test for exceptions on process_spider_input\n"
},
{
"from": "gpt",
"value": "\nimport logging\n\nfrom testfixtures import LogCapture\nfrom twisted.trial.unittest import TestCase\nfrom twisted.internet import defer\n\nfrom scrapy import Spider, Request\nfrom scrapy.ut... | python | chosen |
[
{
"from": "human",
"value": "Add docker client options to argparse\n\nAll docker-py client options are handled through argparse, except the\nssl options.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport atexit\nimport logging\n\nDEFAULT_DOCKER_BASE_URL = 'unix://... | python | chosen |
[
{
"from": "human",
"value": "Add iTunes script for making year playlists\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom collections import defaultdict\nfrom dateutil.parser import parse\nfrom pathlib import Path\nimport xml.etree.ElementTree as ET\n\nLIBRARY = Path.home() / \"Mu... | python | chosen |
[
{
"from": "human",
"value": "Add migration to set share_title for PreprintProviders on prod\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.1 on 2017-08-03 15:07\n\"\"\"Sets the share_title field on production PreprintProviders. Makes no\nupdates if the liste... | python | chosen |
[
{
"from": "human",
"value": "Add tool to detect multiple use of a negative unit\n\nThe script tools/detect_multiple_usage.py automatically parses\n'do_sort_neg.txt' and checks whether the same reference channel\noccurs more than once.\n"
},
{
"from": "gpt",
"value": "# JN 2016-04-08\n\n\"\"\"\nF... | python | chosen |
[
{
"from": "human",
"value": "Add news app user behavior simulator\n"
},
{
"from": "gpt",
"value": "import random\nimport gevent\n\nfrom locust import HttpLocust, TaskSet, task\n\n\nHTTP_USER = \"test\"\nHTTP_PASSWORD = \"1\"\n\nclass NewsAppApi(TaskSet):\n def get_news(self):\n self.cl... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 187\n"
},
{
"from": "gpt",
"value": "class Solution:\n # @param gas, a list of integers\n # @param cost, a list of integers\n # @return an integer\n def canCompleteCircuit(self, gas, cost):\n # write your code here... | python | chosen |
[
{
"from": "human",
"value": "Add demo w/ context manager and lifetime\n"
},
{
"from": "gpt",
"value": "import judicious\n\njudicious.seed(\"cc722bf6-e319-cf63-a671-cbae64bfdb0f\")\n\n# 1 (complete): 3799aa89-ccae-c268-d0e8-cc4e9ddddee4\n# 2 (timeout) : 4d30601d-dfe3-ee53-8594-7fc0aa8e68ec\n# 3 (... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for the previous commit\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2017-05-04 00:04\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migra... | python | chosen |
[
{
"from": "human",
"value": "Add an example test to run\n"
},
{
"from": "gpt",
"value": "from seleniumbase import BaseCase\n\n\nclass MyTestClass(BaseCase):\n\n def test_basic(self):\n self.open(\"http://xkcd.com/353/\")\n self.wait_for_element(\"div#comic\")\n self.click... | python | chosen |
[
{
"from": "human",
"value": "Add migration for SearchQuery meta options\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('ela... | python | chosen |
[
{
"from": "human",
"value": "Add an importer for the dataset from OurAirports, usable instead of the FAA’s data."
},
{
"from": "gpt",
"value": "import csv\nimport os\nfrom decimal import Decimal\n\nfrom django.contrib.gis.geos import Point\nfrom django.core.cache import cache\nfrom django.core.m... | python | chosen |
[
{
"from": "human",
"value": "Add test for classes in analytics_enums module.\n\nIncludes tests for classes that convert dictionaries into attributed classes.\n"
},
{
"from": "gpt",
"value": "# Copyright 2014 Google Inc. All Rights Reserved.\n\nimport unittest\n\nfrom analytics_enums import Bigqu... | python | chosen |
[
{
"from": "human",
"value": "Add a WSGI application file\n"
},
{
"from": "gpt",
"value": "import os\n\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"config\")\nos.environ.setdefault(\"DJANGO_CONFIGURATION\", \"Local\")\n\nfrom configurations.wsgi import get_wsgi_application\n\napplicatio... | python | chosen |
[
{
"from": "human",
"value": "Add simple TSV reader for HUWiki corpus\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport csv\n\n\nclass TSVOpener:\n def __init__(self, opt={}):\n self.name = opt.get('name')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add dedupe district slug management command\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.db.models import Count\n\nfrom scuole.districts.models import District\n\n\nclass Command(BaseCommand):\n help = \"Dedupe ... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to validate ecs library dependencies.\n\nThe embedded content_shell starting point for applications such as the\nChromeCast shell must not include dependencies that would increase its\nmemory footprint. This script automatically tests that it does not contain\nundesir... | python | chosen |
[
{
"from": "human",
"value": "Add utility to batch convert tiff files.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom PIL import Image\nimport rethinkdb as r\nfrom optparse import OptionParser\nimport sys\nimport os\nimport errno\n\n\ndef datafile_dir(mcdir, datafile_id):\n piece... | python | chosen |
[
{
"from": "human",
"value": "Add example that compares two files with every metric\n"
},
{
"from": "gpt",
"value": "from skvideo.io import VideoCapture\nfrom skvideo.metrics import ssim, psnr, vifp\nimport sys\nimport json\n\nfilename1, filename2 = sys.argv[1], sys.argv[2]\n\ncap1 = VideoCapture... | python | chosen |
[
{
"from": "human",
"value": "Add download all year to higher education.\n"
},
{
"from": "gpt",
"value": "import os\nimport commands\nimport time\nimport logging\nimport sys\n\nif len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):\n print \"ERROR! Use:\\n python scripts/data_download... | python | chosen |
[
{
"from": "human",
"value": "Add helper functions to upgrade production instances to Eucalyptus.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# OpenCraft -- tools to aid developing and hosting free software projects\n# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>\n#\n# Thi... | python | chosen |
[
{
"from": "human",
"value": "Add argument parsing to main executable\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"Main executable for ShivyC compiler\n\n\"\"\"\n\nimport argparse\n\ndef get_arguments():\n \"\"\"Set up the argument parser and return an object storing the\n ... | python | chosen |
[
{
"from": "human",
"value": "Add python script to remove an arg\n"
},
{
"from": "gpt",
"value": "import sys\n\nprogram, first, *rest = sys.argv\nargs = []\nresult = 1\nfor arg in rest:\n if arg == first:\n result = 0\n else:\n quoted = f'\"{arg}\"'\n args.append(quoted... | python | chosen |
[
{
"from": "human",
"value": "Add module with some generic utility functions\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport io\nimport time\nfrom functools import lru_cache\n\n\ndef timing(func):\n \"\"\"Decorator to measure and print runtime of a function\"\"\"\n\n def wr... | python | chosen |
[
{
"from": "human",
"value": "Move entity extraction functions to emotools\n\nThe entity extraction functions defined in the generate_liwc_data.py\nscript were moved to the emotools module, because I want to use these\nfunctions in the visualization app. The next step is to update the\ngenerate_liwc_data scr... | python | chosen |
[
{
"from": "human",
"value": "Include nose tests for hydrotrend\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n\nfrom build_model_rpm import BuildModelRPM\nfrom nose.tools import *\n\n@raises(TypeError)\ndef test_fail_with_no_parameters():\n BuildModelRPM(None)\n\n@raises(TypeError)\ndef... | python | chosen |
[
{
"from": "human",
"value": "Add script to auto-generate a Change Log.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\nfrom __future__ import print_function\n\nimport os\nimport sys\nimport subprocess\nfrom collections import defaultdict\n\nimport jinja2\n\n\nCHANGELOG = \"\"\"\n# Chang... | python | chosen |
[
{
"from": "human",
"value": "Add a little config test file (will do more later)\n"
},
{
"from": "gpt",
"value": "from os import environ\n\n\nclass ConfigMeta(type):\n def __new__(cls, class_name, parents, attrs, app_name=None):\n cls._app_name = app_name.upper() if app_name else None\n... | python | chosen |
[
{
"from": "system",
"value": "Revert \"bump gunicorn max_requests to 600\"\n\nThis reverts commit ffbfe0d6f2ca83346693a788b14562eb332d0cbd.\n"
},
{
"from": "human",
"value": "import multiprocessing\npreload_app = True\nworkers = multiprocessing.cpu_count() * 2 + 1\nworker_class = 'gevent'\nkeepa... | python | chosen |
[
{
"from": "human",
"value": "Add a Python script to dump a \"unity build\" of any test program.\n\nThis script works around the fact that I don't have a conforming C++17\ncompiler on my laptop (yet!). Using this script I can turn a ten-line\ntest program into a standalone \"unity build\" suitable for cuttin... | python | chosen |
[
{
"from": "human",
"value": "Add move emails from inbox script\n"
},
{
"from": "gpt",
"value": "import logging\n\nfrom csv_email import get_move_folder, type_accepts_message\nfrom settings import get_csv_file_types, get_email_client, LOGGING_KWARGS\n\n\nlogger = logging.getLogger(__name__)\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights elections winners problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Election Winners Problem\n\n\ndef electionsWinners(votes, k):\n max_v = max(votes)\n count_max = votes.count(max_v)\n if k == 0:\n if c... | python | chosen |
[
{
"from": "human",
"value": "Add group and creation date field migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9b1 on 2015-11-17 15:06\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrations, model... | python | chosen |
[
{
"from": "human",
"value": "Add module/function to set proc name.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# Copyright (c) 2013 Mikkel Schubert <MSchubert@snm.ku.dk>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associat... | python | chosen |
[
{
"from": "human",
"value": "Add example that uses voluptuous.\n"
},
{
"from": "gpt",
"value": "\"\"\"Usage: prog.py --count=N OUTDIR FILE\n\nArguments:\n FILE input file\n OUTDIR out directory\n\nOptions:\n --count NUM number of operations [default: 1]\n\n\"\"\"\nimport docopt\ntry:\... | python | chosen |
[
{
"from": "human",
"value": "Add script for executing all tests in both services.\n"
},
{
"from": "gpt",
"value": "import nose\nimport os\nfrom tests.integration import SUBSCRIPTION, ONDEMAND\n\ntestfiles = [file for file in os.listdir('.') if file.startswith(\"test\") and file.endswith(\".py\")... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 389. Find the Difference\n\n389. Find the Difference: https://leetcode.com/problems/find-the-difference/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def findTheDifference(self, s, t):\n \"\... | python | chosen |
[
{
"from": "human",
"value": "Add example for training parser\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals, print_function\nimport json\nimport pathlib\nimport random\n\nimport spacy\nfrom spacy.pipeline import DependencyParser\nfrom spacy.gold import GoldParse\nfrom s... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add a Python example of creating a tree.\n"
},
{
"from": "gpt",
"value": "from vtk import *\n\ngraph = vtkMutableDirectedGraph()\na = graph.AddVertex()\nb = graph.AddChild(a)\nc = graph.AddChild(a)\nd = graph.AddChild(b)\ne = graph.AddChild(c)\nf = graph.AddChil... | python | chosen |
[
{
"from": "human",
"value": "Add a simple schema validation script based on LXML.\n\nSome systems don't have rnv or any other ready to use\nvalidators in repos/ports/whatever.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# verify_schema.py: simple LXML wrapper for checking XML a... | python | chosen |
[
{
"from": "human",
"value": "Add simple bulb example (getting the details of a bulb)\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCopyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>\n\nLicensed under MIT. All rights reserved.\n\"\"\"\nimport pymystrom\n\nbulb = pymystrom.MyStrom... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 539. Minimum Time Difference\n\n539. Minimum Time Difference: https://leetcode.com/problems/minimum-time-difference/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findMinDifference(self, timePoints):\n \"\"\"\n :t... | python | chosen |
[
{
"from": "human",
"value": "Add get_inspection_page method to scrape entire listing.\n"
},
{
"from": "gpt",
"value": "from bs4 import BeautifulSoup\nimport requests\nsoup = BeautifulSoup()\n\n\nINSPECTION_DOMAIN = 'http://info.kingcounty.gov'\nINSPECTION_PATH = '/health/ehs/foodsafety/inspectio... | python | chosen |
[
{
"from": "human",
"value": "Add Malaysian states and ISO Codes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# python-holidays\n# ---------------\n# A fast, efficient Python library for generating country, province and state\n# specific sets of holidays on the fly. It aims to ... | python | chosen |
[
{
"from": "human",
"value": "Add script demonstrating preparing PCA parameters computed by train_pca.py\n"
},
{
"from": "gpt",
"value": "import cPickle as pkl\nimport base64\nimport numpy as np\nfrom lopq.model import eigenvalue_allocation\n\n\ndef main(args):\n\n params = pkl.load(open(args.... | python | chosen |
[
{
"from": "system",
"value": "Fix mingw build, take 2"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# Build the project on AppVeyor.\n\nimport os\nfrom subprocess import check_call\n\nbuild = os.environ['BUILD']\nconfig = os.environ['CONFIG']\ncmake_command = ['cmake', '-DFMT_EXTRA_TES... | python | chosen |
[
{
"from": "human",
"value": "Add a kovot stream for Mastodon\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport collections.abc\nfrom mastodon import StreamListener, MastodonError, Mastodon as MastodonAPI\nfrom queue import Queue\nfrom kovot.response import ... | python | chosen |
[
{
"from": "system",
"value": "Use the version 0.5.0 when we merge it.\n\n"
},
{
"from": "human",
"value": "\n__version__ = \"0.4.2\"\n\nfrom sympy.core import *\nfrom sympy.modules import *\n"
},
{
"from": "gpt",
"value": "\n__version__ = \"0.5.0\"\n\nfrom sympy.core import *\nfrom s... | python | chosen |
[
{
"from": "human",
"value": "Add test for gref writing\n"
},
{
"from": "gpt",
"value": "import store_fixture\nimport groundstation.store\n\nfrom groundstation.gref import Gref\n\n\nclass TestGitGref(store_fixture.StoreTestCase):\n storeClass = groundstation.store.git_store.GitStore\n\n def... | python | chosen |
[
{
"from": "human",
"value": "Add management command for running VACUUM [ANALYZE]\n\n[skip ci]\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nimport logging\n\nfrom django.core.management.base import BaseCommand\nfrom django.apps import apps\nfrom django.db import conne... | python | chosen |
[
{
"from": "human",
"value": "Convert all the taxonomy IDs to rank so that we are always talking about the same thing\n"
},
{
"from": "gpt",
"value": "\"\"\"\nConvert all the taxonomy IDs to rank so that we are always talking\nabout the same thing\n\"\"\"\n\nimport sys\nimport taxon\n\ntry:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add configuration for Flask 'hello world' app\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask import Response\nflask_app = Flask('flaskapp')\n\n@flask_app.route('/hello')\ndef hello_world():\n return Response(\n 'Hello world from Flask!... | python | chosen |
[
{
"from": "human",
"value": "feat: Add code for creating samples\n"
},
{
"from": "gpt",
"value": "# importing modules/ libraries\nimport pandas as pd\nimport random\n\n# create sample of order products train data\nn = 1384617\ns = round(0.1 * n)\nskip = sorted(random.sample(range(1,n), n-s))\nor... | python | chosen |
[
{
"from": "human",
"value": "Add Kapsi result file converter.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThis script is used to convert email address and home directory location of\npyfiscan result files to Kapsi's format.\n\"\"\"\n\ntry:\n impo... | python | chosen |
[
{
"from": "human",
"value": "Add pypsa-db-io file with first functions\n"
},
{
"from": "gpt",
"value": "import pypsa\nimport pandas as pd\n\nfrom sqlalchemy.orm import sessionmaker, load_only\nfrom sqlalchemy import create_engine\nfrom pypsa import io\nfrom oemof import db\n\nfrom egoio.db_table... | python | chosen |
[
{
"from": "human",
"value": "Add tests for fuzzy ranking adjustments.\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nimport pytest\nfrom prompt_toolkit.completion import Completion\nfrom prompt_toolkit.document import Document\n\n\n@pytest.fixture\ndef completer():\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement the beginning of insertion sort\n\nhttps://www.hackerrank.com/challenges/insertionsort1\n"
},
{
"from": "gpt",
"value": "# https://www.hackerrank.com/challenges/insertionsort1\n# Python 3\n\n\ndef formatted_print(items):\n formatted = ' '.join([str(item)... | python | chosen |
[
{
"from": "human",
"value": "Add unique cad name tests\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Integration tests for custom attribute definitions model.\"\"\"\n\nfrom sqlalchemy.exc... | python | chosen |
[
{
"from": "human",
"value": "search: Add a simple command to test search\n"
},
{
"from": "gpt",
"value": "\nfrom django.core.management.base import BaseCommand, make_option\nfrom extensions.models import Extension\nfrom extensions.search import enquire\n\ndef append_version(option, opt_str, valu... | python | chosen |
[
{
"from": "human",
"value": "Move migration 21 to it's proper file\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom raiden.storage.sqlite import SQLiteStorage\n\nSOURCE_VERSION = 20\nTARGET_VERSION = 21\n\n\ndef _transform_snapshot(raw_snapshot: str) -> str:\n snapshot = json.loads(raw_sn... | python | chosen |
[
{
"from": "human",
"value": "Add venv利用時のsys.prefix, sys.base_prefix, sys.exec_prefix, sys.base_exec_prefix の値の違いについてのサンプル追加\n"
},
{
"from": "gpt",
"value": "\"\"\"\nsys モジュールについてのサンプルです.\n\nvenv 環境での\n - sys.prefix\n - sys.exec_prefix\n - sys.base_prefix\n - sys.base_exec_prefix\nの値について.\n\... | python | chosen |
[
{
"from": "human",
"value": "Create script to convert from old FAST{A,Q} name format to new one (as of Casava 1.8).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\nimport functools\nimport re\nimport argparse\n\nfrom khmer import ReadParser\n\n\nresub_read_1 = functools.partial( re.s... | python | chosen |
[
{
"from": "system",
"value": "Use readme as the long description in pypi\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport version\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nwith open('requirements.txt') as f:\n re... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for latex output\n"
},
{
"from": "gpt",
"value": "\"\"\"\nunit tests of the latex writer\n\"\"\"\n\nimport unittest\nimport subprocess\nimport tempfile\nimport os\nimport sys\nimport BeautifulSoup\n\nfrom pyth.plugins.latex.writer import LatexWriter\nf... | python | chosen |
[
{
"from": "human",
"value": "Add tests for functions in table.py :construction:\n"
},
{
"from": "gpt",
"value": "from cycli.table import isnumeric, col_widths\nimport pytest\n\n@pytest.mark.parametrize((\"number\", \"answer\"), [\n (\"12\", True),\n (\"12.3\", True),\n (\"0\", True),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a couple of basic tests for sanitize_object\n"
},
{
"from": "gpt",
"value": "from bugsnag.utils import sanitize_object\n\ndef test_sanitize_object():\n filters = [\"password\", \"credit_card\"]\n crazy_dict = {\n \"password\": \"123456\",\n \"... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for format module\n"
},
{
"from": "gpt",
"value": "from unittest.mock import MagicMock, patch\n\nimport pytest\nfrom hypothesis_auto import auto_pytest_magic\n\nimport isort.format\n\nauto_pytest_magic(isort.format.show_unified_diff)\n\n\ndef test_ask_... | python | chosen |
[
{
"from": "system",
"value": "Make the SITE_OWNER and COPYRIGHT_HOLDER for St Paul (more) correct\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom datetime import date\n\nMAPIT_BASE_URL = 'http://international.mapit.mysociety.org/'\nELECTION_RE = '(?P<election>council-member-20... | python | chosen |
[
{
"from": "human",
"value": "Add modern Greek language toolkit module.\n"
},
{
"from": "gpt",
"value": "\"\"\" This module offers a number tools for processing modern Greek text. \"\"\"\n\ndef normalize(text):\n \"\"\" Remove intonation from Greek text.\n\n Args:\n text (str... | python | chosen |
[
{
"from": "human",
"value": "Add even numbers between two numbers exercise\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfirst = input(\"Write a number: \")\nsecond = input(\"Write another number: \")\n\nfor x in range(first, second):\n if (x % 2 == 0):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test-case for multiple-inheritance on an array-scalar.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\" Test printing of scalar types.\n\n\"\"\"\n\nimport numpy as np\nfrom numpy.testing import TestCase, run_module_suite\n\n\nclass A(object): pass... | python | chosen |
[
{
"from": "human",
"value": "Move iterator tests into separate file\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase, main\nimport re\nfrom uuid import UUID\n\nfrom jsonrpcclient.id_iterators import hex_iterator, uuid_iterator, \\\n random_iterator\n\nclass TestHexIterator(TestC... | python | chosen |
[
{
"from": "human",
"value": "Fix User object attribute reference\n"
},
{
"from": "gpt",
"value": "#\n# Copyright 2012 Cisco Systems, Inc.\n#\n# Author: Soren Hansen <sorhanse@cisco.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file e... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights swap adjacent bits problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Swap Adjacent Bits (Core) Problem\n\n\ndef swapAdjacentBits(n):\n # even = n & 0xaaaaaaaa # mask to keep only even bits with 10 16x\n # odd = n... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Removed unneeded WSGI file\"\n\nThis reverts commit 078f9ecdba5eedd957fa88af8bc45ed1ad8a3e6e.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nWSGI config for Bitket project.\n\nThis module contains the WSGI application used by Django's development server\nand any p... | python | chosen |
[
{
"from": "human",
"value": "Add bcbio project summary metrics -> CSV converter.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nfrom argparse import ArgumentParser\nimport yaml\n\nif __name__ == \"__main__\":\n parser = ArgumentParser(description=\"Convert metrics fro... | python | chosen |
[
{
"from": "human",
"value": "Add a toy server to use in tests\n"
},
{
"from": "gpt",
"value": "from twisted.web.server import Site\nfrom twisted.internet import reactor\nfrom twisted.internet.defer import inlineCallbacks, returnValue\n\nfrom klein import Klein\n\n\nclass ToyServer(object):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add in unit tests for DirectoryRecord.\n\nSigned-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@gmail.com>\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport pytest\nimport os\nimport sys\ntry:\n from cStringIO im... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for changed choice labels\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 ('surve... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.