conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "refactor: Use FrappeTestCase as it rolls back test data\n" }, { "from": "human", "value": "import unittest\n\nimport frappe\nfrom frappe.boot import get_unseen_notes\nfrom frappe.desk.doctype.note.note import mark_as_seen\n\n\nclass TestBootData(unittest.TestCase):\...
python
chosen
[ { "from": "system", "value": "Increase testing coverage of grammar\n\n* added some sample sentences with ajectives\n" }, { "from": "human", "value": "import nose\n\nfrom parser_tool import get_parser, parse\n\nsentences = (\n # N[s] V[i]\n \"Brad drives\",\n # N[s] V[t] N[p]\n \"Ange...
python
chosen
[ { "from": "system", "value": "Make pvs in Element behave more realistically.\n" }, { "from": "human", "value": "import pkg_resources\npkg_resources.require('cothread')\nimport cothread\nimport rml.element\n\n\ndef test_create_element():\n e = rml.element.Element('BPM', 6.0)\n assert e.get_...
python
chosen
[ { "from": "system", "value": "Remove unreproducible test\n(sleep is too inaccurate)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_process\n----------------------------------\n\nTests for process management.\n\"\"\"\n\n# system imports\nimport u...
python
chosen
[ { "from": "system", "value": "Use abstract.Abstract instead of Base alias when testing pygrapes.serializer.abstract.Abstract class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n##\n# hack for loading modules\n#\nimport _path\n_path.fix()\n\n##\n# python sta...
python
chosen
[ { "from": "system", "value": "Remove the errror intentionally left for debugging\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nProject Core Application Classes\n\n\"\"\"\n\n__author__ = \"Gavin M. Roy\"\n__email__ = \"gavinmroy@gmail.com\"\n__date__ = \"2009-11-10\"\n__...
python
chosen
[ { "from": "system", "value": "Make a direct call to glance-api using requests\n\nThis change makes this check no longer use the glanceclient tool so\nwe can craft a request that doesn't hit the glance-registry. The\nreason for this is that the glance-registry itself is tested in a\ndifferent check and ther...
python
chosen
[ { "from": "system", "value": "indexes: Fix acceptance test for MongoDB 2.0\n\nThere were some minor changes for the test to work properly\nwith 2.0:\n\n- The index versions are now 1 instead of 0\n Don't bother checking the version of index since scalymongo has no\n\tcontrol over it.\n\n- The `unique` ke...
python
chosen
[ { "from": "system", "value": "Migrate database for small update\n" }, { "from": "human", "value": "import os\n\nfrom fabric.api import *\n\nbase_path = os.path.dirname(__file__)\nproject_root = \"~/Gather\"\npip_path = os.path.join(project_root, \"bin/pip\")\npython_path = os.path.join(project_r...
python
chosen
[ { "from": "system", "value": "Add tensorboard serializer\n * Add validation\n * Add tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function\n\nfrom django.core.exceptions import ValidationError\nfrom polyaxon_schemas.exce...
python
chosen
[ { "from": "system", "value": "Increase the pagination amount for blog app\n" }, { "from": "human", "value": "\"\"\"\nBlog App\n\nThis module provides generic django URL routing.\n\n\"\"\"\nfrom django.conf.urls import patterns, url\n\nfrom tunobase.blog import views\n\nurlpatterns = patterns('',...
python
chosen
[ { "from": "system", "value": "Add storage bucket to run() call" }, { "from": "human", "value": "# Copyright 2020 Google LLC. All Rights Reserved.\r\n#\r\n# Licensed under the Apache License, Version 2.0 (the \"License\");\r\n# you may not use this file except in compliance with the License.\r\n#...
python
chosen
[ { "from": "system", "value": "Add a wrapper to get just stdout back\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom subprocess import Popen, PIPE\n\n\ndef _popen(cmd):\n \"\"\"\n Fork the specified command, returning a tuple of (stdout, stderr)\n \"\"\"\n return Pop...
python
chosen
[ { "from": "system", "value": "Use the right icon for the mirror tool\n" }, { "from": "human", "value": "from . import MirrorTool\n\ndef getMetaData():\n return {\n 'type': 'tool',\n 'plugin': {\n 'name': 'Mirror Tool'\n },\n 'tool': {\n 'name'...
python
chosen
[ { "from": "system", "value": "Fix for the tests, not complaining allowed about set_interactive not being used.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014, Vispy Development Team.\n# Distributed under the (new) BSD License. See LICENSE.txt for more info.\n\n\...
python
chosen
[ { "from": "system", "value": "Raise ImportError when GRS is used without dependency\n" }, { "from": "human", "value": "import hashlib\n\nimport groestlcoin_hash\n\nfrom pycoin.encoding.hexbytes import bytes_as_revhex\n\n\ndef sha256(data):\n return bytes_as_revhex(hashlib.sha256(data).digest(...
python
chosen
[ { "from": "system", "value": "Add simple Attempt submit test\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom rest_framework.test import APIClient\nfrom users.model...
python
chosen
[ { "from": "system", "value": "Add list_displays for Admin views\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom import_export import resources\nfrom import_export.admin import ImportExportModelAdmin\n\nfrom mendel.models import Keyword, Category, Document, Context, Revi...
python
chosen
[ { "from": "system", "value": "Exit cleanly from 'git webdiff'\n\n- Don't allow a KeyboardInterrupt/sigint exception propagate up\n to the user when exiting webdiff with Ctrl-C\n" }, { "from": "human", "value": "#!/usr/bin/env python\n'''This lets you run \"git webdiff\" instead of \"git difftoo...
python
chosen
[ { "from": "system", "value": "Update ILAMB BMI to use Configuration\n\nI also set ILAMB_ROOT and MPLBACKEND at `initialize`. Not sure if\nthere's a better location.\n" }, { "from": "human", "value": "#! /usr/bin/env python\nimport sys\nimport subprocess\nfrom basic_modeling_interface import Bmi\...
python
chosen
[ { "from": "system", "value": "Return title numbers in disc and track order, increment disc number if duplicated track number\n" }, { "from": "human", "value": "from .BaseIndexEntry import BaseIndexEntry\n\n\nclass AlbumIndexEntry(BaseIndexEntry):\n\n def __init__(self, name, titles, number):\...
python
chosen
[ { "from": "system", "value": "Correct a workaround for PyPy\n" }, { "from": "human", "value": "from array import array\nfrom typing import Any, ByteString, Collection, Iterable, Mapping, Text, ValuesView\n\n\n__all__ = [\"is_collection\", \"is_iterable\"]\n\ncollection_types: Any = [Collection]\...
python
chosen
[ { "from": "system", "value": "Fix bug where timezone was not used for xaxis.\n" }, { "from": "human", "value": "from __future__ import print_function, division\nimport matplotlib.pyplot as plt\nimport matplotlib.dates as mdates\nimport numpy as np\n\n_to_ordinalf_np_vectorized = np.vectorize(mda...
python
chosen
[ { "from": "system", "value": "Fix typo in login_required decorator\n" }, { "from": "human", "value": "from functools import update_wrapper\nfrom flask import session, redirect, flash\nimport auth\n\ndef login_required(permission=None):\n '''\n Login required decorator. Requires user to be logg...
python
chosen
[ { "from": "system", "value": "Add testcase with exception handler spread across functions.\n" }, { "from": "human", "value": "# nested try's\n\ntry:\n print(\"try 1\")\n try:\n print(\"try 2\")\n foo()\n except:\n print(\"except 2\")\n bar()\nexcept:\n print(\...
python
chosen
[ { "from": "system", "value": "Patch missing method on cgi package\n" }, { "from": "human", "value": "from operator import itemgetter\nfrom itertools import chain\nfrom typing import List\n\nfrom ...utils.py3_hook import with_hook\n\nwith with_hook():\n from arcrest import Catalog\nimport nump...
python
chosen
[ { "from": "system", "value": "Fix issue with HP ProCurve stacks and multiple hit enter to continue messages\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom __future__ import unicode_literals\nimport re\nimport time\nfrom netmiko.cisco_base_connection import CiscoSS...
python
chosen
[ { "from": "system", "value": "Add persistance of session across requests\n" }, { "from": "human", "value": "import requests\n\npayload = {'session':{'email':'david.armbrust@gmail.com','password':'Ovation1'}}\n\nr = requests.post('http://localhost:3000/login', json=payload)\n\nprint r.status_code...
python
chosen
[ { "from": "system", "value": "Change reports URLs to extend from /children/<slug>.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^reports/changes/lifetim...
python
chosen
[ { "from": "system", "value": "Remove test of two-argument normalize function.\n" }, { "from": "human", "value": "from move import load_moves, encode_moves, normalize_index, move\nimport unittest\n\nclass TestMove(unittest.TestCase):\n def setUp(self):\n self.moves = ['ULL', 'RRDDD', 'L...
python
chosen
[ { "from": "system", "value": "Add coverage for content pages functionality\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.urls import reverse\n\nfrom conte...
python
chosen
[ { "from": "system", "value": "Improve how we abort MPI runs.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\n\nfrom mpi4py import MPI\n\nfrom excepthook import excepthook\n\n\ndef init():\n MPI.Init_thread()\n MPI.COMM_WORLD.barrier()\n\n\ndef atexit():\n if not...
python
chosen
[ { "from": "system", "value": "Kill dad code for old compiler\n" }, { "from": "human", "value": "import fetchparser\n\ndef print_parsed():\n for line in fetchparser.parse_input(open(\"sample.fetch\").read()):\n print line\n\ndef print_lexed():\n import fetchlexer\n l=fetchlexer.ge...
python
chosen
[ { "from": "system", "value": "Add an extra check in that test\n" }, { "from": "human", "value": "import pytest\nimport allegedb\n\n\n@pytest.fixture(scope='function')\ndef orm():\n with allegedb.ORM(\"sqlite:///:memory:\") as it:\n yield it\n\n\ndef test_single_plan(orm):\n g = orm....
python
chosen
[ { "from": "system", "value": "Set default ordering for user and group API endpoints\n" }, { "from": "human", "value": "from django.contrib.auth.models import Group, User\nfrom django.db.models import Count\n\nfrom users import filters\nfrom users.models import ObjectPermission\nfrom utilities.ap...
python
chosen
[ { "from": "system", "value": "Add Slack token validation to handler\n" }, { "from": "human", "value": "#!/usr/bin/python2.7\nimport json\nimport kartlogic.rank\nimport logging\nimport prettytable\nimport util.web\nimport util.slack\n\n\ndef handler(event, context):\n logging.warning(event['bo...
python
chosen
[ { "from": "system", "value": "Fix EventLoggerAdapter to work on py2.6\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nimport logging\n\n\nclass EventLoggerAdapter(logging.LoggerAdapter):\n \"\"\"\n LoggerAdapter\n \"\"\"\n\n def __init__...
python
chosen
[ { "from": "system", "value": "Cover the \"__debug__\" attribute as well.\n" }, { "from": "human", "value": "# Copyright 2012, Kay Hayen, mailto:kayhayen@gmx.de\n#\n# Python tests originally created or extracted from other peoples work. The\n# parts were too small to be protected.\n#\...
python
chosen
[ { "from": "system", "value": "Add a command line option for number of sides.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\nfrom twisted.internet import reactor, defer\nfrom twisted.internet.protocol import ClientCreator\nfrom twisted.protocols import amp\nfrom twisted...
python
chosen
[ { "from": "system", "value": "Replace customzied test failure assertion with ResultReasonRE from engine\n\nThis change is to facilitate the annotation protocol -> luciexe protocol\nmigration in the future. The failure response structure will be changed\nafter the migration. Therefore, we only need to change...
python
chosen
[ { "from": "system", "value": "Add traces if there is no JSON-LD while it was expected\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport json\nimport re\n\nfrom udata.tests import TestCase, WebTestMixin, SearchTestMixin\n\nfrom udata imp...
python
chosen
[ { "from": "system", "value": "Comment out South Cambridgeshire election id\n\nUpdate provided but queries to chase :(\n" }, { "from": "human", "value": "from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter\n\nclass Command(BaseXpressDemocracyClubCsvImporter):\n c...
python
chosen
[ { "from": "system", "value": "Update with last version of pymfony\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# This file is part of the pymfony package.\n#\n# (c) Alexandre Quercia <alquerci@email.com>\n#\n# For the full copyright and license information, please view the LICENSE...
python
chosen
[ { "from": "system", "value": "Fix migration: don't use virtual field scope.\n" }, { "from": "human", "value": "from django.db import migrations\n\n\ndef fill_tenant_id(apps, schema_editor):\n ServiceSettings = apps.get_model('structure', 'ServiceSettings')\n for service_settings in Service...
python
chosen
[ { "from": "system", "value": "Modify generated category form field instead of reinitialize it\n\nThe category fields had not been translated as the field had been\nreinitialized instead of modified. With this PR the auto generated field\n(with its localized verbose_name) will be kept and adapted to the\nfil...
python
chosen
[ { "from": "system", "value": "Fix bug with arguments handling in JSON API content decorator\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom boltons.iterutils import first\n\nfrom .context import RequestContext\nfrom .errors import HTTPUnsupportedMediaType\nfrom .const impo...
python
chosen
[ { "from": "system", "value": "Set $NBGALLERY_URL to override gallery location\n" }, { "from": "human", "value": "import sys\nsys.path.append('/root/.jupyter/extensions/')\n\nc.JupyterApp.ip = '*'\nc.JupyterApp.port = 80\nc.JupyterApp.open_browser = False\nc.JupyterApp.allow_credentials = True\nc...
python
chosen
[ { "from": "system", "value": "Reduce the runtime of webapp api\n" }, { "from": "human", "value": "__author__ = 's7a'\n\n# All imports\nfrom extras import Sanitizer\nfrom replacer import Replacer\n\n\n# The Lexical simplification class\nclass LexicalSimplifier:\n\n # Constructor for the Lexica...
python
chosen
[ { "from": "system", "value": "Update drobox api urls h/t @felliott\n" }, { "from": "human", "value": "try:\n from waterbutler import settings\nexcept ImportError:\n settings = {}\n\nconfig = settings.get('DROPBOX_PROVIDER_CONFIG', {})\n\n\nBASE_URL = config.get('BASE_URL', 'https://api.dro...
python
chosen
[ { "from": "system", "value": "Revert \"allow to write Text with raw data\"\n\nThis reverts commit d05df9ea67bc626adc7a4940c9bad4881d672a38.\n" }, { "from": "human", "value": "\r\nimport os, shutil, tempfile\r\nfrom bl.file import File\r\nfrom bl.string import String\r\n\r\nclass Text(File):\r\n\...
python
chosen
[ { "from": "system", "value": "Fix bench error on scipy import when nose is not installed\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@3851 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "''' Null tester (when nose not importable)\n\nMerely returns error reporti...
python
chosen
[ { "from": "system", "value": "Update for compatibility with pyes==0.19.1\n" }, { "from": "human", "value": "from flask import g\n\nfrom annotator.annotation import Annotation as Annotation_\nfrom annotator.authz import permissions_filter\n\nclass Annotation(Annotation_):\n\n @classmethod\n ...
python
chosen
[ { "from": "system", "value": "Add save_config for brocade VDX\n" }, { "from": "human", "value": "\"\"\"Support for Brocade NOS/VDX.\"\"\"\nfrom __future__ import unicode_literals\nimport time\nfrom netmiko.cisco_base_connection import CiscoSSHConnection\n\n\nclass BrocadeNosSSH(CiscoSSHConnectio...
python
chosen
[ { "from": "human", "value": "Add PriceRule class and init method.\n" }, { "from": "gpt", "value": "class PriceRule:\n \"\"\"PriceRule is a rule that triggers when a stock price satisfies a condition.\n\n The condition is usually greater, equal or lesser than a given value.\n \"\"\"\n\n ...
python
chosen
[ { "from": "system", "value": "Build out set function of hash table class; still need to deal with outcome of setting multiple values to same key\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''Implementation of a simple hash table.\nThe table has `hash`, `get` and `set` methods.\n...
python
chosen
[ { "from": "system", "value": "Allow port to be changed\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nimport os\nimport sys\nfrom logging.config import fileConfig\nfrom wsgiref.simple_server import make_server\n\nfrom paste.deploy import loadapp\n\n\nhostname = 'localhost'\nport...
python
chosen
[ { "from": "system", "value": "Fix inaccuracy in test comment, since jedi now does the right thing\n" }, { "from": "human", "value": "\"\"\"\nThis is a module that imports the *standard library* unittest,\ndespite there being a local \"unittest\" module. It specifies that it\nwants the stdlib one...
python
chosen
[ { "from": "system", "value": "Check for right kind of error in invalid creds test\n" }, { "from": "human", "value": "from oauthlib.oauth2 import InvalidClientError\nimport pytest\n\nfrom test import configure_mendeley, cassette\n\n\ndef test_should_get_authenticated_session():\n mendeley = co...
python
chosen
[ { "from": "system", "value": "Make connection pool less smart\n\nYou have to extend it and implement your own get_db function to use a\nconnection pool now\n" }, { "from": "human", "value": "from random import randrange\nimport time\nfrom storm import error\n\n\nclass Connection(object):\n de...
python
chosen
[ { "from": "system", "value": "Add unit test for is_safe_url utility function\n" }, { "from": "human", "value": "import unittest\n\nfrom app import create_app, db\nfrom app.utils import get_or_create\nfrom app.models import User\n\n\nclass TestUtils(unittest.TestCase):\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Fix failing Firefox Hello test\n" }, { "from": "human", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mozilla.org/MPL/2.0/....
python
chosen
[ { "from": "system", "value": "Fix bug in exception throwing (it caused an exception!).\n" }, { "from": "human", "value": "class BaseHandler(object):\n \"\"\"\n An abstract hanlder class to help define how a handler should behave. No\n methods are actually implemented and will raise a no...
python
chosen
[ { "from": "system", "value": "Allow quitting the application with SIGINT (Ctrl-C)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport util.colored_exceptions\nfrom gui import main_window\nfrom core import volumes, control\nfrom PySide import QtGui\nimport sys\nimport os\nimport ...
python
chosen
[ { "from": "system", "value": "Add some decorators to make life easier.\n" }, { "from": "human", "value": "class BotAI(object):\n\n def set_nickname(self, nickname):\n self.nickname = nickname\n\n def initialise(self, init_params_as_dict):\n pass\n\n def respond(self, sende...
python
chosen
[ { "from": "system", "value": "Change second ship controls to IJKL\n" }, { "from": "human", "value": "from pyglet.window import key\n\nPLAYER_SHIP_KEYS = dict(left=[key.A, key.LEFT], right=[key.D, key.RIGHT],\n thrust=[key.W, key.UP], fire=[key.S, key.DOWN])\nPLAYER_1_SHIP_...
python
chosen
[ { "from": "system", "value": "Add images to snapshot details\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom flask.ext.restful import reqparse\n\nfrom changes.api.base import APIView\nfrom changes.config import db\nfrom changes.db.utils import create_or_update\n...
python
chosen
[ { "from": "system", "value": "Update test according to factory usage\n" }, { "from": "human", "value": "from decimal import Decimal\nimport random\n\nfrom django.test import TestCase\n\nfrom .. import factories\nfrom ... import models\n\n\nclass PackageTemplateTest(TestCase):\n\n def test_pac...
python
chosen
[ { "from": "system", "value": "Add error handling for posts_per_page type conversion\n" }, { "from": "human", "value": "from app.models import Setting\n\n\nclass AppSettings(dict):\n def __init__(self):\n super().__init__()\n self.update({setting.name: setting.value for setting i...
python
chosen
[ { "from": "system", "value": "Use connection pool by default during testing\n" }, { "from": "human", "value": "import os\n\nCONNECT_ARGS = []\nCONNECT_KWARGS = {}\n\nLIVE_TEST = 'HOST' in os.environ\nif LIVE_TEST:\n HOST = os.environ['HOST']\n DATABASE = os.environ.get('DATABASE', 'test')\...
python
chosen
[ { "from": "system", "value": "Reset the base url matching regex to correctly reroute to the home page when provided an unknown url\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom brew_journal.views import IndexView\n\nfrom rest_framework_nested impo...
python
chosen
[ { "from": "system", "value": "Add error treatment for existing network\n" }, { "from": "human", "value": "\"\"\" Main class from dcclient. Manages XML interaction, as well as switch and\ncreates the actual networks\n\"\"\"\n\nimport rpc\nfrom xml_manager.manager import ManagedXml\n\n\nfrom oslo....
python
chosen
[ { "from": "system", "value": "Use a metaclass instead of dirty dict()-mangling.\n" }, { "from": "human", "value": "import re\nimport os\n\nfrom django.test import TestCase\n\nfrom .utils import get_template_dirs\n\nre_url = re.compile(r'\\shref=\"(?P<url>(?!https?:|mailto:|\\?|{|#)[^\"]*)\"')\n\...
python
chosen
[ { "from": "system", "value": "Fix submodule attribute check for Django 1.4 compatibility\n" }, { "from": "human", "value": "import imp\nfrom os import listdir\nfrom os.path import dirname, splitext\n\nfrom django.template import loaders\n\nMODULE_EXTENSIONS = tuple([suffix[0] for suffix in imp.g...
python
chosen
[ { "from": "system", "value": "tests: Update tests to use pytest instead of nose\n" }, { "from": "human", "value": "import nose\nfrom ckanapi import TestAppCKAN, ValidationError\nfrom ckan.tests import helpers, factories\n\neq_ = nose.tools.eq_\nassert_true = nose.tools.assert_true\n\n\nclass Tes...
python
chosen
[ { "from": "system", "value": "Add template support to getCurrentTheme\n" }, { "from": "human", "value": "import os\nimport os.path\nfrom . import database\n\nTHEME_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), \"../themes\"))\n\ndef getCurrentTheme():\n\tdatabaseConnection = dat...
python
chosen
[ { "from": "system", "value": "Update pre-deployed Ropsten contract addresses" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nUINT64_MAX = 2 ** 64 - 1\nUINT64_MIN = 0\n\nINT64_MAX = 2 ** 63 - 1\nINT64_MIN = -(2 ** 63)\n\nUINT256_MAX = 2 ** 256 - 1\n\nROPSTEN_REGISTRY_ADDRESS = 'bbc60a...
python
chosen
[ { "from": "system", "value": "Fix test case for WebSocketSubscriber\n\nSwitched to unittest-style testing (pytest is a bit too magical\nespecially with the pytest-tornado extension). I may change all\ntests later to use unittest.\n" }, { "from": "human", "value": "\"\"\"Tests for the WebSocketSu...
python
chosen
[ { "from": "system", "value": "Add tests for keyed hashes\n" }, { "from": "human", "value": "# Import nacl libs\nimport libnacl\n\n# Import python libs\nimport unittest\n\n\nclass TestGenericHash(unittest.TestCase):\n '''\n Test sign functions\n '''\n def test_keyless_generichash(self...
python
chosen
[ { "from": "system", "value": "Add test for stderr output from console\n" }, { "from": "human", "value": "import io\n\nimport spur\nfrom nose.tools import istest, assert_equal\n\nfrom toodlepip.consoles import Console\n\n\n@istest\ndef console_writes_output_to_console():\n console, output = _c...
python
chosen
[ { "from": "system", "value": "Fix REPL and add quit() command\n" }, { "from": "human", "value": "'''\nSample REPL code to integrate with Diesel\n\nUsing InteractiveInterpreter broke block handling (if/def/etc.), but exceptions\nwere handled well and the return value of code was printed.\n\nUsing...
python
chosen
[ { "from": "system", "value": "Update Python version in template\n\nI completely forgot about those templates too. I don't even remember\nwhat \"bp\" was supposed to stand for.\n" }, { "from": "human", "value": "# Python 3.6.1\n\ndef get_input():\n with open('input.txt', 'r') as f:\n re...
python
chosen
[ { "from": "system", "value": "Remove deprecated and broken pros help option\n" }, { "from": "human", "value": "import click\r\n\r\nimport proscli\r\nfrom proscli.utils import default_options\r\n\r\n\r\ndef main():\r\n # the program name should always be pros. don't care if it's not...\r\n ...
python
chosen
[ { "from": "system", "value": "Use game.queue.is_turn(name) to build player or enemies\n" }, { "from": "human", "value": "import logging\n\nfrom tile import Tile\nfrom mech import Mech, Enemy, Player\n\n\nclass World(object):\n\n def __init__(self, game):\n print(game.state)\n se...
python
chosen
[ { "from": "system", "value": "Add first filter relying on pkgdb integration" }, { "from": "human", "value": "# Generic filters for FMN\nimport fedmsg\n\n\ndef user_filter(config, message, fasnick=None, *args, **kw):\n \"\"\" All messages of user\n\n Use this filter to filter out messages t...
python
chosen
[ { "from": "system", "value": "Add function to get list of parameters\n" }, { "from": "human", "value": "\"\"\"Module for retrieving a GET request query parameter.\"\"\"\n\nfrom django.http import Http404\n\n\ndef retrieve_query_parameter(request, parameter, valid_options=None):\n \"\"\"Retrie...
python
chosen
[ { "from": "system", "value": "Change notifier interval: 20 -> 10\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom apscheduler.schedulers.blocking import BlockingScheduler\nimport logging\nimport subprocess\n\nlogging.basicConfig()\njob_defaults = {\n 'coalesce': ...
python
chosen
[ { "from": "system", "value": "Remove base/hidden/probe data file paths (data_io isn't writing split data to files)\n" }, { "from": "human", "value": "import os\n\n\nROOT_DIR_PATH = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))\n\nDATA_DIR_PATH = os.path.join(ROOT_DIR_PATH, 'data')\...
python
chosen
[ { "from": "system", "value": "Fix day 8 to paint front-to-back\n" }, { "from": "human", "value": "from collections import Counter\nfrom typing import Iterable, TextIO\n\nimport numpy # type: ignore\n\n\ndef parse_layers(width: int, height: int, data: TextIO) -> Iterable[numpy.array]:\n chunk...
python
chosen
[ { "from": "system", "value": "Fix unicode support in ExecEngine\n" }, { "from": "human", "value": "import subprocess\nfrom functools import wraps\n\n\nclass EngineProcessFailed(Exception):\n pass\n\n\nclass BaseEngine(object):\n\n result_mimetype = None\n\n @classmethod\n def as_engi...
python
chosen
[ { "from": "system", "value": "Use dialogue terminology in menu\n" }, { "from": "human", "value": "from django import forms\n\n\nclass CampaignGeneralForm(forms.Form):\n\n TYPE_CHOICES = (\n ('', 'Select campaign type'),\n ('B', 'Bulk Message'),\n ('C', 'Conversation'),\n ...
python
chosen
[ { "from": "system", "value": "Add a __repr__ for CodeSearchResult\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom github3.models import GitHubCore\nfrom github3.repos import Repository\n\n\nclass CodeSearchResult(GitHubCore):\n def __init__(self, data, session=None):\n ...
python
chosen
[ { "from": "system", "value": "Fix a failing test for PasswordResetSerializer\n\nIt seems that Django's template API changed. This should adjust to that.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom django.conf import settings\nfrom dja...
python
chosen
[ { "from": "system", "value": "Fix settings; tests now passing\n" }, { "from": "human", "value": "from . import model\nfrom . import routes\nfrom . import views\n\nMODELS = [model.AddonDropboxUserSettings] # TODO Other models needed? , model.AddonDropboxNodeSettings, model.DropboxGuidFile]\nUSER...
python
chosen
[ { "from": "system", "value": "Fix python path for windows\n" }, { "from": "human", "value": "import os\nimport re\n\nfrom helper import *\nimport unix_windows\n\n\nsection(\"Preparing virtualenv\")\n\n# check that virtualenv installed\nif not executable_exists('virtualenv'):\n fail(\"\"\"\\\n...
python
chosen
[ { "from": "system", "value": "Read config file in different locations and set global config variables based on that.\n" }, { "from": "human", "value": "\"\"\"Client global settings.\"\"\"\n\nHOST = 'api.snowfloat.com:443'\nHTTP_TIMEOUT = 10\nHTTP_RETRIES = 3\nHTTP_RETRY_INTERVAL = 5\n\nAPI_KEY =...
python
chosen
[ { "from": "system", "value": "Fix bug with exception never handled in once_at_a_time coroutines\n" }, { "from": "human", "value": "import asyncio\nimport functools\nimport logging\n\n\ndef cancel_once_task(object, fn):\n if getattr(object, \"__tasks\", None):\n tasks = getattr(object, ...
python
chosen
[ { "from": "system", "value": "Raise `ConfigurationError` instead of `Exception` if environment variable `BYCEPS_CONFIG` is not set\n" }, { "from": "human", "value": "\"\"\"\nbyceps.util.system\n~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE ...
python
chosen
[ { "from": "system", "value": "Update docstring with parameter listing\n" }, { "from": "human", "value": "'''\nExceptions from sqlstr\n-------------------------\n'''\n\n\nclass sqlstrException(Exception):\n def __init__(self, message):\n '''\n Instanitates a custom sqlstrExceptio...
python
chosen
[ { "from": "system", "value": "Reduce function, to stop nested lists\n" }, { "from": "human", "value": "if 'logger' not in globals():\n import logging\n\n logger = logging.getLogger('Main')\n logger.setLevel(logging.DEBUG)\n\n logger.propagate = False\n\n if not logger.handlers:\n ...
python
chosen
[ { "from": "system", "value": "Add more skeletonisms and documentation for Piper()\n" }, { "from": "human", "value": "class Piper(object):\n \"\"\"\n The main runner.\n\n This class loads the configurations, sets up all other components, and\n finally executes them in whatever order t...
python
chosen