conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix unicode decoding on error messages\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport sys\nimport argparse\n\nfrom macdict.dictionary import lookup_word, ensure_unicode\n\n\ndef parse_args():\n parser = argparse.ArgumentParser...
python
chosen
[ { "from": "system", "value": "Return the result of an Execute!\n" }, { "from": "human", "value": "from contextlib import contextmanager\n\nfrom sqlalchemy import MetaData, create_engine\nfrom sqlalchemy.engine import Engine\nfrom sqlalchemy.orm import sessionmaker\n\n\nclass Schema():\n\n def...
python
chosen
[ { "from": "system", "value": "Change code to be PEP-8 compliant\n" }, { "from": "human", "value": "###\n### Copyright 2014-2015 Boundary, 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### Yo...
python
chosen
[ { "from": "system", "value": "Rename decorator equality_comparable to equalable\n" }, { "from": "human", "value": "from .equals_builder import EqualsBuilder\nfrom .hash_code_builder import HashCodeBuilder\n\n\n__all__ = [\n 'hashable',\n 'equality_comparable',\n]\n\n\ndef hashable(cls=None...
python
chosen
[ { "from": "system", "value": "Move sessionmaker outside of loop\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- mode: python; coding: utf-8 -*-\n# Copyright 2021 The HERA Collaboration\n# Licensed under the 2-clause BSD License\n\"\"\"\nCheck that input files are safely in the li...
python
chosen
[ { "from": "system", "value": "Support Python 3 in Vim usage example\n" }, { "from": "human", "value": "\"\"\"Run autopep8 on the selected buffer in Vim.\n\nmap <C-I> :pyfile <path_to>/vim_autopep8.py<CR>\n\n\"\"\"\n\nimport vim\nif vim.eval('&syntax') == 'python':\n encoding = vim.eval('&file...
python
chosen
[ { "from": "system", "value": "[FIX] resource: Allow 'Access Rights' users to create companies\n\nPurpose\n=======\n\nA 'Access Rights' (group_erp_manager) user can create a company\nA 'Settings' (group_system) user can create a resource.calendar\n\nWith the resource module, if a resource.calendar is not set...
python
chosen
[ { "from": "system", "value": "Simplify logic by eliminating retries in password prompt and returning results directly.\n" }, { "from": "human", "value": "import getpass\nfrom distutils.command import upload as orig\n\n\nclass upload(orig.upload):\n \"\"\"\n Override default upload behavior...
python
chosen
[ { "from": "system", "value": "Clean up job stats when jobs are removed in build restart\n" }, { "from": "human", "value": "from sqlalchemy.orm import joinedload\n\nfrom datetime import datetime\n\nfrom changes.api.base import APIView\nfrom changes.api.build_index import execute_build\nfrom chang...
python
chosen
[ { "from": "system", "value": "Transform data to the target format\n" }, { "from": "human", "value": "import os.path\nimport sys\nimport pandas as pd\nimport logging\n\nINPUT_DIRECTORY = '../../../data/raw/disease_SG'\nINPUT_FILE = \"weekly-dengue-malaria.csv\"\nOUTPUT_DIRECTORY = '../../Data/int...
python
chosen
[ { "from": "system", "value": "Make pubkey test more portable.\n" }, { "from": "human", "value": "import datajoint.errors as djerr\nimport datajoint.plugin as p\nimport pkg_resources\n\n\ndef test_check_pubkey():\n base_name = 'datajoint'\n base_meta = pkg_resources.get_distribution(base_na...
python
chosen
[ { "from": "system", "value": "Make username and password required arguments\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 file,\n# You can obtain one at http://mozill...
python
chosen
[ { "from": "system", "value": "Fix key error when no tags are specified\n" }, { "from": "human", "value": "from tastypie.authorization import Authorization\nfrom tastypie.fields import CharField\nfrom tastypie.resources import ModelResource\n\nfrom expensonator.models import Expense\n\n\nclass Ex...
python
chosen
[ { "from": "system", "value": "Add parameter deconstruction fro DatabasePathParameter\n" }, { "from": "human", "value": "from flask import current_app\n\nimport cea.inputlocator\n\n\ndef deconstruct_parameters(p):\n params = {'name': p.name, 'type': p.typename,\n 'value': p.get(),...
python
chosen
[ { "from": "system", "value": "Update python script for pep8 style\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport datetime\n\ndef return_true():\n return True\n\ndef return_false():\n return False\n\ndef return_int():\n return 123\n\ndef return_float():\n return 1.0\...
python
chosen
[ { "from": "system", "value": "Revert \"up version to 0.4.7.\"\n\nThis reverts commit 9b1177d4a56070092faa89778911d11c70efdc54.\n" }, { "from": "human", "value": "from ._remove import remove\nfrom ._load_and_dump import load, dump, ZerothIFD, ExifIFD, GPSIFD\nfrom ._transplant import transplant\n...
python
chosen
[ { "from": "system", "value": "Handle version string sent to stderr\n\nAn unfortunate side effect of switching from print to output() is\nthat all output() goes to stderr. We should probably carefully\nconsider whether this is the right thing to do.\n" }, { "from": "human", "value": "#!/usr/bin/p...
python
chosen
[ { "from": "system", "value": "Rewrite function for sample count\n" }, { "from": "human", "value": "async def count_samples(db, label_id):\n return await db.samples.count_documents({\"labels\": {\"$in\": [label_id]}})\n" }, { "from": "gpt", "value": "async def attach_sample_count(d...
python
chosen
[ { "from": "system", "value": "Fix hashing for Python 3\n" }, { "from": "human", "value": "try:\n from hashlib import md5\nexcept ImportError:\n from md5 import md5\n\nfrom django.http import HttpResponseBadRequest\n\nfrom secretballot.middleware import SecretBallotIpUseragentMiddleware\n\n...
python
chosen
[ { "from": "system", "value": "Change default email to newsletter@uwcs instead of noreply\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils import timezone\n\nfrom django.utils.datetime_safe import strftime\n\nfrom hashlib import sha256\n\nfrom markdownx.models im...
python
chosen
[ { "from": "system", "value": "Fix title for desktop notification\n" }, { "from": "human", "value": "# coding: utf-8\nimport platform\n\nif platform.system() == 'Darwin':\n from Foundation import NSUserNotificationDefaultSoundName\n import objc\n\n NSUserNotification = objc.lookUpClass('...
python
chosen
[ { "from": "system", "value": "Fix typo foce_unicode -> force_unicode\n" }, { "from": "human", "value": "from django import template\nfrom django.conf import settings\nfrom django.utils.encoding import smart_str, force_unicode\nfrom django.utils.safestring import mark_safe\n\nregister = template....
python
chosen
[ { "from": "system", "value": "Remove sql comments from settings file\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = True\n\n# TEMPLATES[1]['DEBUG'] = True\n\nDATABASES = {\n 'default': {\n # 'ENGINE': 'django.db.backends.sqlite3',\n # 'NAME': os.path.join(BASE...
python
chosen
[ { "from": "system", "value": "Add ATMega1280 chip to programmer chips.\n" }, { "from": "human", "value": "\r\navrChipDB = {\r\n\t'ATMega2560': {\r\n\t\t'signature': [0x1E, 0x98, 0x01],\r\n\t\t'pageSize': 128,\r\n\t\t'pageCount': 1024,\r\n\t},\r\n}\r\n\r\ndef getChipFromDB(sig):\r\n\tfor chip in ...
python
chosen
[ { "from": "system", "value": "Remove ServiceFilter from view since it's not needed. Service only has\nname and json\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom mrbelvedereci.api.serializers.cumulusci import OrgSerializer\nfrom mrbelvedereci.api.serializers.cumul...
python
chosen
[ { "from": "system", "value": "Implement openable check for door card.\n" }, { "from": "human", "value": "from onirim.card._base import ColorCard\n\nclass _Door(ColorCard):\n\n def drawn(self, agent, content):\n do_open = agent.ask(\"if open\") if content.can_open(self) else False\n ...
python
chosen
[ { "from": "system", "value": "Remove deprecation warning when loading tests/sqlalchemy\n\n/home/sam/Work/ironic/.tox/py27/local/lib/python2.7/site-packages/oslo_db/tests/sqlalchemy/__init__.py:20:\nDeprecationWarning: Function\n'oslo_db.sqlalchemy.test_base.optimize_db_test_loader()' has moved to\n'oslo_db....
python
chosen
[ { "from": "system", "value": "Remove Url model from admin\n" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom rest_api.models import Url\n\nclass UrlForm(ModelForm):\n class Meta:\n model = Url\n" }, { "from": "gpt", "value": "from django.forms impor...
python
chosen
[ { "from": "system", "value": "Fix CI to ignore system install of asn1crypto\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals, division, absolute_import, print_function\n\nimport os\nimport site\nimport sys\n\nfrom . import build_root, requires_oscrypto\...
python
chosen
[ { "from": "system", "value": "Fix PicoException response code bug\n" }, { "from": "human", "value": "\"\"\"picoCTF API v1 app.\"\"\"\n\nfrom flask import Blueprint, jsonify\nfrom flask_restplus import Api\n\nfrom api.common import PicoException\n\nfrom .achievements import ns as achievements_ns\...
python
chosen
[ { "from": "system", "value": "Add to the label that 0 lines will result in the entire file being downloaded\n" }, { "from": "human", "value": "from django import forms\nfrom logs.models import Log\n\nclass LineCountForm(forms.Form):\n linesToFetch = forms.IntegerField(label=\"Number of lines to...
python
chosen
[ { "from": "system", "value": "Add non negative least squares scipy functionality\n" }, { "from": "human", "value": "from scipy import optimize as o\nimport clean as c\n\ndef minimize(func, guess):\n return o.minimize(func, guess)\n\n\n\ndef minimize_scalar(func, options):\n bracket = optio...
python
chosen
[ { "from": "system", "value": "jobs-010: Fix for correct resolve URL\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import Vacancy\n\n\nclass VacancySerializer(serializers.HyperlinkedModelSerializer):\n \"\"\"\n Common vacancy model serializer\n ...
python
chosen
[ { "from": "system", "value": "Use HTTPS when fetching JSON files" }, { "from": "human", "value": "import logging\nimport os\n\n\n# URL to clone product_details JSON files from.\n# Include trailing slash.\nPROD_DETAILS_URL = 'http://svn.mozilla.org/libs/product-details/json/'\n\n# Target dir to d...
python
chosen
[ { "from": "system", "value": "Set LaTeX builder to skip latex_document nodes\n\nThis stops Sphinx' built-in LaTeX builder from complaining about unknown\nlatex_document node type.\n" }, { "from": "human", "value": "\r\nimport directive\r\nimport builder\r\n\r\n\r\n#==============================...
python
chosen
[ { "from": "system", "value": "Change /contacts/groups to display only static groups (instead of all groups)\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url\nfrom go.contacts import views\n\nurlpatterns = patterns('',\n url(r'^$', views.index, name='index...
python
chosen
[ { "from": "system", "value": "Remove backward compatibility hack for exception subclass\n" }, { "from": "human", "value": "\"\"\"errors and exceptions.\"\"\"\n\nfrom distutils.version import LooseVersion\nfrom pkg_resources import get_distribution\nfrom six import text_type\nfrom werkzeug import...
python
chosen
[ { "from": "system", "value": "fix: Return empty tuple in get_readonly_fields\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.template.defaultfilters import pluralize\n\nfrom .forms import EnvironmentVariableForm\nfrom .models import EnvironmentVariable, Project\n...
python
chosen
[ { "from": "system", "value": "Make path handlers list horizontal\n\nSigned-off-by: Chris Warrick <de6f931166e131a07f31c96c765aee08f061d1a5@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import print_function, unicode_literals\nfrom nikola import nikola\nn ...
python
chosen
[ { "from": "system", "value": "Make the Guitar Society __str__ Method a bit more Logical\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom django_countries.fields import CountryField\n\n\nclass GuitarSociety(models.Model):\n \"\"\"\n Represents...
python
chosen
[ { "from": "system", "value": "Add status messages to `gitdir update`\n" }, { "from": "human", "value": "import abc\nimport subprocess\n\nimport gitdir\n\nclass Host(abc.ABC):\n @abc.abstractmethod\n def __iter__(self):\n raise NotImplementedError()\n\n @abc.abstractmethod\n de...
python
chosen
[ { "from": "system", "value": "Make 0 the default version\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www....
python
chosen
[ { "from": "system", "value": "Change index to OpenAddresses schema\n" }, { "from": "human", "value": "import csv\nimport re\nimport os\nfrom urlparse import urlparse\nfrom elasticsearch import Elasticsearch\n\nif os.environ.get('BONSAI_URL'):\n url = urlparse(os.environ['BONSAI_URL'])\n bonsai...
python
chosen
[ { "from": "system", "value": "Revert \"emails now sent through mailgun, small warning css change\"\n\nThis reverts commit 12ffeb9562bb9e865fe3ce76266ba3f5c45b815d.\n" }, { "from": "human", "value": "from __future__ import (\n absolute_import,\n print_function,\n)\n\nPOSTGRES_MAX_INT = 2147...
python
chosen
[ { "from": "system", "value": "Fix wrong output stream usage\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n# coding=utf-8\n\n\"\"\"\nImplements reused sanity checks\n\"\"\"\n\nimport os\nimport sys\nfrom gitver.termcolors import term, bold\nfrom gitver.defines import PRJ_ROOT, CFGDIR...
python
chosen
[ { "from": "system", "value": "Fix bug if no args were on command line\n" }, { "from": "human", "value": "__author__ = \"Richard Lindsley\"\n\nimport sys, os\nimport argparse\n\nimport sip\nsip.setapi('QDate', 2)\nsip.setapi('QDateTime', 2)\nsip.setapi('QString', 2)\nsip.setapi('QTextStream', 2)\...
python
chosen
[ { "from": "system", "value": "Fix lint errors after adding missing __init__ files\n" }, { "from": "human", "value": "import pytest\n\nfrom tests.conftest import assert_cache_control\n\n\nclass TestViewPDFAPI:\n def test_caching_is_disabled(self, test_app):\n response = test_app.get(\"/...
python
chosen
[ { "from": "system", "value": "Rename file_name argument on command line\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"Main executable for ShivyC compiler\n\nFor usage, run \"./shivyc.py --help\".\n\n\"\"\"\n\nimport argparse\n\ndef get_arguments():\n \"\"\"Set up the argu...
python
chosen
[ { "from": "system", "value": "Raise EnvironmentError instead of Exception to make pylint happy\n" }, { "from": "human", "value": "import sys\nif not (2, 6) <= sys.version_info < (3,):\n sys.exit(u'Mopidy requires Python >= 2.6, < 3')\n\nfrom subprocess import PIPE, Popen\n\nVERSION = (0, 4, 0...
python
chosen
[ { "from": "system", "value": "Implement current session auth method check\n" }, { "from": "human", "value": "from collections import OrderedDict\n\n\ndef combine_uniquely(iterable1, iterable2):\n \"\"\"\n Combine unique items of two sequences preserving order.\n\n :type seq1: Iterable[A...
python
chosen
[ { "from": "system", "value": "Fix url lookup error for usernames certain special characters\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^(?P<url_username>\\w+)$',\n views.user_feed, {'page_nr': '1', 'sort': 'new'},...
python
chosen
[ { "from": "system", "value": "Make new settings test not run for xcode generator.\n\nTBR=evan\nReview URL: http://codereview.chromium.org/7472006" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright (c) 2011 Google Inc. All rights reserved.\n# Use of this source code is governed...
python
chosen
[ { "from": "system", "value": "Add function to schedule later" }, { "from": "human", "value": "\"\"\"\n\nVery basic implementation of an event loop\n==========================================\n\nThe eventloop is a singleton to schedule and run events.\n\nExports\n-------\n\n- ``EventLoop``: the b...
python
chosen
[ { "from": "system", "value": "Add some initial tests for Stock.\n" }, { "from": "human", "value": "import cutplanner\nimport unittest\n\nclass TestStock(unittest.TestCase):\n\n def setUp(self):\n self.stock = cutplanner.Stock(120)\n\n def test_cut(self):\n self.stock.assign_c...
python
chosen
[ { "from": "system", "value": "Make lines jumps only jump to blocks over changes\n\nInstead of every line in a block of modifications which is tedious\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\ntry:\n from GitGutter.view_collection import ViewCollection\nexcept I...
python
chosen
[ { "from": "system", "value": "Remove old uncertainty quantification stuff\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport os\nimport json\nimport math\nimport uncertain\n\nTIMINGS_DIR = 'collected'\n\n\ndef _mean(values):\n \"\"\"The arithmetic mean.\"\"\"\n return sum(va...
python
chosen
[ { "from": "system", "value": "MB-6867: Save generated value for defaultdict\n\nInstead of just returning value, keep it in dict.\n\nChange-Id: I2a9862503b71f2234a4a450c48998b5f53a951bc\nReviewed-on: http://review.couchbase.org/21602\nTested-by: Bin Cui <ed18693fff32c00e22495f4877a3b901bed09041@gmail.com>\nR...
python
chosen
[ { "from": "system", "value": "Fix typo documention -> documentation\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nThe acl module handles client_acl operations\n\nAdditional information on client_acl can be\nfound by reading the salt documention:\n\n http://docs.saltstack.co...
python
chosen
[ { "from": "system", "value": "Remove whitespace at end of line\n" }, { "from": "human", "value": "# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:\n\n# python-quilt - A Python implementation of the quilt patch system\n#\n# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>\n#\n# This lib...
python
chosen
[ { "from": "system", "value": "Add 'address' field to core schema\n" }, { "from": "human", "value": "import jsonschema\n\n\nCORE_SCHEMA = {\n 'type': 'object',\n 'properties': {\n 'paradigm': {\n 'type': 'string',\n },\n 'method': {\n 'type': 'stri...
python
chosen
[ { "from": "system", "value": "Add avatar_url and owner field for User\n" }, { "from": "human", "value": "from app import db\nfrom flask import Flask\nfrom datetime import datetime\n\nclass User(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n username = db.Column(db.String(80), ...
python
chosen
[ { "from": "system", "value": "Add random jitter to the exponential backoff function\n" }, { "from": "human", "value": "\"\"\"\nMisc. general utility functions, not tied to Kubespawner directly\n\"\"\"\nfrom concurrent.futures import ThreadPoolExecutor\n\nfrom jupyterhub.utils import DT_MIN, DT_M...
python
chosen
[ { "from": "system", "value": "Move override logic into update rather than touch\n" }, { "from": "human", "value": "import requests\n\nfrom framework.auth.core import _get_current_user\n\nfrom website.files.models.base import File, Folder, FileNode, FileVersion\n\n\n__all__ = ('DataverseFile', 'D...
python
chosen
[ { "from": "system", "value": "Use new pymongo API in MongoDBStorage\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom werobot.session import SessionStorage\nfrom werobot.utils import json_loads, json_dumps\n\n\nclass MongoDBStorage(SessionStorage):\n \"\"\"\n MongoDBStorag...
python
chosen
[ { "from": "system", "value": "Move all the process creation in a new function\n\nThis reduces the size of code.\n" }, { "from": "human", "value": "import os\nimport sys\nimport time\n\nfrom multiprocessing import Process, Event\n\nimport mfhclient\nimport server\nimport update\n\nfrom arguments ...
python
chosen
[ { "from": "system", "value": "exception: Fix typo in new CoreErrors\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\n\nclass MopidyException(Exception):\n\n def __init__(self, message, *args, **kwargs):\n super(MopidyException, self).__init...
python
chosen
[ { "from": "system", "value": "Allow Stage objects to take functions instead of object + method names\n" }, { "from": "human", "value": "\"\"\"\n.. automodsumm:: requests_cache.serializers.pipeline\n :classes-only:\n :nosignatures:\n\"\"\"\nfrom typing import Any, List, Union\n\nfrom ..models...
python
chosen
[ { "from": "system", "value": "Update post-back script for Braintree\n" }, { "from": "human", "value": "#!/usr/bin/env python -u\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport csv\nfrom gratipay import wireup\nfrom gratipay.models.exchange_route impo...
python
chosen
[ { "from": "system", "value": "Replace double quotes with single quotes as string delimiters\n\nThis commit replaces double quotes with single quotes as string delimiters\nto improve consistency.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask_wtf import Form\nfrom flask_wt...
python
chosen
[ { "from": "system", "value": "Remove hidden public pages from sitemap\n" }, { "from": "human", "value": "from grandchallenge.core.sitemaps import SubdomainSitemap\nfrom grandchallenge.pages.models import Page\n\n\nclass PagesSitemap(SubdomainSitemap):\n priority = 0.8\n\n def items(self):\...
python
chosen
[ { "from": "system", "value": "test: Update Twitter auth test to run directly\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nTwitter API test module.\n\nLocal test to check that Twitter credentials are valid connect to Twitter\nAPI and that the auth functions can be used to d...
python
chosen
[ { "from": "system", "value": "Use click instead of argparse\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom __future__ import print_function\nimport argparse\nimport json\n\nparser = argparse.ArgumentParser(description='Pretty-print LDJSON.')\nparser.add_argument('--indent', me...
python
chosen
[ { "from": "system", "value": "Fix organization-contact url having an extra slash\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom bluebottle.organizations.views import (\n OrganizationList, OrganizationDetail,\n OrganizationContactList, OrganizationContactDetail\...
python
chosen
[ { "from": "system", "value": "Fix up for Django 1.9\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.contenttypes.management import update_contenttypes as django_update_contenttypes\nfrom django.db....
python
chosen
[ { "from": "system", "value": "Fix displaying None in statistics when there's no book sold\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import user_passes_test\nfrom django.shortcuts import render\nfrom django.db.models import Sum, Count\nfrom common.auth import user_is_...
python
chosen
[ { "from": "system", "value": "Mark snapshots as inactive if any are not valid\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.models import Sna...
python
chosen
[ { "from": "system", "value": "feincms3.plugins: Stop hiding local import errors\n" }, { "from": "human", "value": "# flake8: noqa\n\nfrom . import html\nfrom . import snippet\n\ntry:\n from . import external\nexcept ImportError: # pragma: no cover\n pass\ntry:\n from . import image\nex...
python
chosen
[ { "from": "system", "value": "Fix data relation not working for custom Guids\n" }, { "from": "human", "value": "from superdesk.base_model import BaseModel\n\n\ndef init_app(app):\n CoverageModel(app=app)\n\n\ndef rel(resource, embeddable=False):\n return {\n 'type': 'objectid',\n ...
python
chosen
[ { "from": "system", "value": "Work around Python3's byte semantics.\n" }, { "from": "human", "value": "from suelta.util import bytes\nfrom suelta.sasl import Mechanism, register_mechanism\n\ntry:\n import urlparse\nexcept ImportError:\n import urllib.parse as urlparse\n\n\n\nclass X_FACEBO...
python
chosen
[ { "from": "system", "value": "Fix unit tests for python2\n" }, { "from": "human", "value": "from rdflib import Graph, URIRef, Literal, BNode\nfrom rdflib.plugins.sparql import prepareQuery\nfrom rdflib.compare import isomorphic\n\nimport unittest\n\nclass TestConstructInitBindings(unittest.TestC...
python
chosen
[ { "from": "system", "value": "Set a default api path\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom django.conf import settings\nfrom django.conf.urls import include, url\nfrom rest_framework_bulk.routes import BulkRouter\nfrom rest_surveys.views import (\n S...
python
chosen
[ { "from": "system", "value": "Declare the encoding of conn.py as utf-8\n" }, { "from": "human", "value": "import unittest\n\nfrom compmusic.dunya.conn import _make_url\n\n\nclass ConnTest(unittest.TestCase):\n def test_make_url(self):\n params = {\"first\": \"%^grtà\"}\n url = _...
python
chosen
[ { "from": "system", "value": "Add test for deep_copy function\n" }, { "from": "human", "value": "from __future__ import (absolute_import, division, print_function)\n\nfrom folium.utilities import camelize\n\n\ndef test_camelize():\n assert camelize('variable_name') == 'variableName'\n asse...
python
chosen
[ { "from": "system", "value": "Disable warnings in GPIO lib\n" }, { "from": "human", "value": "from flask import Flask\nimport logging\nimport logging.config\nimport RPi.GPIO as GPIO\nfrom .config import config, config_loader\nfrom .channel import ChannelFactory\n\napp = Flask('rpi_gpio_http')\n\...
python
chosen
[ { "from": "system", "value": "Fix Zaqar-ui with wrong reference pbr version\n\nChange-Id: I84cdb865478a232886ba1059febf56735a0d91ba\n" }, { "from": "human", "value": "# Copyright 2015 IBM Corp.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file e...
python
chosen
[ { "from": "system", "value": "Add missing parentheses to print()" }, { "from": "human", "value": "# Copyright 2016 The Kubernetes Authors.\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": "Switch to requests library instead of urllib\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport urllib.parse\nimport urllib.request\n\ndef create_player(username, password, email):\n url = 'https://localhost:3000/players'\n values = {'username' :...
python
chosen
[ { "from": "system", "value": "Remove some cruft from the cufflinks test.\n" }, { "from": "human", "value": "import os\nimport unittest\nimport shutil\nfrom bcbio.rnaseq import cufflinks\nfrom bcbio.utils import file_exists, safe_makedir\nfrom nose.plugins.attrib import attr\n\nDATA_DIR = os.path...
python
chosen
[ { "from": "system", "value": "Handle SIGINT even if it's ignored by default\n" }, { "from": "human", "value": "from BaseHTTPServer import HTTPServer\nfrom HTTPHandler import HTTPHandler\nimport socket\nfrom threading import currentThread\n\nfrom Cron import Cron\nfrom Settings import PORT\nfrom ...
python
chosen
[ { "from": "system", "value": "Move log file to constant\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport logging\nfrom datetime import datetime\n\nfrom update_wrapper import UpdateWrapper\n\nif not os.path.isdir(\"log\"):\n os.mkdir(\"log\...
python
chosen
[ { "from": "system", "value": "Allow importing StdinStream from antlr4 package\n" }, { "from": "human", "value": "from antlr4.Token import Token\nfrom antlr4.InputStream import InputStream\nfrom antlr4.FileStream import FileStream\nfrom antlr4.BufferedTokenStream import TokenStream\nfrom antlr4.C...
python
chosen
[ { "from": "system", "value": "Update should_see_immediately to use local find_element method.\n\nThis commit adds a content_search_list and replaces dom_contains\nwith our local version of find_element. It adds an attribute\ncalled content_search_list that can be overridden by the derived\nTestCase class a...
python
chosen
[ { "from": "system", "value": "Fix tests on machine without CUDA\n" }, { "from": "human", "value": "from numba.testing import SerialSuite\nfrom numba.testing import load_testsuite\nfrom numba import cuda\nfrom os.path import dirname, join\n\n\ndef load_tests(loader, tests, pattern):\n\n suite ...
python
chosen
[ { "from": "system", "value": "Fix the wikipedia link and include a warning\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"NL-specific Form helpers.\"\"\"\n\nfrom __future__ import unicode_literals\n\nfrom django import forms\nfrom django.utils import six\n\nfrom .nl_provinces ...
python
chosen
[ { "from": "system", "value": "Use explicit Decimal in test\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom django.contrib.auth.models import User\n\nfrom pinax.ratings.models import Rating\n\nfrom .models import Car\n\n\nclass Tests(TestCase):\n\n def setUp(self):\...
python
chosen
[ { "from": "system", "value": "Update no longer takes an argument\n\nSee the docs: http://bmi-python.readthedocs.io.\n" }, { "from": "human", "value": "#! /usr/bin/env python\nimport sys\nimport subprocess\n\n\nclass BmiIlamb(object):\n _command = 'run_ilamb'\n _args = None\n _env = None...
python
chosen
[ { "from": "system", "value": "Comment out temporally scoresheet editing page\n" }, { "from": "human", "value": "from PyQt4.QtGui import *\nfrom master_page import MasterPage\nfrom generate_page import GeneratePage\nfrom scan_page import ScanPage\nfrom scores_page import ScoresPage\nfrom results_...
python
chosen
[ { "from": "system", "value": "Add a common function for deriving the working dir.\n" }, { "from": "human", "value": "from subprocess import call\n\n\nclass BaseDriver(object):\n\n def __init__(self, config):\n self.config = config\n\n def do(self, cmd):\n cmd = self.command(c...
python
chosen
[ { "from": "system", "value": "Move around imports and not shadow app\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nradremedy.py\n\nMain web application file. Contains initial setup of database, API, and other components.\nAlso contains the setup of the routes.\n\"\"\"\nfrom f...
python
chosen
[ { "from": "system", "value": "ENH: Update tools script for file renaming\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\"\"\"\nRun this script to convert dataset documentation to ReST files. Relies\non the meta-information from the datasets of the currently installed version.\nIe., ...
python
chosen