conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix test for settings command\n" }, { "from": "human", "value": "# Copyright 2014-2015 Ivan Kravets <me@ikravets.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You m...
python
chosen
[ { "from": "human", "value": "Add tests for config milestones\n" }, { "from": "gpt", "value": "from tg.configuration.milestones import _ConfigMilestoneTracker\n\n\nclass Action:\n called = 0\n def __call__(self):\n self.called += 1\n\n\nclass TestMilestones(object):\n def setup(se...
python
chosen
[ { "from": "human", "value": "Remove tabs and trailing whitespace\n\nAlso added a simple python script for stripping the whitespace. Tabs, just grep\nand remove manually\n" }, { "from": "gpt", "value": "import glob\nimport os\nimport sys\n\n\n\n\n\nextensions = [\".cpp\", \".hpp\"]\n\nPATH = \"/h...
python
chosen
[ { "from": "human", "value": "Add a proof of concept for reading and writing from github api\n" }, { "from": "gpt", "value": "from hammock import Hammock as Github\nimport json\nimport base64\nfrom pprint import pprint\n\n# Let's create the first chain of hammock using base api url\ngithub = Gith...
python
chosen
[ { "from": "human", "value": "Solve Code Fights check password problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Check Password Problem\n\n\ndef checkPassword(attempts, password):\n def check():\n while True:\n tmp = yield\n yield tmp ...
python
chosen
[ { "from": "human", "value": "Test example viewing a dft mesh\n" }, { "from": "gpt", "value": "\ndef test_mesh():\n from pyquante2 import grid,h2o\n from pyquante2.viewer.viewer import Shapes,Viewer\n h2o_mesh = grid(h2o)\n shapes = Shapes(h2o)\n shapes.add_points(h2o_mesh.points[:...
python
chosen
[ { "from": "human", "value": "Add solution for problem 7\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nfrom math import sqrt, ceil\n\ndef isPrime (x):\n for i in range (3, ceil (sqrt (x) + 1), 2):\n if x % i == 0:\n return 0\n return 1\n\n# 2 already count\ncount =...
python
chosen
[ { "from": "human", "value": "Add directory for tests of removing epsilon rules\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 20.08.2017 17:38\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"" } ]
python
chosen
[ { "from": "human", "value": "Add a couple registrations embeds tests.\n" }, { "from": "gpt", "value": "from nose.tools import * # flake8: noqa\nimport functools\n\nfrom framework.auth.core import Auth\n\nfrom api.base.settings.defaults import API_BASE\nfrom tests.base import ApiTestCase\nfrom t...
python
chosen
[ { "from": "human", "value": "Add empty testcase for the MySQL Bind9 backend\n\nChange-Id: I55ef157b0c3dbf5f353553336d15c1f9681a92d4\n" }, { "from": "gpt", "value": "# Copyright 2012 Managed I.T.\n#\n# Author: Kiall Mac Innes <kiall@managedit.ie>\n#\n# Licensed under the Apache License, Version 2...
python
chosen
[ { "from": "human", "value": "Add simple unit test for Bananaphone codec\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport unittest\nimport twisted.trial.unittest\nfrom struct import pack\n\nfrom obfsproxy.network.buffer import Buffer\nfrom obfsproxy.transports.bananaphone import r...
python
chosen
[ { "from": "human", "value": "Add ida script to convert ida anim to python anim\n\nselect the address of the AnimationFrame in ida and run this script and it'll output ImagePositions that I can copy paste into animations\n" }, { "from": "gpt", "value": "from collections import namedtuple\nfrom st...
python
chosen
[ { "from": "human", "value": "Add chapter1 folder and moise_pos.py\n\nSigned-off-by: sdphome <e1de489c79848a5fdae5f6d6adb3887195897185@live.cn>\n" }, { "from": "gpt", "value": "#!/bin/env python\r\nimport wx\r\n\r\nclass MyFrame(wx.Frame):\r\n def __init__(self):\r\n wx.Frame.__init__(s...
python
chosen
[ { "from": "human", "value": "Solve Code Fights try functions problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Try Functions Problem\n\nimport math\n\n\ndef tryFunctions(x, functions):\n return [eval(func)(x) for func in functions]\n\n\ndef main():\n tests = [...
python
chosen
[ { "from": "human", "value": "Add test to verify if language was detected properly\n\n" }, { "from": "gpt", "value": "import unittest\nfrom charset_normalizer.normalizer import CharsetNormalizerMatches as CnM\nfrom glob import glob\nfrom os.path import basename\n\n\nclass TestLanguageDetection(un...
python
chosen
[ { "from": "human", "value": "Add constants for port types\n" }, { "from": "gpt", "value": "# Copyright 2012 Midokura Japan KK\n\nclass PortType:\n MATERIALIZED_BRIDGE = \"MaterializedBridge\";\n MATERIALIZED_ROUTER = \"MaterializedRouter\";\n LOGICAL_BRIDGE = \"LogicalBridge\";\n LOG...
python
chosen
[ { "from": "system", "value": "Add unit support for spacers\n\ngit-svn-id: 305ad3fa995f01f9ce4b4f46c2a806ba00a97020@779 3777fadb-0f44-0410-9e7f-9d8fa6171d72\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\n# See LICENSE.txt for licensing terms\r\n#$HeadURL$\r\n#$LastChangedDate$\r\n#...
python
chosen
[ { "from": "human", "value": "Test two windows drawing GL with different contexts.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nimport pyglet.window\nfrom pyglet.window.event import *\nimport time\n\nfrom pyglet....
python
chosen
[ { "from": "human", "value": "Add a utility file to make a train data for MNIST sample.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\n'''\nDirectory structure\nTRAIN_DIR: \n label0:\n img0001.png\n img0002.png\n img0003.png\n label1:\n img0001.png...
python
chosen
[ { "from": "human", "value": "Add a management command to fix broken article urls when changing root site id.\n" }, { "from": "gpt", "value": "# coding=utf-8\n\nfrom django.db import connection\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nf...
python
chosen
[ { "from": "human", "value": "Add unit tests to `salt.utils.format_call()`.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`\n :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.\n :license: Apach...
python
chosen
[ { "from": "human", "value": "Move original to this folder\n\nOriginal was pulling back USD exchanges - now only looking at EUR\nexchanges\n" }, { "from": "gpt", "value": "from exchanges import helpers\nfrom exchanges import bitfinex\nfrom exchanges import bitstamp\nfrom exchanges import okcoin\n...
python
chosen
[ { "from": "human", "value": "Add test capturing failed expectation.\n" }, { "from": "gpt", "value": "\nfrom distutils import ccompiler\n\n\ndef test_set_include_dirs(tmp_path):\n \"\"\"\n Extensions should build even if set_include_dirs is invoked.\n In particular, compiler-specific pat...
python
chosen
[ { "from": "human", "value": "Add the weather module class\n\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# !/usr/bin/env python\n\n# MIT License\n#\n# Copyright (c) 2017 Maxime Busy\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this softwar...
python
chosen
[ { "from": "human", "value": "Test clean exit at keyboard interrupt\n" }, { "from": "gpt", "value": "import unittest\n\nfrom pykka import Actor\n\nclass ActorInterruptTest(unittest.TestCase):\n def setUp(self):\n class ActorWithInterrupt(Actor):\n def run_inside_try(self):\n ...
python
chosen
[ { "from": "human", "value": "Add script for plotting time interval hists.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport climate\nimport joblib\nimport lmj.cubes\nimport lmj.plot\nimport numpy as np\n\n\ndef diffs(t):\n t.load()\n return 1000 * np.diff(t.index.values)\n\n...
python
chosen
[ { "from": "system", "value": "Update pytest marker test suite\n" }, { "from": "human", "value": "\"\"\" These tests demonstrate pytest marker use for finding and running tests.\n\n Usage examples from this file:\n pytest -v -m marker_test_suite # Runs A, B, C, D\n ...
python
chosen
[ { "from": "human", "value": "Add specialist creation script for Dark Distorted Mirror\n" }, { "from": "gpt", "value": "from common import *\nfrom urlgrab import Cache\nfrom re import compile, DOTALL, MULTILINE, sub\nfrom urlparse import urljoin\n\ncache = Cache()\n\ntitlePattern = compile(\"<TIT...
python
chosen
[ { "from": "human", "value": "Add script to extract the tracts shapes in 2000 MSA\n" }, { "from": "gpt", "value": "\"\"\"shape_msa_blockgroup.py\n\nOutput one shapefile per MSA containing all the blockgroups it contains\n\"\"\"\nimport os\nimport csv\nimport fiona\n\n\n#\n# Import MSA to tracts c...
python
chosen
[ { "from": "human", "value": "Add CUDA GPU test for the .view() array method\n" }, { "from": "gpt", "value": "from __future__ import print_function, absolute_import, division\n\nfrom numba import unittest_support as unittest\nimport numpy as np\nfrom numba import cuda\n\n\ndef reinterpret_array_t...
python
chosen
[ { "from": "human", "value": "Add script for selecting a segue subsample\n" }, { "from": "gpt", "value": "from astropy.io import fits, ascii\nfrom astropy.table import Table\nimport numpy as np\n\nsspp = fits.open(\"/Users/adrian/projects/segue-learn/data/ssppOut-dr9.fits\")\nall_data = sspp[1].d...
python
chosen
[ { "from": "human", "value": "Move state and transition enums file for re-use" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Copyright 2017 Robot Garden, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with...
python
chosen
[ { "from": "human", "value": "Enable auto-loading of raw SQL during South migration\n" }, { "from": "gpt", "value": "# http://djangosnippets.org/snippets/2311/\n# Ensure South will update our custom SQL during a call to `migrate`.\n\nfrom south.signals import post_migrate\n\n\ndef run_initial_sql...
python
chosen
[ { "from": "human", "value": "Add a new MonitorAttach class for Focused monitors\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n#------------------------------------------------------------------------------\n# Package: Pikos toolkit\n# File: monitors/monitor_attach.py\n# License: L...
python
chosen
[ { "from": "system", "value": "Make powerline autodoc add all Segments\n" }, { "from": "human", "value": "# vim:fileencoding=utf-8:noet\nfrom sphinx.ext import autodoc\nfrom inspect import formatargspec\nfrom powerline.lint.inspect import getconfigargspec\nfrom powerline.lib.threaded import Threa...
python
chosen
[ { "from": "human", "value": "Prepare for coq -> latex translation\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nimport sys\nimport re\nfrom string import Template\n\ndef rule2latex(name, premises, conclusion):\n return Template(\nr\"\"\"\\newcommand{\\rl$name}{\\referTo{$name}{rul:$name...
python
chosen
[ { "from": "system", "value": "Change to use `featx` in package\n" }, { "from": "human", "value": "__all__ = []\n\nfrom lib.exp.featx.base import Featx\nfrom lib.exp.tools.slider import Slider\n\n\nclass SlideFeatx(Featx, Slider):\n def __init__(self, root, name):\n Featx.__init__(self,...
python
chosen
[ { "from": "human", "value": "Add migration for the segment\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2017-10-19 11:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport mod...
python
chosen
[ { "from": "human", "value": "Add fix related with CW19\n" }, { "from": "gpt", "value": "import datetime\n\nfrom django.core.management.base import BaseCommand\n\nfrom lowfat.models import Claimant, Fund, Expense\n\nclass Command(BaseCommand):\n help = \"CW19 funding request\"\n\n def handl...
python
chosen
[ { "from": "human", "value": "Create the table via migration.\n" }, { "from": "gpt", "value": "\"\"\"add pages table\n\nRevision ID: 66ecf0b2aed5\nRevises: c7476118715f\nCreate Date: 2019-06-01 16:10:06.519049\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '66ecf0b2aed5'\ndown_...
python
chosen
[ { "from": "human", "value": "Move pod lifecycle to schemas\n" }, { "from": "gpt", "value": "from hestia.unknown import UNKNOWN\n\n\nclass PodLifeCycle(object):\n CONTAINER_CREATING = 'ContainerCreating'\n PENDING = 'Pending'\n RUNNING = 'Running'\n SUCCEEDED = 'Succeeded'\n FAILED...
python
chosen
[ { "from": "human", "value": "Add rate_limit column to service model\n\nThe API rate limit will be removed from the config and added to services\nso that it is possible to change the rate_limit for individual services\nin rare cases.\n\nPivotal story: https://www.pivotaltracker.com/story/show/153992529\n" ...
python
chosen
[ { "from": "human", "value": "Add base class for KQueen UI views\n" }, { "from": "gpt", "value": "from flask import flash, session\nfrom flask.views import View\nfrom kqueen_ui.api import get_kqueen_client, get_service_client\n\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\nclass KQ...
python
chosen
[ { "from": "human", "value": "Implement Sum Of Digits in Python\n" }, { "from": "gpt", "value": "def sum_of_digits(n):\n sum = 0;\n for i in str(n):\n sum += int(i)\n\n return sum\n\nprint sum_of_digits(3) #3\nprint sum_of_digits(3454332) #24\n" } ]
python
chosen
[ { "from": "human", "value": "Test for ISO NC creator\n" }, { "from": "gpt", "value": "from posts.nc import *\r\nimport posts.iso\r\n\r\noutput('POST_TEST.txt')\r\n\r\nprogram_begin(123, 'Test program')\r\nabsolute()\r\nmetric()\r\nset_plane(0)\r\n\r\nfeedrate(420)\r\nrapid(100,120)\r\nrapid(z=50...
python
chosen
[ { "from": "human", "value": "Implement method for splitting files for batch processing\n" }, { "from": "gpt", "value": "import os\n\n# Download up to date filelist\nos.system(\"rsync -azv \" +\n \"data.analytics.hathitrust.org::features/listing/htrc-ef-all-files.txt\" +\n \" .\...
python
chosen
[ { "from": "human", "value": "Add initial version of goalie game item\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .common import Base\n\n\nclass GoalieGame(Base):\n __tablename__ = 'goalie_games'\n __autoload__ = True\n\n STANDARD_ATTRS = [\n ...
python
chosen
[ { "from": "human", "value": "Check we are using LDA correctly " }, { "from": "gpt", "value": "import gensim\nimport gensim.matutils\nimport logging \nimport sys \nimport numpy \nimport sklearn.feature_extraction.text as text \nimport scipy.sparse \nfrom exp.util.PorterTokeniser import PorterToke...
python
chosen
[ { "from": "human", "value": "Add Tkinter UI class from jbzdarkid\n" }, { "from": "gpt", "value": "from .steamwebbrowser import SteamWebBrowserCfg\nfrom sys import version_info\nfrom PIL.ImageTk import PhotoImage\nif version_info.major >= 3: # Python3\n import tkinter as tk\nelse: # Python 2\n...
python
chosen
[ { "from": "human", "value": "Add Filter that display normal vector (it needs the pre-computed normal vectors)\n" }, { "from": "gpt", "value": "from vtk import vtkArrowSource, vtkGlyph3D, vtkPolyData\nfrom vtk import vtkRenderer, vtkRenderWindowInteractor, vtkPolyDataMapper, vtkActor, vtkRenderWi...
python
chosen
[ { "from": "human", "value": "[client] Add basic dacapo wallclock analyzer.\n\nSigned-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>\n" }, { "from": "gpt", "value": "import re\n\nBENCHMARKS = set(( 'avrora'\n , 'batik'\n , 'ec...
python
chosen
[ { "from": "system", "value": "Make sure the application doesn't continue without a config\n" }, { "from": "human", "value": "import os\nfrom twisted.internet import reactor\nfrom heufybot import HeufyBot, HeufyBotFactory\nfrom config import Config\n\nclass BotHandler(object):\n factories = {}...
python
chosen
[ { "from": "human", "value": "Sort events by date, add missing migration\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('gen...
python
chosen
[ { "from": "human", "value": "Add test by selenium builder\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom selenium.webdriver.firefox.webdriver import WebDriver\nfrom selenium.webdriver.common.action_chains import ActionChains\nimport time, unittest\n\ndef is_alert_present(wd):\n ...
python
chosen
[ { "from": "human", "value": "Add tests for OrderedSet type.\n" }, { "from": "gpt", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright own...
python
chosen
[ { "from": "human", "value": "Add conf file for Welcome Point Dusseldorf, DE\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Ideaxbox for Welcome Point, Dusseldorf\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_NAME = u\"Wel...
python
chosen
[ { "from": "human", "value": "Move relevant parts of ID mapping from covid-19\n" }, { "from": "gpt", "value": "from indra.databases import chebi_client\nfrom indra.ontology.standardize import standardize_db_refs\n\n\nminerva_to_indra_map = {\n 'UNIPROT': 'UP',\n 'REFSEQ': 'REFSEQ_PROT',\n ...
python
chosen
[ { "from": "human", "value": "Add int. maritime org. number (IMO)\n\nThis adds checks for the International Maritime Organization number used\nto identify ships. However, there seem to be a lot of ships with an IMO\nnumber that does not follow these rules (different check digits or even\nlength).\n" }, {...
python
chosen
[ { "from": "human", "value": "Add compiled cycle detect ui.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file '.\\cycledetect.ui'\n#\n# Created by: PyQt4 UI code generator 4.11.4\n#\n# WARNING! All changes made in this file will be lo...
python
chosen
[ { "from": "human", "value": "Add tests for prefix Q expression\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom django.db.models import Q\n\nfrom binder.views import prefix_q_expression\nfrom binder.permissions.views import is_q_child_equal\n\nfrom .testapp.models import An...
python
chosen
[ { "from": "human", "value": "Add 'includeme' function. (Accidently put in SQLAHelper.)\n" }, { "from": "gpt", "value": "from akhet.static import add_static_route\n\ndef includeme(config):\n \"\"\"Add certain useful methods to a Pyramid ``Configurator`` instance.\n\n Currently this adds the...
python
chosen
[ { "from": "human", "value": "Add a new fonttools based tool\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\nfrom fontTools import ttLib\nfrom fontTools.ttLib.tables import otTables\nfrom argparse import ArgumentParser\n\nparser = ArgumentParser()\nparser.add_argument('infont', help='Input ...
python
chosen
[ { "from": "human", "value": "Add a unittest dedicated to the numpy_core_fromnumeric brain\n" }, { "from": "gpt", "value": "# -*- encoding=utf-8 -*-\n# Copyright (c) 2017-2018 hippo91 <guillaume.peillex@gmail.com>\n\n# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en...
python
chosen
[ { "from": "human", "value": "Add chrooting test (requires vagrant environment)\n" }, { "from": "gpt", "value": "import os\nimport platform\nimport tempfile\nfrom .test_utils import EnvironmentTestCase\n\n_EXPECTED_FILE_IN_MOUNT_NAME = \"{mount_name}_file\"\n\nclass ChrootingTestCase(EnvironmentT...
python
chosen
[ { "from": "human", "value": "Test tourney match comments retrieval as JSON\n" }, { "from": "gpt", "value": "\"\"\"\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nimport pytest\n\nfrom byceps.services.tourney import match_comment_service, ...
python
chosen
[ { "from": "human", "value": "Add a script to download the mammal super tree\n" }, { "from": "gpt", "value": "#retriever\nfrom retriever.lib.templates import DownloadOnlyTemplate\n\nSCRIPT = DownloadOnlyTemplate(name=\"Mammal Super Tree\",\n shortname='mammsupertree',...
python
chosen
[ { "from": "human", "value": "Add experimental version of 'Draw a square' :fire:\n" }, { "from": "gpt", "value": "from nxt.motor import PORT_A, PORT_B, PORT_C\nfrom .helpers.robot import Robot, SERVO_NICE\n\n\ndef main():\n robot = Robot(debug=True, verbose=True)\n\n # Motors\n robot.ini...
python
chosen
[ { "from": "human", "value": "Add a very weak test of the Reaction API.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport dirty_water\n\nrxn = dirty_water.Reaction()\nrxn.num_reactions = 10\n\nrxn['Cas9'].std_volume = 1, 'μL'\nrxn['Cas9'].std_stock_conc = 20, 'μM'\nrxn['Cas9'].mas...
python
chosen
[ { "from": "human", "value": "Add tests for the symbolic ranges\n" }, { "from": "gpt", "value": "\"\"\"Tests for the range class.\"\"\"\n\nfrom sympy import sympify\n\nfrom drudge import Range\n\n\ndef test_range_has_basic_operations():\n \"\"\"Test the basic operations on ranges.\"\"\"\n\n ...
python
chosen
[ { "from": "human", "value": "Add receiving widget for lite gui\n" }, { "from": "gpt", "value": "from PyQt4.QtGui import *\nfrom PyQt4.QtCore import *\nfrom i18n import _\n\nclass ReceivingWidget(QTreeWidget):\n\n def toggle_used(self):\n if self.hide_used:\n self.hide_used =...
python
chosen
[ { "from": "human", "value": "Add search index file - currently search across Articles, extend to search across Categories?\n" }, { "from": "gpt", "value": "from haystack.indexes import *\nfrom haystack import site\nfrom models import Article\n\nclass ArticleIndex(SearchIndex):\n name = CharFi...
python
chosen
[ { "from": "human", "value": "Add py solution for 452. Minimum Number of Arrows to Burst Balloons\n\n452. Minimum Number of Arrows to Burst Balloons: https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/\n" }, { "from": "gpt", "value": "from operator import itemgetter\nclass S...
python
chosen
[ { "from": "human", "value": "Add a very simple test case for posix file support.\n" }, { "from": "gpt", "value": "\nimport sys\n\nimport nose.tools\n\nfrom simuvex import SimState\n\ndef test_file_create():\n # Create a state first\n state = SimState(arch=\"AMD64\", mode='symbolic')\n\n ...
python
chosen
[ { "from": "human", "value": "Add script to email users of name-conflicting packages.\n\n\ngit-svn-id: 757818eefc3e095bf4f5c16d67ad3f55b5150c3d@532 072f9a9a-8cf7-0310-8ca5-bf92c90cb7c1\n" }, { "from": "gpt", "value": "import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt\nimport stor...
python
chosen
[ { "from": "human", "value": "Add script to extract input from testcases.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport sys\n\nif len(sys.argv) != 2:\n sys.exit(\"Usage:\\n\\t%s <testcase>\" % (sys.argv[0],))\n\ntestcase = sys.argv[1]\n\nexec(open(testcase).read())\nfor i i...
python
chosen
[ { "from": "human", "value": "Add a test for the api-basket-add-voucher view\n" }, { "from": "gpt", "value": "from django.utils import timezone\n\nfrom oscar.core.loading import get_model\n\nfrom oscarapi.tests.utils import APITest\n\n\nBasket = get_model('basket', 'Basket')\nConditionalOffer = g...
python
chosen
[ { "from": "human", "value": "Add py solution for 720. Longest Word in Dictionary\n\n720. Longest Word in Dictionary: https://leetcode.com/problems/longest-word-in-dictionary/\n" }, { "from": "gpt", "value": "class Solution(object):\n def longestWord(self, words):\n \"\"\"\n :typ...
python
chosen
[ { "from": "human", "value": "Add ELO algorithm code, with small tests.\n" }, { "from": "gpt", "value": "##\n# elo.py\n# provides implementation of ELO algorithm to determine\n# change in fitness given a malicious act of nature.\n##\n\n\nK_FACTOR = 50 # weighting factor. The larger the more signi...
python
chosen
[ { "from": "human", "value": "Add basic backend loading function\n" }, { "from": "gpt", "value": "# Author: Milan Kubik, 2017\n\nimport logging\n\nfrom pkg_resources import iter_entry_points\n\nRESOURCE_GROUP = \"ipaqe_provision_hosts.backends\"\n\nlog = logging.getLogger(__name__)\n\n\ndef load_...
python
chosen
[ { "from": "human", "value": "Add a script to check motor (and communication!)\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n#\n# Copyright (c) 2013 Nautilabs\n#\n# Licensed under the MIT License,\n# https://github.com/baptistelabat/robokite\n# Authors: Baptiste ...
python
chosen
[ { "from": "human", "value": "Add a simple test for the command line interface.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport pytest\nfrom click.testing import CliRunner\n\nfrom compaction import cli\n\n\n@pytest.fixture\ndef response():\n \"\"\"Sample pytest fixture.\n\n S...
python
chosen
[ { "from": "human", "value": "Add a PES basic demo.\n" }, { "from": "gpt", "value": "import numpy as np\nimport benchfunk\nimport reggie\n\nimport mwhutils.plotting as mp\nimport mwhutils.grid as mg\n\nfrom pybo import inits\nfrom pybo import policies\nfrom pybo import solvers\nfrom pybo import r...
python
chosen
[ { "from": "human", "value": "feat: Add simple web server for testing Neuroglancer with local data\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# @license\n# Copyright 2017 Google Inc.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file exc...
python
chosen
[ { "from": "human", "value": "Add script to copy overlay from one dataset to another\n" }, { "from": "gpt", "value": "\"\"\"Copy overlay from one dataset to a derived dataset.\"\"\"\n\nimport click\n\nimport dtoolcore\n\n\ndef ensure_uri(path_or_uri):\n\n if ':' in path_or_uri:\n return...
python
chosen
[ { "from": "human", "value": "Resolve API import issues (quantum)\n\nRestore the imports in the api init file, without including the \"from\"\nto ensure api calls still must specify \"api.nova\", \"api.quantum\", etc.\n\nFixes bug #1125632\n\nChange-Id: I981105ce0ed7f1352de42fe2c0620665ba378823\n" }, { ...
python
chosen
[ { "from": "human", "value": "Add currently-incorrect day 6 part 1\n" }, { "from": "gpt", "value": "import re\nfrom numpy import matrix\n\n\ninstructions = []\n\nwith open('input.txt', 'r') as f:\n regex = re.compile(r'([\\w ]+) (\\d+),(\\d+) .+ (\\d+),(\\d+)')\n for line in f:\n mat...
python
chosen
[ { "from": "human", "value": "Add script to migrate data to certificatesubscription table\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.apps import apps\n\ndef populate_subscriptions(apps)...
python
chosen
[ { "from": "human", "value": "Add initial testing module for cloud creation\n" }, { "from": "gpt", "value": "'''\nThe generic libcloud template used to create the connections and deploy the\ncloud virtual machines\n'''\n\n# Import python libs\nimport os\nimport tempfile\nimport shutil\n\n#\n# Imp...
python
chosen
[ { "from": "human", "value": "Add simple unit test for optimize module\n" }, { "from": "gpt", "value": "import unittest\n\nimport numpy as np\n\nfrom desisurvey.optimize import *\n\n\nclass TestUtils(unittest.TestCase):\n\n def test_wrap_unwrap(self):\n x = np.linspace(0., 350., 97)\n ...
python
chosen
[ { "from": "human", "value": "Add circle transform script that may be useful for OCR\n" }, { "from": "gpt", "value": "# License: Public Domain\n# (C) 2014 Toshimitsu Kimura\n\nimport sys\nimport cv2\nimport numpy as np\nimport math\n\ndef main():\n if len(sys.argv) != 3:\n print \"./cir...
python
chosen
[ { "from": "human", "value": "Implement part of the s3 csv into interface\n" }, { "from": "gpt", "value": "from __future__ import print_function, division, absolute_import\n\nfrom into import discover, CSV, resource, convert\nimport pandas as pd\nfrom ..utils import cls_name\nfrom toolz import me...
python
chosen
[ { "from": "human", "value": "Add unit test to see if pegasus-service imports are succesful\n" }, { "from": "gpt", "value": "# Copyright 2007-2014 University Of Southern California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in co...
python
chosen
[ { "from": "human", "value": "Add simple script that changes floating points in genesis.json to ints\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\ndef isfloat(value):\n try:\n float(value)\n return True\n except ValueError:\n return False\n\nimport sys\n\nif len(sys.argv) == 3:...
python
chosen
[ { "from": "human", "value": "Add a command to clean attachments\n" }, { "from": "gpt", "value": "from pathlib import Path\n\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nfrom geotrek.common.models import Attachment\nfrom easy_thumbnails.models import T...
python
chosen
[ { "from": "human", "value": "Bring in timeit, and implicitly overclock with freq\n" }, { "from": "gpt", "value": "from medea import Tokenizer\nfrom examples.scripts import timeit\n\ndef run():\n source = open('examples/data/weathermap.json')\n tokenizer = Tokenizer(source)\n\n for tok, ...
python
chosen
[ { "from": "human", "value": "Add migration for deleted gunk\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-07-13 00:00\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n de...
python
chosen
[ { "from": "human", "value": "TST: Test fit funcs for full_output = False\n" }, { "from": "gpt", "value": "from numpy.testing import assert_\nfrom statsmodels.base.model import (_fit_mle_newton, _fit_mle_nm,\n _fit_mle_bfgs, _fit_mle_cg,\n ...
python
chosen
[ { "from": "human", "value": "Add a simple performance plotting tool.\n" }, { "from": "gpt", "value": "\"\"\"\n@author: Bryan Silverthorn <bcs@cargo-cult.org>\n\"\"\"\n\nif __name__ == \"__main__\":\n from borg.tools.plot_performance import main\n\n raise SystemExit(main())\n\nfrom cargo.lo...
python
chosen
[ { "from": "human", "value": "Add a migration to remove Member.rw\n" }, { "from": "gpt", "value": "# Generated by Django 3.2.4 on 2021-07-22 14:39\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('accounts', '0041_fill_role'),\n ...
python
chosen
[ { "from": "human", "value": "Add missed exception module. Ooops.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2013 Alexander Shorin\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part ...
python
chosen