conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Build a legacy distance export\n" }, { "from": "gpt", "value": "import json\nimport sys\nimport database as db\nfrom database.model import Team\nfrom geotools import simple_distance\nfrom geotools.routing import MapPoint\nfrom webapp.cfg.config import DB_CONNECTION\n...
python
chosen
[ { "from": "human", "value": "Add serialization tests for tagger\n" }, { "from": "gpt", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom ..util import make_tempdir\nfrom ...pipeline import NeuralTagger as Tagger\n\nimport pytest\n\n\n@pytest.fixture\ndef taggers(en_vocab...
python
chosen
[ { "from": "human", "value": "Add unit test for quick sort implementation.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport unittest\n\nfrom helper.read_data_file import read_int_array\nfrom sorting.quick_sort import sort\n\n\nBASE_DIR = os.path...
python
chosen
[ { "from": "system", "value": "Fix for Blender version check\n" }, { "from": "human", "value": "bl_info = {\n\t\"name\": \"Booltron\",\n\t\"author\": \"Mikhail Rachinskiy (jewelcourses.com)\",\n\t\"version\": (2000,),\n\t\"blender\": (2,7,4),\n\t\"location\": \"3D View → Tool Shelf\",\n\t\"descri...
python
chosen
[ { "from": "human", "value": "Create the Contacts App - Part II > New Contact - Create Form\n" }, { "from": "gpt", "value": "from django import forms\n\nfrom .models import Contact\n\n\nclass ContactForm(forms.ModelForm):\n class Meta:\n model = Contact\n fields = ('first_name', ...
python
chosen
[ { "from": "human", "value": "Add tests for limits api in V1 api\n\nChange-Id: Id05520acf5e3a62647915829d72ca7afd3916337\n" }, { "from": "gpt", "value": "# coding=utf-8\n# Copyright 2012 Managed I.T.\n#\n# Author: Kiall Mac Innes <kiall@managedit.ie>\n#\n# Licensed under the Apache License, Versi...
python
chosen
[ { "from": "human", "value": "Add 'manage.py' command for unattended password setup\n\nUnfortunately, there is no standard way to non-interactively create\nsuperuser account, neither in Django, nor in django-extensions. All the\nfollowing commands require manual pasword-typing:\n\n - createsuperuser\n - chan...
python
chosen
[ { "from": "human", "value": "Add script to find destructors which are not virtual, but should be\n\ngit-svn-id: b0ea89ea3bf41df64b6a046736e217d0ae4a0fba@66 806ff5bb-693f-0410-b502-81bc3482ff28\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Copyright 2008 Google Inc.\n#\n# Licensed ...
python
chosen
[ { "from": "human", "value": "Add migrations for verbose name changes\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-10-23 16:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):...
python
chosen
[ { "from": "system", "value": "[Telemetry] Raise robohornetpro timeout. Is it timing out on cros.\n\nBUG=266129\n\nReview URL: https://chromiumcodereview.appspot.com/21297004\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@214925 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Write cluster_tendrl_context to proper location\n\nCurrently it is written to clusters/<node-id>/TendrlContext\nThis is fixed in this PR\n\ntendrl-bug-id: Tendrl/commons#302\nSigned-off-by: nnDarshan <d2c6d450ab98b078f2f1942c995e6d92dd504bc8@gmail.com>\n" }, { "from": "...
python
chosen
[ { "from": "human", "value": "Package for console_mode test suite.\n" }, { "from": "gpt", "value": "############################################################################\n##\n## Copyright (C) 2006-2007 University of Utah. All rights reserved.\n##\n## This file is part of VisTrails.\n##\n##...
python
chosen
[ { "from": "human", "value": "Add missing file for last commit\n" }, { "from": "gpt", "value": "import imp\n\nmodule = imp.new_module('config')\nmodule.__file__ = 'config.py'\nconfig = {}\nconfig_file = open(module.__file__)\n\nexec(compile(config_file.read(), 'config.py', 'exec'), module.__dict_...
python
chosen
[ { "from": "human", "value": "Add unit tests for bazaar URL handling\n\nTested on 2.4.4, 2.7.1 and 3.2\n\nnosetests tests.test_vcs_bazaar passes in each, full setup.py test gives:\n\n2.4:\n\n----------------------------------------------------------------------\nRan 107 tests in 167.345s\n\nOK\n\n2.7 fails 1...
python
chosen
[ { "from": "human", "value": "Add Publisher mixins for using Mappers\n" }, { "from": "gpt", "value": "'''\nMixins for using Mappers with Publisher\n'''\nfrom django.core.exceptions import ValidationError\n\nfrom nap import http\nfrom nap.utils import flatten_errors\n\n\nclass MapperListMixin(obje...
python
chosen
[ { "from": "human", "value": "Add pint numpy type snippet\n" }, { "from": "gpt", "value": "# A variable imbued with pint unit mutates its state when touched by Numpy.\n# Source https://github.com/hgrecco/pint/blob/master/pint/quantity.py#L1165-L1167\n# Since https://github.com/hgrecco/pint/commit...
python
chosen
[ { "from": "human", "value": "Add a quick way to show the current queue configuration.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>\n" }, { "from": "gpt", "value": "from django.core.management.base import NoArgsCommand\n\nfrom ... import app_settings\n\nclass...
python
chosen
[ { "from": "human", "value": "Add utility script to convert/update builds.\n\n * Moving to mass-rename everything into build, the script is\n used to convert defconfig_id fields into build_id.\n * Add \"kernel\" type to build documents.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n...
python
chosen
[ { "from": "human", "value": "Add a custom client side test runner\n" }, { "from": "gpt", "value": "from tests import web_client_test\n\n\nsetUpModule = web_client_test.setUpModule\ntearDownModule = web_client_test.tearDownModule\n\n\nclass WebClientTestCase(web_client_test.WebClientTestCase):\n\...
python
chosen
[ { "from": "human", "value": "Add py solution for 494. Target Sum\n\n494. Target Sum: https://leetcode.com/problems/target-sum/\n" }, { "from": "gpt", "value": "from collections import Counter\nclass Solution(object):\n def findTargetSumWays(self, nums, S):\n \"\"\"\n :type nums:...
python
chosen
[ { "from": "human", "value": "Add small utility for removing package references\n" }, { "from": "gpt", "value": "import fnmatch\nimport os\nimport re\n\nre_reference = re.compile(r'\\<Reference Include=\\\"([\\w\\.]+)\\,.*?\\<\\/Reference\\>', re.DOTALL | re.MULTILINE)\n\ndef process_csproj(file,...
python
chosen
[ { "from": "human", "value": "Add initial Python submission parameter test\n" }, { "from": "gpt", "value": "# coding=utf-8\n# Licensed Materials - Property of IBM\n# Copyright IBM Corp. 2016\nfrom __future__ import print_function\nimport unittest\nimport sys\nimport itertools\nfrom enum import In...
python
chosen
[ { "from": "human", "value": "Solve Code Fights longest word problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Longest Word Problem\n\nimport re\n\n\ndef longestWord(text):\n m = re.findall(r'\\b[a-z]+?\\b', text, flags=re.I)\n return max(m, key=len)\n\n\ndef m...
python
chosen
[ { "from": "human", "value": "Sort Array By Parity II\n" }, { "from": "gpt", "value": "class Solution:\n def sortArrayByParityII(self, A):\n \"\"\"\n :type A: List[int]\n :rtype: List[int]\n \"\"\"\n \n if not A:\n return A\n \n ...
python
chosen
[ { "from": "human", "value": "Add a tiny test application for testing the plugin registry\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n\nimport Cura.PluginRegistry\n\np = Cura.PluginRegistry.PluginRegistry()\np.addPluginLocation(\"plugins\")\n\np._populateMetaData()\n#p.loadPlugin(\"E...
python
chosen
[ { "from": "system", "value": "Fix with_session decorator for python 2.5\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1957 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n" }, { "from": "human", "value": "from flexget.manager import Session\r\n\r\n\r\ndef with_session(func):\r\n \"\"\"\"Creat...
python
chosen
[ { "from": "human", "value": "Add initial version of the commandline tool\n" }, { "from": "gpt", "value": "\"\"\"Calculate the number of Pomodori available within a time period.\n\nUsage:\n get-pomodori [--from=<time>] [--break=<minutes>] [--long-break=<minutes>] <end-time>\n get-pomodori (-h |...
python
chosen
[ { "from": "human", "value": "Add a snippet (Python OpenCV).\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nOpenCV - Read image: read an image given in arguments\n\nRequired: opencv library (D...
python
chosen
[ { "from": "system", "value": "Move to function only tests & fix test for generator based build_file_list\n\nbuild_file_list is a generator now so we need to make sure it returns an\niterable but not a string.\n" }, { "from": "human", "value": "import os\n\nfrom tvrenamr.cli import helpers\n\nfro...
python
chosen
[ { "from": "human", "value": "Add some test for settings. TODO fix save.\n" }, { "from": "gpt", "value": "\ndef test_settings_group(plex):\n assert plex.settings.group('general')\n\n\ndef test_settings_get(plex):\n # This is the value since it we havnt set any friendlyname\n # plex just ...
python
chosen
[ { "from": "human", "value": "Add tool for adding COOP IDs\n\n" }, { "from": "gpt", "value": "# Need to check the log files for shef parser and create new sites \n# within database based on what we find\n\nimport re, iemdb, os\nMESOSITE = iemdb.connect('mesosite', bypass=False)\n\n\n# Load up our...
python
chosen
[ { "from": "human", "value": "Add foundation for native component testing\n" }, { "from": "gpt", "value": "import json\nimport subprocess\nimport struct\nimport sys\nimport unittest\nimport uuid\n\nexe = None\n\n# The protocol datagram is described here:\n# https://developer.chrome.com/extensions...
python
chosen
[ { "from": "human", "value": "Add our custom dashboard modules\n" }, { "from": "gpt", "value": "from admin_tools.dashboard.modules import LinkList\nfrom django.core.urlresolvers import reverse\nfrom linkcheck.views import get_status_message\n\n\nclass PermCheckingLinkList(LinkList):\n\n def __...
python
chosen
[ { "from": "human", "value": "Add test to set a sysctl value\n" }, { "from": "gpt", "value": "import os\nimport sysctl\nfrom sysctl.tests import SysctlTestBase\n\n\nclass TestSysctlANum(SysctlTestBase):\n\n def test_sysctl_setvalue(self):\n dummy = sysctl.filter('kern.dummy')[0]\n ...
python
chosen
[ { "from": "human", "value": "Add a utility to retrieve the latest version of RStudio.\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n# RStudio does not provide a \"-latest\" download link so we deduce it from\n# their S3 bucket listing and save the download to /tmp/rstudio-latest.deb.\n#...
python
chosen
[ { "from": "human", "value": "Solve Code Fights cyclic name problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Cyclic Name Problem\n\nfrom itertools import cycle\n\n\ndef cyclicName(name, n):\n gen = cycle(name)\n res = [next(gen) for _ in range(n)]\n return ...
python
chosen
[ { "from": "human", "value": "Add tests for C4 model property pages\n" }, { "from": "gpt", "value": "from gaphor import C4Model\nfrom gaphor.C4Model.propertypages import DescriptionPropertyPage, TechnologyPropertyPage\nfrom gaphor.diagram.tests.fixtures import find\n\n\ndef test_description_prope...
python
chosen
[ { "from": "human", "value": "Add test for the EPSG-3857 spatial reference.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\nimport rasterio\nimport pytest\nfrom math import pi\n\nfrom numpy import array\nfrom numpy.testing import assert_array_almost_equal\n\nfrom gdal2mbtiles.consta...
python
chosen
[ { "from": "human", "value": "Add tests for generic relationship batch fetching\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\nimport sqlalchemy as sa\nfrom tests import TestCase\nfrom sqlalchemy_utils import batch_fetch, generic_relationship\n\n\nclass TestBatchFetchGe...
python
chosen
[ { "from": "human", "value": "Add check on HADS ingest" }, { "from": "gpt", "value": "\"\"\"\n Check how much HADSA data we have\n\"\"\"\nimport os\nimport sys\nimport stat\nimport iemdb\nHADS = iemdb.connect('iem', bypass=True)\nhcursor = HADS.cursor()\n\ndef check():\n hcursor.execute(\"\"\"...
python
chosen
[ { "from": "human", "value": "Add w2v create graph from corpus\n" }, { "from": "gpt", "value": "from __future__ import print_function\nimport sys\nfrom random import shuffle\n\nDISTANCE = 10\n\nwith open(sys.argv[1], 'r') as corpus:\n text = corpus.read()\n text = text[:1000000]\n\n word...
python
chosen
[ { "from": "human", "value": "Complete word idx dict + prefix/suffix pal sol\n" }, { "from": "gpt", "value": "\"\"\"336. Palindrome Pairs\nHard\n\nURL: https://leetcode.com/problems/palindrome-pairs/\n\nGiven a list of unique words, find all pairs of distinct indices (i, j) in the given\nlist, so...
python
chosen
[ { "from": "human", "value": "Add normalize and Vector substraction functions\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\n\nprint 'Insert one points, separated with commas: '\nxy = input('Insert first point: ')\nx2y2 = input('Insert second point...
python
chosen
[ { "from": "human", "value": "Add example - Cumulative count\n" }, { "from": "gpt", "value": "\"\"\"\nCumulative Count Chart\n----------------------\nThis example shows an area chart with cumulative count.\nAdapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html\n\n\"\"\"...
python
chosen
[ { "from": "human", "value": "Add a debugging file connecting Python to GH\n" }, { "from": "gpt", "value": "import rpyc\n\nc = rpyc.utils.factory.connect(\n \"localhost\",\n 18871,\n service=rpyc.core.service.ClassicService,\n config={\"sync_request_timeout\": None},\n ipv6=False,\...
python
chosen
[ { "from": "human", "value": "Put constants into a dedicated module\n" }, { "from": "gpt", "value": "####################################\n#\n# Keep all the constants used to\n# create glidein entries in this\n# module\n#\n# Author: Igor Sfiligoi\n#\n####################################\n\nimport...
python
chosen
[ { "from": "human", "value": "Add a benchmark of import time\n" }, { "from": "gpt", "value": "\"\"\"\nMiscellaneous benchmarks.\n\"\"\"\n\nimport subprocess\nimport sys\nimport time\n\nfrom numba import jit\n\n\nclass InitializationTime:\n # Measure wall clock time, not CPU time of calling pro...
python
chosen
[ { "from": "human", "value": "Add basic test for CaseBulkDB\n" }, { "from": "gpt", "value": "import uuid\nfrom unittest import mock\n\nfrom django.test import TestCase\n\nfrom casexml.apps.case.mock import CaseBlock\n\nfrom corehq.apps.hqcase.bulk import CaseBulkDB\nfrom corehq.form_processor.int...
python
chosen
[ { "from": "human", "value": "Add script to remove unnecessary numbers from people's locations.\n" }, { "from": "gpt", "value": "import re\nimport mysite\nPerson = mysite.profile.models.Person\n\npeople_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')\n\n...
python
chosen
[ { "from": "human", "value": "Convert csv to json for clusters\n\nConvert csv to json for cluster-d3.html(or dynamic-cluster.html)" }, { "from": "gpt", "value": "#!/usr/bin/env python2.7\n#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. S...
python
chosen
[ { "from": "human", "value": "Add script to create copies of PNG files w/ filenames prefixed with their creation time (Windows only)\n" }, { "from": "gpt", "value": "import os, os.path\nimport shutil\nfrom datetime import datetime\nimport sys\n\ndef do_folder(src_folder):\n assert os.path.isdi...
python
chosen
[ { "from": "human", "value": "Add test for GMEU entry \"a\", part C\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Test GMEU entry 'a', part C.\n\nThis entry is about pronunciation of the word 'a' and is unlikely to be\nrelevant to usage in written langua...
python
chosen
[ { "from": "human", "value": "Add example for CLI object\n" }, { "from": "gpt", "value": "import hug\n\n\n@hug.cli_object(name='git', version='1.0.0')\nclass GIT(object):\n \"\"\"An example of command like calls via an Object\"\"\"\n\n @hug.cli_object()\n def push(self, branch='master'):...
python
chosen
[ { "from": "human", "value": "Add new tool to set bytes in file\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\nimport sys\nimport ast\n\ntry:\n file_name, location, new_byte = sys.argv[1:]\nexcept:\n print(\"Usage: ./{} file location newbyte\".format(sys.argv[0]))\n sys.exit(1)...
python
chosen
[ { "from": "human", "value": "Add tentative construct format for ClientHello messages.\n" }, { "from": "gpt", "value": "from construct import Array, Bytes, Struct, UBInt16, UBInt32, UBInt8\n\n\nProtocolVersion = Struct(\n \"version\",\n UBInt8(\"major\"),\n UBInt8(\"minor\")\n)\n\nRandom...
python
chosen
[ { "from": "human", "value": "tests: Add test for accessing attribute of inherited native type.\n" }, { "from": "gpt", "value": "class MyExc(Exception):\n pass\n\ne = MyExc(100, \"Some error\")\nprint(e)\n# TODO: Prints native base class name\n#print(repr(e))\nprint(e.args)\n" } ]
python
chosen
[ { "from": "human", "value": "tests: Add test for calling inherited native method on subclass.\n" }, { "from": "gpt", "value": "# Test calling non-special method inherited from native type\n\nclass mylist(list):\n pass\n\nl = mylist([1, 2, 3])\nprint(l)\nl.append(10)\nprint(l)\n" } ]
python
chosen
[ { "from": "human", "value": "Add example to show how to create dom hit statistics\n" }, { "from": "gpt", "value": "\"\"\"\n==================\nDOM hits.\n==================\n\nThis example shows how to create DOM hits statistics to estimate track\ndistances.\n\"\"\"\n\nfrom collections import de...
python
chosen
[ { "from": "human", "value": "Add post_only and get_only decorators\n" }, { "from": "gpt", "value": "from django.http import HttpResponseNotAllowed\n\ndef post_only(func):\n def decorated(request, *args, **kwargs):\n if request.method != 'POST':\n return HttpResponseNotAllowe...
python
chosen
[ { "from": "human", "value": "Add the API available inside GenTests method for the raw_io module.\n\nThis CL makes the raw_io module ready to have its output mocked\nin GenTests.\n\nR=agable@chromium.org\n\nReview URL: https://codereview.chromium.org/160143003\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be...
python
chosen
[ { "from": "human", "value": "Add simple test for the createdb script\n" }, { "from": "gpt", "value": "# Yith Library Server is a password storage server.\n# Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>\n#\n# This file is part of Yith Library Server.\n#\n# Yith Library S...
python
chosen
[ { "from": "human", "value": "Add py2exe setup file for creating windows executables\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\r\n#\r\n# (C) 2008 British Broadcasting Corporation and Kamaelia Contributors(1)\r\n# All Rights Reserved.\r\n#\r\n# You may only modify and redistribute...
python
chosen
[ { "from": "human", "value": "Add solution for exercise 4.3" }, { "from": "gpt", "value": "'''\nCreated on 30 Aug 2017\n\n@author: igoroya\n'''\nimport collections\nfrom chapter4 import utils\n\ndef make_lists(root_node):\n stack = collections.deque()\n\n node_i = 1\n lists = []\n\n n...
python
chosen
[ { "from": "human", "value": "Add a header to burp response" }, { "from": "gpt", "value": "# Burp extension to add CSP headers to responses\n__author__ = 'jay.kelath'\n\n# setup Imports\nfrom burp import IBurpExtender\nfrom burp import IHttpListener\nfrom burp import IHttpRequestResponse\nfrom bu...
python
chosen
[ { "from": "human", "value": "Add basic unit test for cubic interpolation\n" }, { "from": "gpt", "value": "import torch\nfrom gpytorch.utils.interpolation import Interpolation\nfrom gpytorch import utils\n\n\ndef test_interpolation():\n x = torch.linspace(0.01, 1, 100)\n grid = torch.linspa...
python
chosen
[ { "from": "human", "value": "Add script for writing defaults from a directory of patch dictionaries.\n" }, { "from": "gpt", "value": "#! /usr/bin/python\n# Encoding: utf-8\n\nimport json\nimport os\nimport re\nimport subprocess\nimport sys\n\nclass TypeMapping:\n\tdef __init__(self, py_types, ty...
python
chosen
[ { "from": "human", "value": "Add support for extracting a UFO from a UFO. It sounds silly, but it is useful.\n" }, { "from": "gpt", "value": "import os\nfrom robofab.ufoLib import UFOReader\n\n# ----------------\n# Public Functions\n# ----------------\n\ndef isUFO(pathOrFile):\n if not isinst...
python
chosen
[ { "from": "human", "value": "Update script to export colormaps\n" }, { "from": "gpt", "value": "\"\"\"\nExport colormaps from Python / matplotlib to JavaScript.\n\"\"\"\n\n# -----------------------------------------------------------------------------\n# IMPORTS\n# ------------------------------...
python
chosen
[ { "from": "human", "value": "Add tests for get_poll and save_poll.\n" }, { "from": "gpt", "value": "\"\"\"Tests for go.apps.dialogue.dialogue_api.\"\"\"\n\nfrom twisted.internet.defer import inlineCallbacks\nfrom twisted.trial.unittest import TestCase\n\nfrom go.apps.dialogue.dialogue_api import...
python
chosen
[ { "from": "human", "value": "Allow stopping of all queueing threads and respond to keyboard interrupt in main\n" }, { "from": "gpt", "value": "\"\"\"\n queueing.resources\n ==================\n\n Utilities and resources for queueing.\n\n :author: Michael Browning\n :copyright: (c)...
python
chosen
[ { "from": "human", "value": "UPDATE Post model, published boolea field added\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-05-10 23:46\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrat...
python
chosen
[ { "from": "human", "value": "Add check_mk swift proxy diagnostic\n\nAdded a check_mk script that runs healthcheck to ensure that a\nproxy node is up and running with proxy services. This diag is\nalso check_mk compliant (ie. the output matches check_mk desired\nformat).\n\nHave not added thecheck_mk-agent e...
python
chosen
[ { "from": "human", "value": "Add script to generate fake data\n" }, { "from": "gpt", "value": "import requests \nimport json\nimport random \nimport uuid\n\nlogin=\"test\"\npassword=\"P@ssword\"\n\nwith open(\"dict\", 'r', encoding=\"latin-1\") as words :\n a = words.readlines()\n\nheaders =...
python
chosen
[ { "from": "human", "value": "Solve the Trailing String challenge\n" }, { "from": "gpt", "value": "# Trailing String\n# \n# https://www.codeeval.com/open_challenges/32/\n# \n# Challenge Description: There are two strings: A and B. Print 1 if string B \n# occurs at the end of string A. Otherwise, ...
python
chosen
[ { "from": "human", "value": "Add some unit tests for the diagonals.\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\nimport numpy as np\n\nfrom nose.tools import assert_is, assert_is_instance\nfrom numpy.testing import assert_array_equal\n\nfrom landlab.grid.diagonals import create_nodes...
python
chosen
[ { "from": "human", "value": "Add a few statement comparison tests\n" }, { "from": "gpt", "value": "\"\"\"\nTest ChatterBot's statement comparison algorithms.\n\"\"\"\n\nfrom unittest import TestCase, SkipTest\nfrom chatterbot.conversation import Statement\nfrom chatterbot import comparisons\n\n\...
python
chosen
[ { "from": "human", "value": "Add job to create CIViC VCF\n" }, { "from": "gpt", "value": "class CreateCivicVcf < ActiveJob::Base\n def perform\n system(\"python3 #{script_path} #{vcf_path}\")\n self.class.set(wait_until: Date.tomorrow.midnight).perform_later\n end\n\n def script_path\n ...
python
chosen
[ { "from": "human", "value": "fix: Add patch to delete duplicate issues\n" }, { "from": "gpt", "value": "import frappe\n\n# This patch deletes all the duplicate indexes created for same column\n# The patch only checks for indexes with UNIQUE constraints\n\ndef execute():\n\tall_tables = frappe.db...
python
chosen
[ { "from": "human", "value": "Add name to family member\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2017-05-17 16:49\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Add failing test for get_all_names.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_liter...
python
chosen
[ { "from": "human", "value": "Add management command to send welcome email\n" }, { "from": "gpt", "value": "# Copyright 2011 - Participatory Culture Foundation\n# \n# This file is part of Miro Community.\n# \n# Miro Community is free software: you can redistribute it and/or modify it\n# under the...
python
chosen
[ { "from": "human", "value": "Add a test that makes a new guide stats database\n" }, { "from": "gpt", "value": "import tempfile\nimport os\n\nfrom .. import guide_stats\n\n\ndef test_calc_stats():\n guide_stats.calc_stats(17210)\n\n\ndef test_make_gui_stats():\n \"\"\"\n Save the guide s...
python
chosen
[ { "from": "human", "value": "Add solution to problme 5\n" }, { "from": "gpt", "value": "from collections import Counter\nfrom functools import reduce\nfrom operator import mul\nfrom typing import Generator\n\n_range = tuple(range(2, 21))\n\n\ndef _factor_generator(number: int) -> Generator:\n ...
python
chosen
[ { "from": "human", "value": "Set post stat on draft by default\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-08-10 14:30\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration...
python
chosen
[ { "from": "system", "value": "Add custom normaluze function that will not get non existant items\n" }, { "from": "human", "value": "'''\nHarvester for Dryad for the SHARE project\n\nExample API call: http://www.datadryad.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc\n'''\n\nfrom __futur...
python
chosen
[ { "from": "human", "value": "Add dummy config file so that tests work.\n" }, { "from": "gpt", "value": "# Dummy config; should not be installed. This is here simply so that the\n# test suite works.\n\nimport os\n\ndatadir = os.path.join(os.path.abspath(os.path.dirname(__file__)),\n ...
python
chosen
[ { "from": "human", "value": "Add test for window module\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom time import sleep\nfrom unittest.mock import MagicMock\n\nfrom wdom.document import get_document\nfrom wdom.server import _tornado\nfrom wdom.server.ha...
python
chosen
[ { "from": "human", "value": "Add Jenkins Python3 monster to dials, but don't enable it here yet.\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, division, print_function\n\nimport os\n\ndef find_new_python3_incompatible_code(module_under_test):\n '''\n Check source c...
python
chosen
[ { "from": "human", "value": "Create a helper to check for differences in dataframes\n" }, { "from": "gpt", "value": "import pandas as pd\n\nfrom dataactcore.interfaces.db import GlobalDB\n\n\ndef check_dataframe_diff(new_data, model, id_col, sort_cols, lambda_funcs=None):\n \"\"\" Checks if 2...
python
chosen
[ { "from": "human", "value": "Add a test for `qidoc list`\n\nChange-Id: I0fcd9fa17c2d69c5d90ec61eca872ca9a23f92b3\nReviewed-on: http://gerrit.aldebaran.lan/62795\nTested-by: gerrit\nReviewed-by: vbarbaresi <371b46c96c99af52f4f920034e4fcb63ece5bdb5@aldebaran-robotics.com>\n" }, { "from": "gpt", "v...
python
chosen
[ { "from": "human", "value": "Add a script to count changes per node.\n\nThis makes it possible to show a heatmap of recently changed nodes.\n" }, { "from": "gpt", "value": "# script $<\"<changes>\" | \"<countChanges>\" | \"<heatmap>\">$\n\n# assume single input\ninput = inputs[0]\ncommits = inpu...
python
chosen
[ { "from": "human", "value": "tempest: Add Unicode volume name test\n\nCreate and view a volume with Unicode characters\nin the name.\n\nChange-Id: I0c49814a98921d9743f74a6fc0b0b0044473c398\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Copyright 2016 Red Hat, Inc.\n# All Rights Rese...
python
chosen
[ { "from": "human", "value": "Add test of PIV read/write object cycle\n" }, { "from": "gpt", "value": "import os\nimport unittest\n\nfrom ..framework import cli_test_suite\nfrom ykman.piv import OBJ\nfrom .util import DEFAULT_MANAGEMENT_KEY\n\n\n@cli_test_suite\ndef additional_tests(ykman_cli):\n...
python
chosen
[ { "from": "human", "value": "Add base class for profile writer plugins\n\nThis class defines the write() function to write profiles with, that all profile writer plugins should implement.\n\nContributes to issue CURA-34.\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Ura...
python
chosen
[ { "from": "human", "value": "Test suite used for testing the Component level API for fixed box sizes\n\n\nMichael\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nimport Axon\nimport time\nfrom Kamaelia.Chassis.Pipeline import Pipeline\n\nclass MySender(Axon.Component.component):\n def m...
python
chosen
[ { "from": "human", "value": "*added: Test script for the stress test" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\r\n__author__ = 'sm9'\r\n\r\nimport asyncore, socket\r\nimport string, random\r\nimport struct, time\r\n\r\nHOST = '192.168.0.11'\r\nPORT = 9001\r\n\r\n\r\nPKT_CS_LOGIN = 1...
python
chosen
[ { "from": "human", "value": "Test utility to look for bad stacksize calculations.\n" }, { "from": "gpt", "value": "import compiler\nimport dis\nimport types\n\ndef extract_code_objects(co):\n l = [co]\n for const in co.co_consts:\n if type(const) == types.CodeType:\n l.ap...
python
chosen
[ { "from": "system", "value": "Remove import of specific models\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nBase Library (:mod:`ibei`)\n==========================\n\n.. currentmodule:: ibei\n\"\"\"\n\nfrom .version import __version__\nfrom .uibei import uibei\nfrom .sqsola...
python
chosen
[ { "from": "human", "value": "Add unittests for faultwrap middleware\n\nPartially implements bp exception-formatting\n\nChange-Id: Ib57ce625775e222e5b42b22c10687bce7b63d26d\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Licensed under the Apache License, Vers...
python
chosen
[ { "from": "human", "value": "Create small script to compute distance to some US holidays\n" }, { "from": "gpt", "value": "import pandas as pd\nfrom datetime import date\nimport holidays\n\ndef process_holidays(df):\n year = df['year']\n user_date = date(year, df['month'], df['day'])\n h...
python
chosen