conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Include comments in Role serializer\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom .models import Challenge, Role\n\nfrom core.serializers import UserSerializer\n\n\nclass RoleSerializer(serializers.ModelSerializer):\n #user = ser... | python | chosen |
[
{
"from": "system",
"value": "Fix no endline at end of file\n"
},
{
"from": "human",
"value": "####\n#### Check that counts for basic searches is within 10% of given counts\n####\n\nimport re, os, time\nimport ftplib\n\nfrom behave import *\nfrom selenium.webdriver.common.by import By\nfrom sele... | python | chosen |
[
{
"from": "system",
"value": "Add a PriceRule test if match is attempted when stock is not in the exchange.\n"
},
{
"from": "human",
"value": "from datetime import datetime\nfrom unittest import TestCase\n\nfrom rule import PriceRule\nfrom stock import Stock\n\n\nclass TestPriceRule(TestCase):\n... | python | chosen |
[
{
"from": "system",
"value": "Make brand and party available to tests.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom unittest import TestCase\n\nfrom byceps.application import create_app\nfrom byceps.blueprints.brand.models import Brand\nfrom byceps.blueprints.party.models i... | python | chosen |
[
{
"from": "system",
"value": "Use autoincrementing ID as primary key\n"
},
{
"from": "human",
"value": "from flask_login import UserMixin\nfrom werkzeug.security import generate_password_hash, check_password_hash\n\nclass User(UserMixin):\n \"\"\"Represents a user who can Create, Read, Update... | python | chosen |
[
{
"from": "system",
"value": "Remove hack from position angle test\n"
},
{
"from": "human",
"value": "from skyfield.api import Angle, Topos, load, load_file\nfrom skyfield.trigonometry import position_angle_of\n\ndef test_position_angle():\n a = Angle(degrees=0), Angle(degrees=0)\n b = Ang... | python | chosen |
[
{
"from": "system",
"value": "Add license, right comment and format code\n"
},
{
"from": "human",
"value": "# Example CI server that serves badges\n\nfrom flask import Flask\nimport pybadges\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef serveBadges():\n # First example\n badge_arg = d... | python | chosen |
[
{
"from": "system",
"value": "fix: Use new class name FileLookup\n\nSee also: #72\n"
},
{
"from": "human",
"value": "# Foremast - Pipeline Tooling\n#\n# Copyright 2016 Gogo, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in... | python | chosen |
[
{
"from": "system",
"value": "Update zstd version in test\n\nTo reflect the recent upgrade to 1.1.0."
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nimport zstd\n\nclass TestModuleAttr... | python | chosen |
[
{
"from": "system",
"value": "Make it work in PY3.5 *properly*"
},
{
"from": "human",
"value": "import threading\nimport unittest\n\nimport requests\n\nfrom dmoj.control import JudgeControlRequestHandler\n\ntry:\n from unittest import mock\nexcept ImportError:\n import mock\n\ntry:\n fr... | python | chosen |
[
{
"from": "system",
"value": "Remove blanket protection in preparation for granular access control.\n"
},
{
"from": "human",
"value": "# coding: utf-8\n# Copyright (c) 2011-2012 Aymeric Augustin. All rights reserved.\n\nfrom django.conf.urls import patterns, url\nfrom django.contrib.auth.decorat... | python | chosen |
[
{
"from": "system",
"value": "Use more recent socat version.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n\n__version__ = '0.3.10'\n\nDEFAULT_SOCAT_VERSION = '1.7.3.0'\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n... | python | chosen |
[
{
"from": "system",
"value": "Fix broken worker stub test\n\nSigned-off-by: Carter Landis <84a516841ba77a5b4648de2cd0dfcb30ea46dbb4@carterlandis.com>\n"
},
{
"from": "human",
"value": "import pytest\n\nimport workers.repo_info_worker.repo_info_worker.runtime as ri\n\ndef test_workers():\n # p... | python | chosen |
[
{
"from": "system",
"value": "Normalize naming scheme for protos in docstring\n"
},
{
"from": "human",
"value": "# Copyright 2022 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance... | python | chosen |
[
{
"from": "system",
"value": "Fix local import of the app\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\n\n@pytest.fixture\ndef basic_app():\n \"\"\"Fixture for a default app.\n\n Returns:\n :class:`{{cookiecutter.app_class_name}}`: App instance\n \"... | python | chosen |
[
{
"from": "system",
"value": "Check JSON syntax as part of tests\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"Test document formats for correctness\n\"\"\"\nfrom __future__ import absolute_import\n\nimport os\nimport os.path as op\nimport yaml\nimport pytest\nimport restru... | python | chosen |
[
{
"from": "system",
"value": "Change string formatting to use format\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom .. import abstract_models\nfrom ..manager import PageManager\n\n\nclass PageType(abstract_models.AbstractPageType):\n class Meta:\n app_label = '... | python | chosen |
[
{
"from": "system",
"value": "Set Texture minification/magnification filters to Linear\n\nThis improves the quality of textures that need to be rendered at a\nsmaller\nsize.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv... | python | chosen |
[
{
"from": "system",
"value": "Add a test for public names\n"
},
{
"from": "human",
"value": "from django.test import TestCase\n\n# Create your tests here.\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom .models import Event, Volunteer\n\n\nclass VolunteerTes... | python | chosen |
[
{
"from": "system",
"value": "Change total_score in Employee Serializer\n"
},
{
"from": "human",
"value": "from .models import Employee\nfrom rest_framework import serializers\n\n\nclass EmployeeSerializer(serializers.ModelSerializer):\n class Meta:\n model = Employee\n depth = ... | python | chosen |
[
{
"from": "system",
"value": "Fix ImportError if sqlalchemy not installed\n\nIf sqlalchemy isn't installed, this would try to import the sqlalchemy\nwrapper and then kick up an ImportError.\n\nThis changes it so that if there's an ImportError, it gets ignored.\n"
},
{
"from": "human",
"value": "... | python | chosen |
[
{
"from": "system",
"value": "Clean up imports in example\n"
},
{
"from": "human",
"value": "import logging\nimport flist\nfrom flist import opcode\nfrom twisted.internet import reactor\n\ndef log_status(data):\n logging.debug(\"{character} is {status}: {statusmsg}\".format(**data))\n\ndef on... | python | chosen |
[
{
"from": "system",
"value": "Support the Isles of Scilly\n"
},
{
"from": "human",
"value": "PARENT_TO_CHILD_AREAS = {\n 'DIS': ['DIW',],\n 'MTD': ['MTW',],\n 'CTY': ['CED',],\n 'LBO': ['LBW',],\n 'CED': ['CPC',],\n 'UTA': ['UTW', 'UTE'],\n 'NIA': ['NIE',],\n}\nCHILD_TO_PARE... | python | chosen |
[
{
"from": "system",
"value": "Convert copy_reg test to PyUnit.\n"
},
{
"from": "human",
"value": "import copy_reg\n\nclass C:\n pass\n\n\ntry:\n copy_reg.pickle(C, None, None)\nexcept TypeError, e:\n print \"Caught expected TypeError:\"\n print e\nelse:\n print \"Failed to catch e... | python | chosen |
[
{
"from": "system",
"value": "Correct Lithuanian short date format.\r\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n# This file is distributed under the same license as the Django package.\n#\n\n# The *_FORMAT strings use the Django date format syntax,\n# see http://docs.djangopr... | python | chosen |
[
{
"from": "system",
"value": "Improve test_bustimes speed by using mock\n"
},
{
"from": "human",
"value": "from flask import url_for\n\nfrom tests.base import SampleFrontendTestBase\n\n\nclass BpFeaturesTestCase(SampleFrontendTestBase):\n def test_bustimes_reachable(self):\n self.asser... | python | chosen |
[
{
"from": "system",
"value": "Install jupyter so people can follow along with notebooks\n"
},
{
"from": "human",
"value": "import subprocess\n\ndef run(command, *args, **kwargs):\n print(\"+ {}\".format(command))\n subprocess.run(command, *args, **kwargs)\n\nrun(\"git submodule update --in... | python | chosen |
[
{
"from": "system",
"value": "Update version 0.7.3 -> 0.7.4"
},
{
"from": "human",
"value": "# Copyright 2018 D-Wave Systems Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain... | python | chosen |
[
{
"from": "system",
"value": "Allow ODB without components on bottom\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport os.path\nfrom collections import namedtuple\nfrom .LineRecordParser import *\nfrom .SurfaceParser import *\nfrom .PolygonParser import *\nfrom .ComponentParser i... | python | chosen |
[
{
"from": "system",
"value": "Fix user role filtered namespace\n"
},
{
"from": "human",
"value": "\"\"\"\nCopyright 2016 ElasticBox All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may... | python | chosen |
[
{
"from": "system",
"value": "Add test case for set_schedule_log\n"
},
{
"from": "human",
"value": "import unittest\nfrom arrange_schedule import *\n\nclass Arrange_Schedule(unittest.TestCase):\n def setUp(self):\n # test_read_system_setting\n keys = ['board_py_dir','shutdown','... | python | chosen |
[
{
"from": "system",
"value": "Add json library for repr() calls\n"
},
{
"from": "human",
"value": "from lxml import html\n\n\nclass XPathObject(object):\n input_properties = {}\n \"\"\"Dict of keys (property names) and XPaths (to read vals from)\"\"\"\n\n @classmethod\n def FromHTML(... | python | chosen |
[
{
"from": "system",
"value": "Fix tests failing on long line"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nimport os\nimport tempfile\n\n__version__ = '0.1.11'\n\nDB = os.path.join(\n tempfile.gettempdir(),\n 'fake_use... | python | chosen |
[
{
"from": "system",
"value": "Add journal watcher unit to pod rules\n"
},
{
"from": "human",
"value": "from pathlib import Path\n\nimport shipyard2.rules.pods\n\nOPS_DB_PATH = Path('/srv/operations/database/v1')\n\nshipyard2.rules.pods.define_pod(\n name='database',\n apps=[\n shipy... | python | chosen |
[
{
"from": "system",
"value": "Add link from conversations to message batches.\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom go.contacts.models import Contact\n\n\nclass Conversation(models.Model):\n \"\"\"A conversation with an audience\"\"\"\n user = models.Foreign... | python | chosen |
[
{
"from": "system",
"value": "Make shell=True for the conda subprocess\n"
},
{
"from": "human",
"value": "import subprocess\nfrom os import unlink\nfrom os.path import realpath, islink, isfile, isdir\nimport sys\nimport shutil\nimport time\n\ndef rm_rf(path):\n if islink(path) or isfile(path)... | python | chosen |
[
{
"from": "system",
"value": "Fix python 2.7 (CFFI requires the use of the native open).\n"
},
{
"from": "human",
"value": "\nfrom __future__ import absolute_import, division, print_function, unicode_literals\nfrom builtins import open\n\nimport os.path\n\nfrom eccodes_grib import eccodes\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Fix bug to insert the bottle in mongoDB\n"
},
{
"from": "human",
"value": "import string\n\nclass CellarDAO(object):\n\n\t#Init class with mongo database\n\tdef __init__(self, database):\n\t\t\tself.db = database\n\t\t\tself.bottles = database.bottles\n\n\t#Get all ... | python | chosen |
[
{
"from": "system",
"value": "Change calculation for on air now\n"
},
{
"from": "human",
"value": "from django.utils import timezone\n\nfrom show.models import Show\n\n\ndef get_current_permitted_show(klass=Show):\n # does_not_repeat requires a datetime match. All the others operate on\n #... | python | chosen |
[
{
"from": "system",
"value": "Fix formatting in child sample to match other files\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom common import *\nimport sys, signal\n\n# Be naughty and ignore SIGTERM to simulate hanging child\nsignal.signal(signal.SIGTERM, signal.SIG_IGN)\n\n#... | python | chosen |
[
{
"from": "system",
"value": "Add active flag to entities\n"
},
{
"from": "human",
"value": "from kivy.uix.widget import Widget\nfrom kivy.core.window import Window\nfrom kivy.graphics import Ellipse\nfrom engine.entity import Entity\n\nclass BaseEntity(Widget, Entity):\n def __init__(self, i... | python | chosen |
[
{
"from": "system",
"value": "4: Create script to save documentation to a file \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4"
},
{
"from": "human",
"value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christop... | python | chosen |
[
{
"from": "system",
"value": "Fix direct assignment to the forward side of a many-to-many\n"
},
{
"from": "human",
"value": "\nfrom django.db import migrations\n\nPERM_INITIAL = {'wsparcie': ('can_add_record',\n 'can_change_own_record',\n '... | python | chosen |
[
{
"from": "system",
"value": "Fix path to gpio upstart script\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport subprocess\n\n\ndef main():\n # Install system dependencies\n subprocess.call([\"apt-get\", \"update\"])\n subprocess.call([\"apt-get\", \"-y\", \"upgrade\"])... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in JWT error handling\n"
},
{
"from": "human",
"value": "import datetime\n\nfrom flask import current_app\nfrom passlib.hash import sha256_crypt\nfrom flask_jwt import JWT\n\nfrom tmaps.models import User\n\n\njwt = JWT()\n\n\n# TODO: Use HTTPS for connectio... | python | chosen |
[
{
"from": "system",
"value": "Print out 0/1 values as we sense them real-time.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport RPi.GPIO as GPIO\nfrom time import sleep\n\npin_switch = 12\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(pin_switch, GPIO.IN)\n\nperiod = 0.1\nduration = 4\nsa... | python | chosen |
[
{
"from": "system",
"value": "Handle Causal and Relations worksheets\n"
},
{
"from": "human",
"value": "import openpyxl\nfrom .processor import SofiaProcessor\n\ndef process_table(fname):\n \"\"\"Return processor by processing a given sheet of a spreadsheet file.\n\n Parameters\n ------... | python | chosen |
[
{
"from": "system",
"value": "Move code to / from /nearby. Move to tnm.com.\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, include, url\nfrom django.contrib.gis import admin\nfrom django.views.generic.simple import direct_to_template\n\nadmin.autodiscover()\n\... | python | chosen |
[
{
"from": "system",
"value": "Add password hash to Monkey model\n"
},
{
"from": "human",
"value": "from . import db\r\n\r\nclass Monkey(db.Model):\r\n __tablename__ = 'monkeys'\r\n\r\n id = db.Column(db.Integer, primary_key=True)\r\n name = db.Column(db.String(64))\r\n email = db.Col... | python | chosen |
[
{
"from": "system",
"value": "Make mono channel output activation more readable\n"
},
{
"from": "human",
"value": "from keras.layers import Convolution2D, Reshape, Lambda, Activation\n\nfrom eva.layers.masked_convolution2d import MaskedConvolution2D\n\nclass OutChannels(object):\n def __init_... | python | chosen |
[
{
"from": "system",
"value": "Update BaseGameObject to be hashable\n"
},
{
"from": "human",
"value": "from joueur.delta_mergeable import DeltaMergeable\n\n\n# the base class that every game object within a game inherit from for Python\n# manipulation that would be redundant via Creer\nclass Base... | python | chosen |
[
{
"from": "system",
"value": "Increase the ES timeout to 1 minute.\n"
},
{
"from": "human",
"value": "import certifi\nfrom django.apps import AppConfig\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\nfrom elasticsearch_dsl.connections import connection... | python | chosen |
[
{
"from": "human",
"value": "Update 0.0.1\n- Added imports\n- Added standards for accessing Twitter API\n"
},
{
"from": "gpt",
"value": "\nimport tweepy\nfrom secrets import *\n\n# standard for accessing Twitter API\nauth = tweepy.OAuthHandler(C_KEY, C_SECRET)\nauth.set_access_token(A_TOKEN, A_T... | python | chosen |
[
{
"from": "system",
"value": "[Telemetry] Enable session restore benchmark on linux.\n\nI believe it was disabled because the clear_system_cache binary wasn't checked\ninto cloud storage yet. It is now.\n\nBUG=325479\n\nReview URL: https://codereview.chromium.org/311053006\n\ngit-svn-id: de016e52bd170d2d4f2... | python | chosen |
[
{
"from": "system",
"value": "Update test to work with current jquery-ui\n"
},
{
"from": "human",
"value": "# Copyright (c) 2012 gocept gmbh & co. kg\n# See also LICENSE.txt\n\nimport zeit.content.article.testing\n\n\nclass Preview(zeit.content.article.testing.SeleniumTestCase):\n\n def test_... | python | chosen |
[
{
"from": "system",
"value": "Update test to properly assert loaders\n"
},
{
"from": "human",
"value": "import pytest\nimport foyer\n\n\ndef test_basic_import():\n assert 'forcefields' in dir(foyer)\n\n\n@pytest.mark.parametrize('ff_name', ['OPLSAA', 'TRAPPE_UA'])\ndef test_forcefields_exist(... | python | chosen |
[
{
"from": "system",
"value": "Return internal data for string representation.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n###############################################################################\n# The MIT License\n#\n# Copyright (c) 2016 Grigory C... | python | chosen |
[
{
"from": "system",
"value": "Fix portlet assignment context utility\n"
},
{
"from": "human",
"value": "from zope.component import getUtility, getMultiAdapter, ComponentLookupError\nfrom plone.portlets.interfaces import IPortletAssignmentMapping\nfrom plone.portlets.interfaces import IPortletMan... | python | chosen |
[
{
"from": "system",
"value": "examples: Add ESP32 DUT class to ext_flash_fatfs example test\n"
},
{
"from": "human",
"value": "from __future__ import print_function\nimport os\nimport sys\n\ntry:\n import IDF\nexcept ImportError:\n test_fw_path = os.getenv('TEST_FW_PATH')\n if test_fw_p... | python | chosen |
[
{
"from": "system",
"value": "Define l10n_br_simple as default COA for brazilian companies\n"
},
{
"from": "human",
"value": "# Copyright (C) 2009 Renato Lima - Akretion\n# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html\n\nfrom . import models\nfrom . import tests\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Remove generic relation to reversion.Version from RevisionModelMixin\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.contenttypes import generic\n\n\nclass RevisionModelMixin(models.Model):\n\n class Meta:\n abstract = ... | python | chosen |
[
{
"from": "system",
"value": "Fix dynamic translation of install_path labels.\n"
},
{
"from": "human",
"value": "# Copyright 2015 Canonical, Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# publis... | python | chosen |
[
{
"from": "system",
"value": "Fix for logger configuration errors\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n\"\"\" SoCo (Sonos Controller) is a simple library to control Sonos speakers \"\"\"\n\n# Will be parsed by setup.py to determin... | python | chosen |
[
{
"from": "system",
"value": "Remove stray print statement O_o\n"
},
{
"from": "human",
"value": "# Copyright 2018 The Lucid Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n... | python | chosen |
[
{
"from": "system",
"value": "Convert institutions users to pytest\n"
},
{
"from": "human",
"value": "from nose.tools import * # flake8: noqa\n\nfrom tests.base import ApiTestCase\nfrom osf_tests.factories import InstitutionFactory, UserFactory\n\nfrom api.base.settings.defaults import API_BASE... | python | chosen |
[
{
"from": "system",
"value": "Prepend “Mc” to exception name\n"
},
{
"from": "human",
"value": "import re\n\nfrom mediawords.util.perl import decode_string_from_bytes_if_needed\n\n\nclass SchemaVersionFromLinesException(Exception):\n pass\n\n\ndef schema_version_from_lines(sql: str) -> int:\n... | python | chosen |
[
{
"from": "system",
"value": "Make the string be an actual docstring\n"
},
{
"from": "human",
"value": "import collections\n\n\"\"\"All of the datatypes that get passed around inside Signal Searcher.\"\"\"\n\nInternetData = collections.namedtuple(\n 'InternetData',\n ['key', 'table', 'time... | python | chosen |
[
{
"from": "system",
"value": "Use with statement when writing to a file\n"
},
{
"from": "human",
"value": "import gzip\nimport json\nfrom datetime import datetime\n\ndef log_database(conn, param, email):\n param = json.dumps(param)\n email_gz = gzip.compress(email.encode('ascii'))\n values = ... | python | chosen |
[
{
"from": "system",
"value": "Add testin for unmigrated changes in models\n"
},
{
"from": "human",
"value": "from django.urls import reverse\n\nfrom agency.roles import AgencyRole\nfrom common.tests.base import BaseAPITestCase\nfrom rest_framework import status\n\n\nclass TestGeneralConfigAPIVie... | python | chosen |
[
{
"from": "system",
"value": "Check if table exists else return\n"
},
{
"from": "human",
"value": "import frappe\nfrom frappe import _\nfrom frappe.model.utils.rename_field import rename_field\n\ndef execute():\n\tfrappe.reload_doc(\"hr\", \"doctype\", \"department_approver\")\n\tfrappe.reload_d... | python | chosen |
[
{
"from": "system",
"value": "Fix small bug in swift test runner\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom os.path import dirname, realpath\nimport sys\nfrom test import JAVA_SUITES, INTERPRETERS, run_suites, run_suite\nimport test\n\ntest.REPO_DIR = dirname(realpath(__fi... | python | chosen |
[
{
"from": "system",
"value": "Add get operation to JSON wrapper\n"
},
{
"from": "human",
"value": "\"\"\"\nHamcrest matching support for JSON responses.\n\n\"\"\"\nfrom json import dumps, loads\nfrom hamcrest.core.base_matcher import BaseMatcher\n\n\ndef prettify(value):\n return dumps(\n ... | python | chosen |
[
{
"from": "system",
"value": "Rename doi function, add keyword options\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"Tools for downloading bibtex files from digital object identifiers.\"\"\"\n\nimport bibpy\n\ntry:\n from urllib.request import Request, urlopen\nexcept Im... | python | chosen |
[
{
"from": "system",
"value": "Make Django template tag forgiving of nonexistent partners.\n"
},
{
"from": "human",
"value": "from django import template\nfrom partner_feeds.models import Partner\nregister = template.Library()\n\n@register.assignment_tag\ndef get_partners(*args):\n partners = ... | python | chosen |
[
{
"from": "system",
"value": "Fix HEAD requests for kernelspec resources\n\nCloses gh-7237\nCloses gh-7258\n\nStaticFileHandler.get() is a coroutine. When Tornado calls a handler\nmethod, it uses the return value to determine whether or not it's a\ncoroutine. So when head() calls get(), it needs to pass the... | python | chosen |
[
{
"from": "system",
"value": "Reformat test to a standard style.\n"
},
{
"from": "human",
"value": "\"\"\"Test suite for the deepreload module.\"\"\"\n\nfrom IPython.testing import decorators as dec\nfrom IPython.lib.deepreload import reload as dreload\n\n@dec.skipif_not_numpy\ndef test_deeprelo... | python | chosen |
[
{
"from": "system",
"value": "Add nginx rules for pretty URLs\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom os import path\n\nfrom nib import Resource, Processor, after\n\napache_redirects = b\"\"\"\nRewriteCond %{DO... | python | chosen |
[
{
"from": "system",
"value": "Fix tests after markdown library change\n\nAddendum to da03b3f033cce2b957a71cf6cb334a8c207c5047\n"
},
{
"from": "human",
"value": "from adhocracy.tests import TestController\nfrom adhocracy.tests.testtools import tt_make_user\n\n\nclass TestText(TestController):\n\n... | python | chosen |
[
{
"from": "system",
"value": "Print rate limits from new JSON response url in a pretty, parsable format\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport requests\n\nURL = 'http://tutorials.pluralsight.com/gh_rate_limit'\n\ndef main():\n resp = requests.get(URL)\n if resp.... | python | chosen |
[
{
"from": "system",
"value": "Add locust testing box to allowed IPs, and get the SSL redirect from the environment so that it can be turned off for load testing\n\npep8\n"
},
{
"from": "human",
"value": "from .base import *\n\nDEBUG = False\nALLOWED_HOSTS = ['selling-online-overseas.export.great... | python | chosen |
[
{
"from": "system",
"value": "Check sysconfig 'scripts' instead of scanning PATH\n"
},
{
"from": "human",
"value": "\"\"\"Test setup.py.\"\"\"\n\n\nimport os\nimport subprocess\nimport sys\n\nimport setup\n\n\ndef test_setup():\n \"\"\"Run setup.py check.\"\"\"\n command = [\n sys.e... | python | chosen |
[
{
"from": "system",
"value": "Define __all__ to restrict global imports\n"
},
{
"from": "human",
"value": "from pymongo import MongoClient\nfrom thingy import classproperty, DatabaseThingy\n\n\nclass Thingy(DatabaseThingy):\n client = None\n _collection = None\n\n @classproperty\n de... | python | chosen |
[
{
"from": "system",
"value": "Make settings optional on validation task\n"
},
{
"from": "human",
"value": "import datetime\nimport logging\n\nimport dataset\nfrom celery import Celery\nfrom sqlalchemy.types import DateTime\nfrom sqlalchemy.dialects.postgresql import JSONB\nfrom goodtables import... | python | chosen |
[
{
"from": "system",
"value": "Add fromarray to package root\n"
},
{
"from": "human",
"value": "from greenwich.raster import (driver_for_path, frombytes, geom_to_array, open,\n AffineTransform, ImageDriver, Raster)\nfrom greenwich.geometry import Envelope, Geometry\nfrom greenwich.srs import S... | python | chosen |
[
{
"from": "system",
"value": "Rename `current_shop` context processor to `shopify_context`, and add a little more useful Shopify information."
},
{
"from": "human",
"value": "import shopify\n\ndef current_shop(request):\n if not shopify.ShopifyResource.site:\n return {'current_shop': None}\n... | python | chosen |
[
{
"from": "system",
"value": "Add missing spaces to implicitly joined strings\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom .. import Warning, register, Tags\n\n\n@register(Tags.compatibility)\ndef check_1_7_compatibility(**kwargs):\n errors = []\n erro... | python | chosen |
[
{
"from": "system",
"value": "Add blank line to comply with PEP 8\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"Exception classes specific to pushdown automata.\"\"\"\n\nfrom automata.base.exceptions import AutomatonException\n\n\nclass PDAException(AutomatonException):\n \... | python | chosen |
[
{
"from": "system",
"value": "Rename column -> col for consistency with row\n"
},
{
"from": "human",
"value": "import numpy as np\n\n# Provide functions to get/set blocks in numpy arrays\n\ndef get_block_from_matrix(matrix,dim_block,n_block,row,column):\n start_row = row*dim_block\n start_... | python | chosen |
[
{
"from": "system",
"value": "Add get_config to the list of public functions for plotly.py\n"
},
{
"from": "human",
"value": "\"\"\"\nplotly\n======\n\nThis module defines functionality that requires interaction between your\nlocal machine and Plotly. Almost all functionality used here will requ... | python | chosen |
[
{
"from": "system",
"value": "Change default subcommand to \"source random\"\n"
},
{
"from": "human",
"value": "import sys\n\nfrom redcmd.api import execute_commandline\n\n\ndef main():\n\tfrom .db.manage.db import DB\n\n\tdb = DB()\n\tresponse = db.check()\n\n\tfrom util.printer import printer\... | python | chosen |
[
{
"from": "system",
"value": "Enforce that request data is a dictionary.\n"
},
{
"from": "human",
"value": "from rest_framework.parsers import JSONParser\n\nfrom api.base.renderers import JSONAPIRenderer\nfrom api.base.exceptions import JSONAPIException\n\nclass JSONAPIParser(JSONParser):\n \... | python | chosen |
[
{
"from": "system",
"value": "Fix F401 error (module imported but unused)\n\n[ci skip]"
},
{
"from": "human",
"value": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\n linescan.py - Effortlessly read lines from a text file using any encoding\n Created 2013-2014 Triangle717\n <http... | python | chosen |
[
{
"from": "system",
"value": "Add JoinNode to pipeline init\n"
},
{
"from": "human",
"value": "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"\nPackage contains modules for generating pipelines using interfaces\n\n\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Add details of the project\n"
},
{
"from": "human",
"value": "__author__ = 'jorgesaldivar'\n"
},
{
"from": "gpt",
"value": "# IdeaScaly\n# Copyright 2015 Jorge Saldivar\n# See LICENSE for details.\n\n\"\"\"\nIdeaScaly: IdeaScale API client\n\"\"\"\n\n__v... | python | chosen |
[
{
"from": "system",
"value": "Make it a single test case\n"
},
{
"from": "human",
"value": "from models import AuthenticationError,AuthenticationRequired\nfrom trello import Trello\nimport unittest\nimport os\n\nclass BoardTestCase(unittest.TestCase):\n\n\tdef setUp(self):\n\t\tself._trello = Tr... | python | chosen |
[
{
"from": "system",
"value": "Add comment about why excepting KeyError\n"
},
{
"from": "human",
"value": "\"\"\"Admin of Zinnia CMS Plugins\"\"\"\nfrom django.contrib import admin\nfrom django.template import RequestContext\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.plu... | python | chosen |
[
{
"from": "system",
"value": "Use BaseDbObjectTestCase in AddressScope UT\n\nAddressScopeDbObjectTestCase class is using _BaseObjectTestCase class\nwhich doesn't contain all the unit test cases for Oslo-Versioned\nclasses. This patch replace that class.\n\nPartially-Implements: blueprint adopt-oslo-versione... | python | chosen |
[
{
"from": "system",
"value": "Add warning about failing functional test\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom unittest import TestCase\n\nimport mechanize\n\nclass ResponseTests(TestCase):\n def test_close_pickle_load(self):\n import pickle\n\n b = mec... | python | chosen |
[
{
"from": "system",
"value": "Rewrite DjangoAdmin in letters for decorators\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import Attachment, Letter\n\n\nclass AttachmentInline(admin.StackedInline):\n '''\n Stacked Inline View for Attachment\n ''... | python | chosen |
[
{
"from": "system",
"value": "Change absolute import to relative\n"
},
{
"from": "human",
"value": "from __future__ import print_function\nimport random\nfrom capstone.util import print_header\n\n\ndef play_match(game, players, verbose=True):\n \"\"\"Plays a match between the given players\"\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.