conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Revert \"Revert \"Updated fields for Project model.\"\"\n\nThis reverts commit 726662d102453f7c7be5fb31499a8c4d5ab34444.\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import models\nfrom uuidfield.fields import UUIDFi...
python
chosen
[ { "from": "system", "value": "Modify python test for VTK 5.\n" }, { "from": "human", "value": "#! /usr/bin/env python2\n\nimport sys\nimport vtk\nimport vtkDICOMPython\n\n# put everything into the vtk namespace\nfor a in dir(vtkDICOMPython):\n if a[0] != '_':\n setattr(vtk, a, getattr(...
python
chosen
[ { "from": "system", "value": "Revert accidental changes to ci\n" }, { "from": "human", "value": "from pyscf.ci.cisd import CISD\n" }, { "from": "gpt", "value": "from pyscf.ci import cisd\n\t\t\ndef CISD(mf, frozen=[], mo_coeff=None, mo_occ=None):\t\t\n from pyscf import scf\t\t\n ...
python
chosen
[ { "from": "system", "value": "Add method to fetch a single event" }, { "from": "human", "value": "from base import BaseClient\n\nEVENTS_API_VERSION = 'v1'\n\nclass EventsClient(BaseClient):\n \n def _get_path(self, subpath):\n return 'events/%s/%s' % (EVENTS_API_VERSION, subpath)\n ...
python
chosen
[ { "from": "system", "value": "Change filter syntax to be more direct.\n" }, { "from": "human", "value": "from django.db.models import Manager\n \nclass ShipmentManager(Manager):\n\"\"\"Returns Shipments that are not delivered\"\"\" \n \n def undelivered(self):\n return self...
python
chosen
[ { "from": "system", "value": "Rename the built-in wrapper from \"settings\" to \"setmagic\"\n" }, { "from": "human", "value": "from setmagic.wrapper import SettingsWrapper\n\n\n# Initialize the magic\nsettings = SettingsWrapper()\n" }, { "from": "gpt", "value": "from setmagic.wrapper...
python
chosen
[ { "from": "system", "value": "Convert ScaleTool to use add_scale\n\nContributes to Ultimaker/Uranium/#73\nContributes to Ultimaker/Cura/#493\ncontributes to #CURA-287\ncontributes to #CURA-235\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the...
python
chosen
[ { "from": "system", "value": "Add missing import for new disk module\n" }, { "from": "human", "value": "# Keep imports sorted alphabetically\nimport fabtools.arch\nimport fabtools.cron\nimport fabtools.deb\nimport fabtools.files\nimport fabtools.git\nimport fabtools.group\nimport fabtools.mysql\...
python
chosen
[ { "from": "system", "value": "Add a warning about future changes that will happen in dipy.stats.\n" }, { "from": "human", "value": "# code support tractometric statistical analysis for dipy\n" }, { "from": "gpt", "value": "# code support tractometric statistical analysis for dipy\n\n...
python
chosen
[ { "from": "system", "value": "Expand trim_word_count test a bit\n" }, { "from": "human", "value": "\nimport unittest\n\nimport amara\nfrom amara.lib import util\n\nclass Test_util(unittest.TestCase):\n def test_trim_word_count(self):\n x = amara.parse('<a>one two <b>three four </b><c>f...
python
chosen
[ { "from": "system", "value": "Mark XmlMaterialProfile as type \"material\" so the import/export code can find it\n\nContributes to CURA-341\n" }, { "from": "human", "value": "# Copyright (c) 2016 Ultimaker B.V.\n# Cura is released under the terms of the AGPLv3 or higher.\n\nfrom . import XmlMate...
python
chosen
[ { "from": "system", "value": "Add setting to optionally enforce PR deadlines\n" }, { "from": "human", "value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify i...
python
chosen
[ { "from": "system", "value": "Reorder list dispay in RequestPayment and RequestResponse lists.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom . import models\n\n\nclass PaymentRequestAdmin(admin.ModelAdmin):\n model = models.PaymentRequest\n list_display = (\"v...
python
chosen
[ { "from": "system", "value": "Fix broken requirements file references\n" }, { "from": "human", "value": "import pytest\nimport os\nimport shutil\nfrom subprocess import call\nfrom cookiecutter.main import cookiecutter\n\n\nplaybook_setup_commands = ['pip install -r requirements.txt']\nplaybook_s...
python
chosen
[ { "from": "system", "value": "Use older style string formatting for Python 2.6\n" }, { "from": "human", "value": "import warnings\nfrom django.conf import settings\nfrom armstrong.utils.backends import GenericBackend\n\nNEW = \"ARMSTRONG_LAYOUT_BACKEND\"\nOLD = \"ARMSTRONG_RENDER_MODEL_BACKEND\"...
python
chosen
[ { "from": "system", "value": "Add note in hog test doc string\n" }, { "from": "human", "value": "\"\"\"Tests for module gramcore.features.descriptors\"\"\"\nimport numpy\n\nfrom nose.tools import assert_equal\n\nfrom gramcore.features import descriptors\n\n\ndef test_hog_size():\n \"\"\"Creat...
python
chosen
[ { "from": "system", "value": "Add tests for cube and isis encoders.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport glob\nimport pvl\n\n\nDATA_DIR = os.path.join(os.path.dirname(__file__), 'data/')\nPDS_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data', 'pds...
python
chosen
[ { "from": "system", "value": "Test that con.execute() propagate Postgres exceptions\n" }, { "from": "human", "value": "import asyncpg\nfrom asyncpg import _testbase as tb\n\n\nclass TestExecuteScript(tb.ConnectedTestCase):\n\n async def test_execute_script_1(self):\n r = await self.con...
python
chosen
[ { "from": "system", "value": "Fix concurrency bug in ls tests\n" }, { "from": "human", "value": "from tests.framework.cli_testcase import CliTestCase\nfrom tests.framework.constants import GO_EP1_ID\n\n\nclass LsTests(CliTestCase):\n \"\"\"\n Tests globus ls command\n \"\"\"\n\n def ...
python
chosen
[ { "from": "system", "value": "Change publication date to Epub; more up-to-date\n" }, { "from": "human", "value": "import os.path\nimport string\nimport urllib, re\nfrom datetime import datetime\nfrom xml.dom.minidom import parse, parseString\n# Django\nfrom django.core import serializers\nfrom d...
python
chosen
[ { "from": "system", "value": "Make client.write_parquet_dataset available for export\n\nThis commit adds write_parquet_dataset to the imports from .client in\n__init__.py\n\nPreviously, `from json2parquet import write_parquet_dataset` would\nresult in an error: `ImportError: cannot import name\n'write_parqu...
python
chosen
[ { "from": "system", "value": "dist/docker: Fix typo in \"--overprovisioned\" help text\n\nReported by Mathias Bogaert (@analytically).\nMessage-Id: <13c4d4f57d8c59965d44b353c9e1b869295d4df3@scylladb.com>\n" }, { "from": "human", "value": "import argparse\n\n\ndef parse():\n parser = argparse....
python
chosen
[ { "from": "system", "value": "Add missing cascade deletes on user/roles\n" }, { "from": "human", "value": "from flask.ext.sqlalchemy import SQLAlchemy\nfrom flask.ext.security import UserMixin, RoleMixin\n\ndb = SQLAlchemy()\n\n### Add models here\n\nroles_users = db.Table('roles_users',\n db...
python
chosen
[ { "from": "system", "value": "Update renamed method (irrep -> decompose)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nHandles the \"Unicode\" unit format.\n\"\"\"\nfrom __future__ import absolute_import, divi...
python
chosen
[ { "from": "system", "value": "Make start_message_params optional in start_workflow()\n" }, { "from": "human", "value": "from django.db import transaction\n\nfrom yawf.config import DEFAULT_START_MESSAGE, WORKFLOW_TYPE_ATTR\nfrom yawf import get_workflow, get_workflow_by_instance\nfrom yawf impor...
python
chosen
[ { "from": "system", "value": "Allow compiled OS X app to take parameter file as input on command line\n" }, { "from": "human", "value": "\"\"\"\nMacroecoDesktop script for making standalone executable\n\"\"\"\n\nfrom macroeco import desktop\ndesktop()\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "system", "value": "Update max wait time in locust test script.\n" }, { "from": "human", "value": "from locust import HttpLocust, TaskSet, task\n\nclass WebsiteTasks(TaskSet):\n @task\n def index(self):\n self.client.get(\"/service\")\n\nclass WebsiteUser(HttpLocust):\n ...
python
chosen
[ { "from": "system", "value": "Add with_statement import for python2.5.\n\nSee http://www.python.org/dev/peps/pep-0343/ which describes\nthe with statement.\nReview URL: http://codereview.chromium.org/5690003\n\ngit-svn-id: e7e1075985beda50ea81ac4472467b4f6e91fc78@863 78cadc50-ecff-11dd-a971-7dbc132099af\n" ...
python
chosen
[ { "from": "system", "value": "Add a note about caching\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ansible, Inc..\n# All Rights Reserved.\n\nimport json\nfrom django.conf import settings as django_settings\nfrom awx.main.models.configuration import TowerSettings\n\nclass TowerConfigu...
python
chosen
[ { "from": "system", "value": "Add support for interactive rebase\n" }, { "from": "human", "value": "\"\"\"Git Commit Auto Save.\n\nSublime Text 3 package to auto save commit messages when the window is closed.\nThis allows the user to close the window without having to save before,\nor having to...
python
chosen
[ { "from": "system", "value": "[4.1] Update pwb version to 4.1\n\nThe current development is more than just bugfixes and i18n/L10N updates\n\nChange-Id: I581bfa1ee49f91161d904227e1be338db8361819\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Pywikibot metadata file.\"\"\"\n#\n#...
python
chosen
[ { "from": "system", "value": "Check if field exists, not if it's empty\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.meta.base import MetaBase\n\nclass Meta(MetaBase):\n name = 'Diesel Sweeties (web)'\n language = 'en'\n ...
python
chosen
[ { "from": "system", "value": "Add path for sqlite file\n" }, { "from": "human", "value": "import os\nimport platform\nfrom hatarake.version import __version__\n\nISSUES_LINK = 'https://github.com/kfdm/hatarake/issues'\nISSUES_API = 'https://api.github.com/repos/kfdm/hatarake/issues?state=open'\n...
python
chosen
[ { "from": "system", "value": "Add a dependency on WSME-Soap\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='demo',\n install_requires=[\n 'wsme',\n 'PasteScript',\n 'PasteDeploy',\n 'WSGIUtils',\n 'Pygments',\n ],\n packa...
python
chosen
[ { "from": "system", "value": "Set RRD STEP equal to REQUEST_INTERVAL.\n" }, { "from": "human", "value": "# Log config\nimport logging\n\nBASE_PATH = \"/home/user/workspace/OSHI-monitoring/\"\n\nRRD_LOG_PATH = BASE_PATH+\"logs/\"\nTRAFFIC_MONITOR_LOG_PATH = BASE_PATH+\"logs/\"\nLOG_LEVEL = loggin...
python
chosen
[ { "from": "system", "value": "Fix intflag on Python 3.5\n\nJust define it to IntEnum, which is definitely not going to be correct,\nbut this should fix the tests on Python 3.5\n" }, { "from": "human", "value": "# Copyright 2015 Sean Vig\n#\n# Licensed under the Apache License, Version 2.0 (the \...
python
chosen
[ { "from": "system", "value": "Add docstrings to Gist integration tests\n\n@esacteksab would be so proud\n" }, { "from": "human", "value": "from .helper import IntegrationHelper\n\nimport github3\n\n\nclass TestGist(IntegrationHelper):\n def test_comments(self):\n \"\"\"Show that a user...
python
chosen
[ { "from": "system", "value": "Use immutable arg rather mutable arg\n\nPassing mutable objects as default args is a known Python pitfall.\nWe'd better avoid this. This commit changes mutable default args with\nNone, then use 'arg = arg or []'.\n\nChange-Id: If3a10d58e6cd792a2011c177c49d3b865a7421ff\n" }, ...
python
chosen
[ { "from": "system", "value": "Remove sqlalchemy 0.7 warning (Binary => LargeBinary)\n" }, { "from": "human", "value": "#-*-*- encoding: utf-8 -*-*-\n#\n# Copyright (C) 2005-2009 University of Deusto\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n...
python
chosen
[ { "from": "system", "value": "Check if an association has an expiry time before deciding if it's expired" }, { "from": "human", "value": "import datetime\n\nfrom django.db import models\n\nfrom django.contrib.auth.models import User\n\n\nclass UserAssociation(models.Model):\n \n user = mod...
python
chosen
[ { "from": "system", "value": "Switch back to always write corpus.txt\n" }, { "from": "human", "value": "import sys\nimport mailbox\nimport mail_parser\nimport nltk\nimport itertools\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n\ndef main():\n \"\"\"Extract the ...
python
chosen
[ { "from": "system", "value": "Fix GoogleDrive OAuth callback URL in OAuth module.\n" }, { "from": "human", "value": "# -*- encoding:utf8 -*-\n\nimport os\nfrom oauth2client.client import OAuth2WebServerFlow\n\n\nclass OAuth:\n\n def __init__(self):\n pass\n\n def get_flow(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove unnecessary conditional in argument parsing" }, { "from": "human", "value": "import ircbotframe\nimport sys\n\nclass Handler:\n def __init__(self, host, port=6667, name=\"MediaWiki\", description=\"MediaWiki recent changes bot\", channels=[]):\n sel...
python
chosen
[ { "from": "system", "value": "Fix automatic reconnect (e.g. on bad auth key)\n\nThis took more time than it should have to debug.\n" }, { "from": "human", "value": "import struct\nfrom zlib import crc32\n\nfrom .connection import Connection\nfrom ...errors import InvalidChecksumError\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Update mock Account in tests.\n" }, { "from": "human", "value": "\"\"\" Test that the All Mail folder is enabled for Gmail. \"\"\"\nimport pytest\n\nfrom inbox.auth.gmail import GmailAuthHandler\nfrom inbox.basicauth import GmailSettingError\nfrom inbox.crispin impo...
python
chosen
[ { "from": "system", "value": "Handle case for error formatting where errors are a list of dictionaries (as you would see in bulk create).\n" }, { "from": "human", "value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException\n\n\ndef json_api_exception_handler...
python
chosen
[ { "from": "system", "value": "Address TODO comments in code\n" }, { "from": "human", "value": "import versioneer\ntry:\n from setuptools import setup\nexcept ImportError as err:\n print(\"Missing Python module requirement: setuptools.\")\n raise err\n\n\nsetup(\n name='tabpy-server',...
python
chosen
[ { "from": "system", "value": "Make the FunctionLogger a context manager\n" }, { "from": "human", "value": "from __future__ import absolute_import\nimport inspect\nimport os\nimport sys\nimport psutil\n\nfrom collections import namedtuple\nfrom functools import wraps\nfrom pikos.abstract_monitors...
python
chosen
[ { "from": "system", "value": "Fix typo in API URLs.\n" }, { "from": "human", "value": "from rest_framework import routers\n\nfrom . import views\n\n\nclass PeeringRootView(routers.APIRootView):\n \"\"\"\n Peering API root view\n \"\"\"\n\n def get_view_name(self):\n return \"P...
python
chosen
[ { "from": "system", "value": "Rewrite 'now' tag to use BasicNode\n" }, { "from": "human", "value": "from .library import Library\n\nimport datetime\n\nregister = Library()\n\n\n@register.tag(name='now')\ndef now(parser, token):\n\n args, kwargs = parser.parse_args(token)\n\n def _now(conte...
python
chosen
[ { "from": "system", "value": "Add failing test for gh-5\n" }, { "from": "human", "value": "import os\nfrom subprocess import call\nimport unittest\n\nfrom testpath.commands import *\n\nclass CommandsTests(unittest.TestCase):\n def test_assert_calls(self):\n initial_path = os.environ['P...
python
chosen
[ { "from": "system", "value": "Use absolute path for scikits.image.data_dir.\n" }, { "from": "human", "value": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\"\"\"\n\n\nimport os.path as _osp\n\ndata_dir = _osp.join(_osp.dirname(__file__), 'data')\n\nfrom version import version as __version__...
python
chosen
[ { "from": "system", "value": "Make test compatible with Python 2.6\n" }, { "from": "human", "value": "import moarjson as json\n\n\nclass User(object):\n\n def __init__(self, first_name, last_name):\n self.first_name = first_name\n self.last_name = last_name\n\n def full_name(...
python
chosen
[ { "from": "system", "value": "Remove assert in error-rasing test\n" }, { "from": "human", "value": "from pytest import raises\n\nfrom nirum.validate import (validate_boxed_type, validate_record_type,\n validate_union_type)\n\n\ndef test_validate_boxed_type():\n asse...
python
chosen
[ { "from": "system", "value": "Correct path in South triple definition.\n" }, { "from": "human", "value": "from django.db import models\n\nclass EnumField(models.Field):\n __metaclass__ = models.SubfieldBase\n\n def __init__(self, enumeration, *args, **kwargs):\n self.enumeration = e...
python
chosen
[ { "from": "system", "value": "Add requested call to check_args.\n" }, { "from": "human", "value": "\"\"\"\n\nStart the celery daemon from the Django management command.\n\n\"\"\"\nfrom __future__ import absolute_import, unicode_literals\n\nfrom celery.bin import worker\n\nfrom djcelery.app impor...
python
chosen
[ { "from": "system", "value": "Fix has no attribute on templatetags image_obj\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import template\nfrom ..generate import image_url as url\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef i...
python
chosen
[ { "from": "system", "value": "Add image crop on templatetags image_obj\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import template\nfrom ..generate import image_url as url\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef image_u...
python
chosen
[ { "from": "system", "value": "Add get log path to remote snapshot\n" }, { "from": "human", "value": "from constants import *\nfrom core_snapshot import CoreSnapshot\nimport logging\n\nlogger = logging.getLogger(APP_NAME)\n\nclass RemoteSnapshot(CoreSnapshot):\n def _get_path(self):\n d...
python
chosen
[ { "from": "system", "value": "Prepare to code the validator\n" }, { "from": "human", "value": "# coding: utf-8\n\n# Copyright 2013 Alan Justino da Silva, Oscar Vilaplana, et. al.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compli...
python
chosen
[ { "from": "system", "value": "Fix scraper skipping an entry at start.\n" }, { "from": "human", "value": "from Database import Database\nfrom Nyaa import Nyaa, NyaaEntry\nimport getopt\nimport os\nimport sys\n\nscript_dir = os.path.dirname(os.path.realpath(__file__))\nnt = Nyaa()\ndb = Database(s...
python
chosen
[ { "from": "system", "value": "nir: Remove spurious ; after nir_builder functions.\n\nMakes -pedantic happy.\n\nReviewed-by: Connor Abbott <71178acffcc112b21e5858656e5751f5e4aa9364@gmail.com>\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\ntemplate = \"\"\"\\\n/* Copyright (C) 2015 B...
python
chosen
[ { "from": "system", "value": "Add tests for marker_comment from ascott1/appendix-ref\n\nConflicts:\n\ttests/grammar_unified_tests.py\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom regparser.grammar.unified import *\n\n\nclass GrammarCommonTests(TestCase):\n\n def tes...
python
chosen
[ { "from": "system", "value": "Update relative import to work with python 3.6. ANL-10319\n" }, { "from": "human", "value": "from mongo_pool import MongoPool\nfrom pkg_resources import get_distribution, DistributionNotFound\nimport os.path\n\n__all__ = ['mongo_pool']\n\ntry:\n _dist = get_distr...
python
chosen
[ { "from": "system", "value": "Complete gcd recur sol w/ time/space complexity\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\n\ndef gcd(m, n):\n \"\"\"Greatest Common Divisor (GCD) by Euclid's...
python
chosen
[ { "from": "system", "value": "Fix removal of chat plugin\n" }, { "from": "human", "value": "from spock.plugins.core import auth, event, net, ticker, timer\nfrom spock.plugins.helpers import clientinfo, entities, interact, inventory,\\\n keepalive, movement, physics, respawn, start, world\n\nf...
python
chosen
[ { "from": "system", "value": "Fix testing in Django 1.6 by using the old test runner.\n" }, { "from": "human", "value": "from armstrong.dev.tasks import *\n\n\nsettings = {\n 'DEBUG': True,\n 'INTERNAL_IPS': ('127.0.0.1', ),\n 'INSTALLED_APPS': (\n 'django.contrib.admin',\n ...
python
chosen
[ { "from": "system", "value": "Add a skipped failing test for the result-repetition bug.\n" }, { "from": "human", "value": "\"\"\"Tests for string searches\"\"\"\n\nfrom nose.tools import eq_\n\nfrom dxr.testing import SingleFileTestCase, MINIMAL_MAIN\n\n\nclass StringTests(SingleFileTestCase):\n...
python
chosen
[ { "from": "system", "value": "Update powerline battery wrapper for new API\n" }, { "from": "human", "value": "from powerline.segments.common import bat, sys\n\ndef system_load(pl, num_avgs=3):\n return sys.system_load(pl)[:num_avgs]\n\ndef battery(pl, max_percent=101):\n if bat._get_capaci...
python
chosen
[ { "from": "system", "value": "Fix for request timer not always working.\n" }, { "from": "human", "value": "from time import time\nfrom logging import getLogger\n\n# From: https://djangosnippets.org/snippets/1866/\ndef sizify(value):\n \"\"\"\n Simple kb/mb/gb size snippet\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Fix provider_location column add for PSQL\n\nMigration 006 (commit 690cae58e6bbac5758ea2f7b60774c797d28fba5)\ndidn't work properly for postgres,\nthis patch corrects the upgrade by ensuring the execute\nis performed and the value is initialized to None.\n\nSince we haven't rele...
python
chosen
[ { "from": "system", "value": "Make if statement flake8 compliant\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\n\ndef add_css_class(widget, css_class):\n css_classes = widget.attrs.get('class', '').split()\n if not cs...
python
chosen
[ { "from": "system", "value": "Fix KeyError on Terminal integration\n" }, { "from": "human", "value": "import pprint\n\nfrom pysellus.interfaces import AbstractIntegration\n\n\nclass TerminalIntegration(AbstractIntegration):\n def on_next(self, message):\n print('Assert error: in {test_...
python
chosen
[ { "from": "system", "value": "Remove missing import (since b62968cd2666)\n\n--HG--\nbranch : distribute\nextra : rebase_source : d1190f895d794dfcb838f7eb40a60ab07b8b309e\n" }, { "from": "human", "value": "\"\"\"Used by pkg_resources to interpret PEP 345 environment markers.\"\"\"\nfrom _markerli...
python
chosen
[ { "from": "system", "value": "Exclude self and anonymous from message recipients in autocomplete.\n" }, { "from": "human", "value": "import json\nfrom django.contrib.auth import get_user_model\nfrom dajaxice.decorators import dajaxice_register\n\n\n@dajaxice_register(method=\"GET\")\ndef getuser...
python
chosen
[ { "from": "system", "value": "Fix a Python 2.4 incompatibility\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Search PyPI, the Python Package Index, and retrieve latest mechanize tarball.\n\n# This is just to demonstrate mechanize: You should use easy_install to do\n# this, not th...
python
chosen
[ { "from": "system", "value": "Add the actual functionality, lol.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n flaskext.urls\n ~~~~~~~~~~~~~\n\n A collection of URL-related functions for Flask applications.\n\n :copyright: (c) 2010 by Steve Losh.\n :license:...
python
chosen
[ { "from": "system", "value": "Fix forwarding ephemeral cluster exit code.\n\nSummary: Also improves logging a little bit.\n\nTest Plan:\n $ python ephemeral-cluster.py run --rm --entrypoint=bash pgshovel -c \"exit 10\"\n $ test $? -eq 10\n\nReviewers: jeff, tail\n\nReviewed By: tail\n\nDifferential Re...
python
chosen
[ { "from": "system", "value": "Fix backwards compatibility for postgresql backend on Django 1.10 and earlier\n" }, { "from": "human", "value": "import django\nimport psycopg2.extensions\n\nfrom django_prometheus.db.common import DatabaseWrapperMixin, \\\n ExportingCursorWrapper\n\nif django.VE...
python
chosen
[ { "from": "system", "value": "Print which DB will be cleared.\n" }, { "from": "human", "value": "\"\"\"Utility for clearing all keys out of redis -- do not use in production!\"\"\"\n\nimport sys\nfrom optparse import OptionParser\n\nimport redis\n\n\ndef option_parser():\n parser = OptionPars...
python
chosen
[ { "from": "system", "value": "Update branch to version 2.1.0 beta\n" }, { "from": "human", "value": "__version_info__ = {\n 'major': 2,\n 'minor': 0,\n 'micro': 19,\n 'releaselevel': 'beta',\n 'serial': 1\n}\n\ndef get_version(short=False):\n assert __version_info__['releaselev...
python
chosen
[ { "from": "system", "value": "Add echo nest to artist model\n" }, { "from": "human", "value": "from spotify_item import SpotifyItem\n\n\nclass Artist(SpotifyItem):\n\n def __init__(self, **entries):\n super(Artist, self).__init__(**entries)\n\n def __repr__(self):\n return '<...
python
chosen
[ { "from": "system", "value": "[tests] Use Python 3 .import syntax\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Sep 11 13:33:16 2013\n\n@author: steve\n\"\"\"\n\nfrom nose.tools import assert_equal\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom mdptoo...
python
chosen
[ { "from": "system", "value": "Disable W0611 warning, as the imported config variables are exposed to\nthe business logic from here.\n" }, { "from": "human", "value": "## $Id$\n##\n## This file is part of CDS Invenio.\n## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.\n##\n## CDS Invenio is fre...
python
chosen
[ { "from": "system", "value": "Allow client to customize page size using page[size] query param\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nfrom rest_framework import pagination\nfrom rest_framework.response import Response\nfrom rest_framework.utils.urls import (\n ...
python
chosen
[ { "from": "system", "value": "Add missing `__str__` to `Repository` model\n\nCan't use `@python_2_unicode_compatible` without defining `__str__`.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom djan...
python
chosen
[ { "from": "system", "value": "conan: Copy find modules to root of module path\n" }, { "from": "human", "value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.2\"\n\n\nclass ClangTidyTargetCMakeConan(ConanFile):\n name = \"clang-tidy-targ...
python
chosen
[ { "from": "system", "value": "Rename GH token env var\n\nGitHub disallows user set GITHUB_ prefixed ones.\n" }, { "from": "human", "value": "import os\nfrom pathlib import Path\nfrom string import Template\n\nfrom dotenv import load_dotenv\n\n\nload_dotenv() # helps with local dev\n\n\nTEMPLATE...
python
chosen
[ { "from": "system", "value": "Make the test a bit more verbose.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"An orange rectangle should be displayed on top of a green one. When you \nclick with the mouse, the green rectangle should move on top. When you release \nthe mous...
python
chosen
[ { "from": "system", "value": "Set page title for editor\n" }, { "from": "human", "value": "#encoding: utf-8\n\"\"\"Tornado handlers for the terminal emulator.\"\"\"\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nfrom tornado import web...
python
chosen
[ { "from": "system", "value": "Make the Api class the key focal point to accessing the API\n" }, { "from": "human", "value": "from . import requests\n\n\nclass Api(object):\n\n resources = {}\n\n def __init__(self, session=None, *args, **kwargs):\n super(Api, self).__init__(*args, **...
python
chosen
[ { "from": "system", "value": "Change the name of the verify/no-verify param\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n\"\"\"\n\nfrom __future__ import print_function, division\n\nimport ssl\n\nimport warnings\n\nimport requests\n\nfrom requests.adapters import HTTPAda...
python
chosen
[ { "from": "system", "value": "Make assertion message use same var as test\n\nEnsure that the assertion message correctly shows the value used by\nthe assertion test.\n" }, { "from": "human", "value": "from collections import OrderedDict\nfrom itertools import chain\n\nfrom ..utils.orderedtype im...
python
chosen
[ { "from": "system", "value": "Add changed_files support to mercurial\n" }, { "from": "human", "value": "from __future__ import unicode_literals, print_function\n\nimport logging\nimport subprocess\n\nfrom ..utils import _execute\nfrom .base import VCSBase\n\n\nlogger = logging.getLogger(__name__...
python
chosen
[ { "from": "system", "value": "Mark pudb post_mortem as debug-only, and optional.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom marrow.package.host import PluginManager\n\n\ndef indent(context, lines, padding='\\t'):\n\treturn padding + ('\\n' + padding).join(lines.split('\\n'))\n\...
python
chosen
[ { "from": "system", "value": "Install mysqlclient from HTTPs repo.\n\n-------------\nCreated by MOE: https://github.com/google/moe\nMOE_MIGRATED_REVID=263786009\n" }, { "from": "human", "value": "# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.\n#\n# Licensed under the Apache Li...
python
chosen
[ { "from": "system", "value": "Use old style string formatting to appease readthedocs aging 3.5 interpreter.\n" }, { "from": "human", "value": "# pyinfra\n# File: docs/conf.py\n# Desc: minimal Sphinx config\n\nfrom datetime import date, datetime\n\nfrom better import better_theme_path\n\nfrom pyi...
python
chosen
[ { "from": "system", "value": "Convert only disk_texture_2d textures with extension other than tx\n" }, { "from": "human", "value": "import appleseed as asr\nimport appleseed.studio as studio\nfrom appleseed.textureconverter import *\n\nimport sys\nimport logging\nlogging.basicConfig(level=loggin...
python
chosen
[ { "from": "system", "value": "Move some fixtures into better places\n\nMove datadir into the sipsecmon plugin and testname into\nlab.runnerctl.\n" }, { "from": "human", "value": "\"\"\"\npytest runner control plugin\n\"\"\"\nimport pytest\n\n\ndef pytest_runtest_makereport(item, call):\n if '...
python
chosen
[ { "from": "system", "value": "[IMP] Apply pre-commit changes: Resolve conflicts\n" }, { "from": "human", "value": "# Copyright (C) 2015 Therp BV <http://therp.nl>\n# Copyright (C) 2017 Komit <http://www.komit-consulting.com>\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).\n\n{\...
python
chosen