conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add online project scrape test\n\nChange-Id: Idc112f9397ac2f2fcfe51ca60259b257dff86e91\n" }, { "from": "human", "value": "import wikibugs\nimport configfetcher\nimport unittest\nimport os\n\np = os.path.split(__file__)[0]\n\n\nclass TestWikibugs(unittest.TestCase):\...
python
chosen
[ { "from": "system", "value": "Fix python 3 compat. BREAKS python 2.x\n" }, { "from": "human", "value": "import os\nimport json\n\nfrom jsonschema import Draft4Validator\n\n\ndef validate_mapping(mapping):\n \"\"\" Validate a mapping configuration file against the relevant schema. \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Increase sleep in test to reduce timing sensitivity with prod servers.\n" }, { "from": "human", "value": "\"\"\"Write some logs.\"\"\"\n\nimport sys\nimport time\n\nfrom mdk import start\nmdk = start()\n\n\ndef main():\n session = mdk.session()\n session.info(...
python
chosen
[ { "from": "system", "value": "Add __version__ variable to package\n" }, { "from": "human", "value": "from .kmapper import KeplerMapper\nfrom .kmapper import cluster\nfrom .kmapper import Cover\nfrom .kmapper import GraphNerve\n" }, { "from": "gpt", "value": "from .kmapper import Kepl...
python
chosen
[ { "from": "system", "value": "Add autofocus to subject field\n" }, { "from": "human", "value": "from django.forms import ModelForm,Textarea\n\n\nfrom .models import Post\n\n\nclass PostForm(ModelForm):\n class Meta:\n model = Post\n fields = ('subject','body')\n widgets =...
python
chosen
[ { "from": "system", "value": "Fix typo for named argument" }, { "from": "human", "value": "import tensorflow as tf\n\n\ndef masked_softmax_cross_entropy(preds, labels, mask):\n \"\"\"Softmax cross-entropy loss with masking.\"\"\"\n loss = tf.nn.softmax_cross_entropy_with_logits(logits=pred...
python
chosen
[ { "from": "system", "value": "Rewrite asyncio test to use futures\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport nose.tools as nt\nfrom asyncio import get_event_loop\nfrom asyncio import sleep as async_sleep\n\nfrom pyee import EventEmitter\n\n\ndef test_async_emit():\n ...
python
chosen
[ { "from": "system", "value": "Connect to database before upgrading it\n\nThis change ensure we are connected to the database before\nwe upgrade it.\n\nChange-Id: Ia0be33892a99897ff294d004f4d935f3753e6200\n" }, { "from": "human", "value": "# Copyright (c) 2013 Mirantis Inc.\n#\n# Licensed under t...
python
chosen
[ { "from": "system", "value": "Fix for pycharm 4.0.0 changes\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport threading\n\n\ndef pytest_exception_interact(node, call, report):\n \"\"\"\n Drop into PyCharm debugger, if available, on uncaught exceptions.\n \"\"\"\n try...
python
chosen
[ { "from": "system", "value": "Fix stopping on a breakpoint for PyCharm 2017.3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport threading\n\n\ndef pytest_exception_interact(node, call, report):\n \"\"\"\n Drop into PyCharm debugger, if available, on uncaught exceptions.\n ...
python
chosen
[ { "from": "system", "value": "Update to use newest (unreleased) scriptcwl options\n" }, { "from": "human", "value": "from scriptcwl import WorkflowGenerator as WFGenerator\n\nfrom .utils import CWL_PATH\n\n\nclass WorkflowGenerator(WFGenerator):\n def __init__(self, working_dir=None, copy_ste...
python
chosen
[ { "from": "system", "value": "Use level_tag to be consistent with Django >= 1.7\n" }, { "from": "human", "value": "from django import template\nfrom django.contrib.messages.utils import get_level_tags\n\n\nLEVEL_TAGS = get_level_tags()\n\nregister = template.Library()\n\n\n@register.simple_tag()...
python
chosen
[ { "from": "system", "value": "Raise an error on dummy class init\n" }, { "from": "human", "value": "import sys\n\n\nif sys.version_info[0] < 3:\n _available = False\nelse:\n try:\n from chainerx import _core\n _available = True\n except Exception:\n _available = Fal...
python
chosen
[ { "from": "system", "value": "Handle missing fields in dataverse\n" }, { "from": "human", "value": "import arrow\n\nimport dateparser\n\nfrom share.normalize import *\n\n\nclass Person(Parser):\n given_name = ParseName(ctx).first\n family_name = ParseName(ctx).last\n additional_name = P...
python
chosen
[ { "from": "system", "value": "Update alembic order for merging\n" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 538eeb160af6\nRevises: 1727fb4309d8\nCreate Date: 2015-09-17 04:22:21.262285\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '538eeb160af6'\ndow...
python
chosen
[ { "from": "system", "value": "Set long description content type to markdown\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import un...
python
chosen
[ { "from": "system", "value": "Add httplib2 as a test dependency.\n" }, { "from": "human", "value": "#! /usr/bin/env python\nfrom setuptools import setup, find_packages\n\n\nsetup(\n name='armet',\n version='0.3.0-pre',\n description='Clean and modern framework for creating RESTful APIs....
python
chosen
[ { "from": "system", "value": "Make README publishing more conservative\n" }, { "from": "human", "value": "\"\"\"\nUsage instructions:\n\n- If you are installing: `python setup.py install`\n- If you are developing: `python setup.py sdist bdist --format=zip bdist_wheel --universal`\n\"\"\"\n\ntry:...
python
chosen
[ { "from": "system", "value": "Add group name to volunteer string representation\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.core.validators import MinValueValidator\n\n\nclass Volunteer(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Remove per patch version classifiers" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\nfrom setuptools import find_packages\nimport re\n\n\ndef find_version():\n return re.search(r\"^__version__ = '(.*)'$\",\n ...
python
chosen
[ { "from": "system", "value": "Add tested python version in classifiers\n" }, { "from": "human", "value": "from setuptools import setup\nimport generate\n\ngenerate.run()\n\nsetup(\n name='nnpy',\n version='0.1',\n url='https://github.com/nanomsg/nnpy',\n license='MIT',\n author='D...
python
chosen
[ { "from": "system", "value": "Drop upper version bound on pandas\n\nThere's really no reason for having it.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom setuptools import find_packages, setup\n\nsetup(name='oemof.db',\n # Unfortunately we can't use a `__version__` attri...
python
chosen
[ { "from": "system", "value": "Remove cube credentials from import script\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport django.contrib.auth.models as auth_models\nimport django.contrib.contenttypes as contenttypes\n\n\ndef main():\n # Read only user:\n # auth_models.User.ob...
python
chosen
[ { "from": "system", "value": "Add unidecode as a dependency\n" }, { "from": "human", "value": "import re\nfrom setuptools import setup\n\ninit_py = open('wikipediabase/__init__.py').read()\nmetadata = dict(re.findall(\"__([a-z]+)__ = '([^']+)'\", init_py))\nmetadata['doc'] = re.findall('\"\"\"(....
python
chosen
[ { "from": "system", "value": "Tag updated and download link added\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\nfrom setuptools import find_packages\n\nsetup(\n name='MobOff',\n version='0.1',\n py_modules=['moboff'],\n packages=find_pa...
python
chosen
[ { "from": "system", "value": "Fix false positive octal syntax warning\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport urllib\nimport zipfile\n\nscript_path = os.path.dirname(os.path.realpath(__file__))\npacker_archive_path = script_path + \"/packer.zip\"\nbin_path =...
python
chosen
[ { "from": "system", "value": "Increase to version 0.3.11 due to TG-dev requiring it for ming support\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os\n\nversion = '0.3.10'\nhere = os.path.abspath(os.path.dirname(__file__))\ntry:\n README = open(os.path...
python
chosen
[ { "from": "system", "value": "Add PyYAML & numpy dependency\n\nI'm adding numpy too because we import it directly.\n" }, { "from": "human", "value": "#! /usr/bin/python\n\"\"\"Setuptools-based setup script for datreant.\n\nFor a basic installation just type the command::\n\n python setup.py ins...
python
chosen
[ { "from": "system", "value": "Add siprefix to runtime dependencies.\n" }, { "from": "human", "value": "from setuptools import setup\nfrom os import path\n\nhere = path.abspath(path.dirname(__file__))\nwith open(path.join(here, 'README.rst')) as readme_file:\n long_description = readme_file.re...
python
chosen
[ { "from": "system", "value": "Change the URL of the package\n" }, { "from": "human", "value": "import os\nimport sys\ntry:\n\tfrom setuptools import setup\nexcept:\n\tfrom distutils.core import setup\nfrom distutils.command.build_py import build_py\n\npath, script = os.path.split(sys.argv[0])\no...
python
chosen
[ { "from": "system", "value": "Rename command addon to bdist_blender_addon\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nfrom buildcmds.addon import addon\n\nsetup(\n name='io_scene_previz',\n\n # Versions should comply with PEP440. For a discussion on s...
python
chosen
[ { "from": "system", "value": "Increment version to suport Python 2.6." }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name=\"pocketlint\",\n description=\"Pocket-lint a composite linter and style checker.\",\n version=\"0.5.7\",\n maintainer=\"Curtis C. ...
python
chosen
[ { "from": "system", "value": "Support is actually py >= 35\n" }, { "from": "human", "value": "import sys\nfrom setuptools import setup\n\n\n# Be verbose about Python < 3.4 being deprecated.\nif sys.version_info < (3, 4):\n print('\\n' * 3 + '*' * 64)\n print('lastcast requires Python 3.4+,...
python
chosen
[ { "from": "system", "value": "Add a dependency on Scrapy\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import find_packages, Command\n\n\nsetup_params = dict(\n name='bugimporters',\n version=0.1,\n author='Various contributers to the OpenHatch project, Berry...
python
chosen
[ { "from": "system", "value": "Set zip_safe=False. Bump version to 1.3.\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='firebase-token-generator',\n version='1.2',\n author='Greg Soltis',\n author_email='greg@firebase.com',\n py_modules=['fireb...
python
chosen
[ { "from": "system", "value": "Add path to requirements.txt so installation from pip succeeds\n\ncf http://lorenamesa.com/packaging-my-first-python-egg.html\n" }, { "from": "human", "value": "from pip.download import PipSession\nfrom pip.req import parse_requirements\nfrom setuptools import setup...
python
chosen
[ { "from": "system", "value": "Add pre-install protobuf gen script\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\nreqs_file = os.path.join(os.path.dirname(os.path.realpath(__file__))\n , \"requirements.txt\")\n...
python
chosen
[ { "from": "system", "value": "Fix pip parse_requirements for v0.6+.\n" }, { "from": "human", "value": "from setuptools import find_packages\nfrom setuptools import setup\nfrom pip import req\n\n_install_requirements = req.parse_requirements('requirements.txt')\n\n\nsetup(\n name='jetway',\n ...
python
chosen
[ { "from": "system", "value": "Set maintainer and add dependencies to distutils config\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(name='pyresttest',\n version='0.1',\n description='Python Rest Testing',\n maintainer='Naveen Malik',\n maintainer_email=...
python
chosen
[ { "from": "system", "value": "Use again jedi==0.8.1. (This was pushed to pypi.)\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\n\n\nsetup(\n name='prompt_toolkit',\n author='Jonathan Slenders',\n version='0.25',\n ...
python
chosen
[ { "from": "system", "value": "Add custom command to build the manpage\n\nRemembering the exact pandoc incantation is annoying\n" }, { "from": "human", "value": "#!/usr/bin/python3\n# SPDX-License-Identifier: LGPL-2.1+\n\nimport sys\n\nfrom setuptools import setup\n\nif sys.version_info < (3, 6):...
python
chosen
[ { "from": "system", "value": "Add new model option to add field options if exist (radio/checkbox)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom opps.boxes.models imp...
python
chosen
[ { "from": "system", "value": "Add in API testing version\n\nSigned-off-by: Chris Wisecarver <5fccdd17c1f7bcc7e393d2cb5e2fad37705ca69f@cos.io>\n" }, { "from": "human", "value": "# Use API defaults. This allows these settings to work with API tests\nfrom api.base.settings.defaults import * # noqa...
python
chosen
[ { "from": "system", "value": "apps/documents: Work around a migration issue in sqlite\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.db import models\n\n\nclass Migration(migrations.Migration):\...
python
chosen
[ { "from": "system", "value": "Add build as available environment\n" }, { "from": "human", "value": "\"\"\"Create IAM Instance Profiles, Roles, Users, and Groups.\"\"\"\nimport argparse\nimport logging\n\nfrom .create_iam import create_iam_resources\n\nLOG = logging.getLogger(__name__)\n\n\ndef m...
python
chosen
[ { "from": "system", "value": "Add attribute 'is_unset' so that the interface is consistent with MissingTohuItemsCls\n" }, { "from": "human", "value": "import attr\n\n__all__ = [\"make_tohu_items_class\"]\n\n\ndef make_tohu_items_class(clsname, field_names):\n \"\"\"\n Parameters\n -----...
python
chosen
[ { "from": "system", "value": "Fix build wheels and upload 4.\n" }, { "from": "human", "value": "from subprocess import call, check_output\nimport sys\nimport os\n\nisPython3 = sys.version_info.major == 3\n\n# https://stackoverflow.com/a/3357357\ncommand = 'git log --format=%B -n 1'.split()\nout ...
python
chosen
[ { "from": "system", "value": "Correct PEP8 indendation issue in client example\n" }, { "from": "human", "value": "#!/bin/python\n\nimport removinator\nimport subprocess\n\n# This example cycles through each card slot in the Removinator. Any\n# slots that have a card present will then have the c...
python
chosen
[ { "from": "system", "value": "Return a helpful exception if API is uncontactable" }, { "from": "human", "value": "\"\"\"\n@fileoverview Digital Ocean API\n@author David Parlevliet\n@version 20130315\n@preserve Copyright 2013 David Parlevliet.\n\nDigital Ocean API\n=================\nClass to get...
python
chosen
[ { "from": "system", "value": "Make database filepath configurable on History\n" }, { "from": "human", "value": "\nclass History:\n def __init__(self):\n self.conn = sqlite3.connect('.history.db')\n\n" }, { "from": "gpt", "value": "import sqlite3\n\nclass History:\n def _...
python
chosen
[ { "from": "system", "value": "Make sure that ID will not match the first CartItems rule EVERY time (\"//\" was in regex)." }, { "from": "human", "value": "from django.conf.urls.defaults import url, patterns\n\nfrom shop.views.cart import CartDetails, CartItemDetail\n\n\nurlpatterns = patterns(''...
python
chosen
[ { "from": "system", "value": "Tidy up this test - still quite bad & useless.\n" }, { "from": "human", "value": "'''\nSystem tests for `jenkinsapi.jenkins` module.\n'''\nimport re\nimport time\nimport unittest\n\nfrom jenkinsapi_tests.systests.base import BaseSystemTest\nfrom jenkinsapi_tests.sys...
python
chosen
[ { "from": "system", "value": "Add WHERE clause to SQL data migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('kbadge', '0...
python
chosen
[ { "from": "system", "value": "Use Production config unless specified\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask, jsonify\nfrom flask_pymongo import PyMongo, BSONObjectIdConverter\nfrom werkzeug.exceptions import HTTPException, default_exceptions\n\nfrom core.api impo...
python
chosen
[ { "from": "system", "value": "Add intersection test for rectangles\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom collections import namedtuple\n\nSize = namedtuple(\"Size\", [\"width\", \"height\"])\nRectangle = namedtuple(\"Rectangle\", [\"x0\", \"y0\", \"x1\", \"y1\"])\n\ncl...
python
chosen
[ { "from": "system", "value": "Change repeat command to return a list of the results of the repeated commands\n" }, { "from": "human", "value": "import vx\n\nfrom contextlib import contextmanager\nfrom functools import partial\n\nimport sys\nfrom io import StringIO\n\ndef _expose(f=None, name=Non...
python
chosen
[ { "from": "system", "value": "Fix currencies seeding, so it won't have empty currencies\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom extra_countries.models import ExtraCountry\n\n\ndef add_currenci...
python
chosen
[ { "from": "system", "value": "Add a group in the whitelist.\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nCIS_GROUPS = [\n 'cis_whitelist',\n 'nda'\n]\n\n\ndefault_app_config = 'mozillians.groups.GroupConfig'\n\n\nclass GroupConfig(AppConfig):\n name = 'mozil...
python
chosen
[ { "from": "system", "value": "Return sms_keyword as wall name\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\nimport string, random\nfrom django import forms\n# Create your models here.\ndef _generate_default_hashtag():\n return \"...
python
chosen
[ { "from": "system", "value": "Test file existence for brain-dead Jaguar.\n" }, { "from": "human", "value": "# Print embeddable python library, as well as other libs it requires.\n# Will prefer static linkage unless invoked with \"shared\" argument.\n# JGG, 8/4/04\n\nimport sys, distutils.sysconf...
python
chosen
[ { "from": "system", "value": "Fix database migration script for UUID field in invoice item model.\n" }, { "from": "human", "value": "import uuid\n\nfrom django.db import migrations\n\nimport waldur_core.core.fields\n\n\ndef gen_uuid(apps, schema_editor):\n InvoiceItem = apps.get_model('invoic...
python
chosen
[ { "from": "system", "value": "Generalize name of function to inject admin template variables\n" }, { "from": "human", "value": "\"\"\"\nbyceps.blueprints.core_admin.views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for de...
python
chosen
[ { "from": "system", "value": "Add BOM signature to test fixture\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\nclass Person:\n def __init__(self, first_name, last_name):\n self.first_name = first_name\n self.last_name = last_name\n\n def fullname(self):\n ...
python
chosen
[ { "from": "system", "value": "Disable pylint check for names existing in modules for test data\n\nThis test data imports from modules which are only available via\nPluginLoader for this test case. So pylint doesn't know anything about\nthem\n" }, { "from": "human", "value": "#!/usr/bin/python\n...
python
chosen
[ { "from": "human", "value": "Add abstract Broadcast protocol class\n" }, { "from": "gpt", "value": "from abc import ABCMeta, abstractmethod\nfrom enum import Enum\n\n\nclass Broadcast(metaclass=ABCMeta):\n \"\"\"\n An interface for defining a broadcast protocol.\n The 'propose' and 'dec...
python
chosen
[ { "from": "system", "value": "Fix bug in read tracking system\n" }, { "from": "human", "value": "def update_read_tracking(topic, user):\n tracking = user.readtracking\n\n #if last_read > last_read - don't check topics\n if tracking.last_read and tracking.last_read > (topic.last_post.upd...
python
chosen
[ { "from": "system", "value": "Add some tests for intersection\n" }, { "from": "human", "value": "from intervals import Interval\n\n\nclass TestArithmeticOperators(object):\n def test_add_operator(self):\n assert Interval(1, 2) + Interval(1, 2) == Interval(2, 4)\n\n def test_sub_oper...
python
chosen
[ { "from": "system", "value": "Fix failing test through loading of examples from $PWD.\n" }, { "from": "human", "value": "import pylearn2\nfrom pylearn2.utils.serial import load_train_file\nimport os\nfrom pylearn2.testing import no_debug_mode\nfrom theano import config\n\n@no_debug_mode\ndef tes...
python
chosen
[ { "from": "system", "value": "Add restart_build action to BuildAdmin\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\nfrom django.contrib import admin\n\nfrom .models import Build, BuildResult, Project\n\n\nclass BuildResultInline(admin.StackedInline):\n model = BuildResult\n rea...
python
chosen
[ { "from": "system", "value": "Add user data export for bounce handling" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass BounceConfig(AppConfig):\n name = 'froide.bounce'\n verbose_name = _('Bounce')\n\n ...
python
chosen
[ { "from": "system", "value": ":white_check_mark: Update completion tests, checking for printed message\n" }, { "from": "human", "value": "import os\nimport subprocess\nimport sys\nfrom pathlib import Path\n\nimport typer\nfrom typer.testing import CliRunner\n\nfrom first_steps import tutorial001...
python
chosen
[ { "from": "system", "value": "Add very brief comments about the event types\n" }, { "from": "human", "value": "from collections import defaultdict\nimport traceback\n\n\nLINT_START = 'LINT_START'\nLINT_RESULT = 'LINT_RESULT'\nLINT_END = 'LINT_END'\n\n\nlisteners = defaultdict(set)\n\n\ndef subsc...
python
chosen
[ { "from": "system", "value": "Allow the free SMS fragment limit to be 0\n\nThis updates the schema so that the free allowance has a minimum value\nof 0 instead of 1.\n" }, { "from": "human", "value": "from datetime import datetime\n\ncreate_or_update_free_sms_fragment_limit_schema = {\n \"$sc...
python
chosen
[ { "from": "system", "value": "Use display.show instead of display.animate\n" }, { "from": "human", "value": "from microbit import *\n\nhands = Image.ALL_CLOCKS\n\n#A centre dot of brightness 2.\nticker_image = Image(\"2\\n\").crop(-2,-2,5,5)\n\n#Adjust these to taste\nMINUTE_BRIGHT = 0.1111\nHOU...
python
chosen
[ { "from": "system", "value": "Make _runQuery to fail if the query fails, but still hide the execution messages\n" }, { "from": "human", "value": "from fabric.api import sudo, quiet\nfrom braid import package\nfrom pipes import quote\n\n\ndef install():\n package.install(['postgresql-9.1', 'po...
python
chosen
[ { "from": "system", "value": "Restructure KDS options to be more like Keystone's options\n\nRestructure the KDS options to be more closely aligned with the way\nKeystone options work and allowing movement towards not registering\nthe options on import. This will also prevent KDS options from\nappearing in t...
python
chosen
[ { "from": "system", "value": "Add log error if we run salt-api w/ no config\n\nCurrently, the salt-api script will exit with no error or hint of why it\nfailed if there is no netapi module configured. Added a short line if\nwe find no api modules to start, warning the user that the config may be\nmissing.\...
python
chosen
[ { "from": "system", "value": "Add comments explaining prediction data structure\n" }, { "from": "human", "value": "# Based on modeprediction.py\nimport emission.core.wrapper.wrapperbase as ecwb\n\nclass Labelprediction(ecwb.WrapperBase):\n props = {\"trip_id\": ecwb.WrapperBase.Access.WORM,...
python
chosen
[ { "from": "system", "value": "Remove old dependency to kit from euth frontend\n" }, { "from": "human", "value": "\"\"\"Adhocracy frontend customization package.\"\"\"\nimport os\nimport version\n\nfrom setuptools import setup, find_packages\n\nhere = os.path.abspath(os.path.dirname(__file__))\nR...
python
chosen
[ { "from": "system", "value": "meta-iotqa: Remove Edison specific command from Bluetooth test\n\nThe platform isn't supported anymore and the command isn't needed with\ncurrent devices.\n\nSigned-off-by: Simo Kuusela <4755938158c3c622d3884e9a75ed20dc865bc695@intel.com>\n" }, { "from": "human", "v...
python
chosen
[ { "from": "system", "value": "Include tornado and babel version info in bug report\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport uuid\nimport base64\nimport os.path\n\nfrom .. import __version__\n\n\ndef gen_cookie_secret():\n return base64.b64encode(uuid...
python
chosen
[ { "from": "system", "value": "Check email update on branch for YT only\n" }, { "from": "human", "value": "# LIBTBX_SET_DISPATCHER_NAME dev.dials.rebin_images\n\nfrom __future__ import division\n\ndef rebin_images(in_template, out_template, start, end):\n from dials.util.rebin_images import main...
python
chosen
[ { "from": "system", "value": "Use super() and self within the Cipher and Caesar classes\n" }, { "from": "human", "value": "import math\nimport secrets\nfrom string import ascii_lowercase\n\n\nclass Cipher(object):\n def __init__(self, key=None):\n if not key:\n key = Cipher....
python
chosen
[ { "from": "system", "value": "Update description and timestamp for dynamic programming part 1\n" }, { "from": "human", "value": "title=\"Notes on dynamic programming - part 1\"\ndescription=\"\"\" \nPart 1 of extensive notes discussing the fundamentals of dynamic programming.\nExamples in these ...
python
chosen
[ { "from": "system", "value": "Add test for user with missing credentials\n" }, { "from": "human", "value": "import unittest\nfrom flask import json\nfrom api import db\nfrom api.BucketListAPI import app\nfrom instance.config import application_config\n\n\nclass AuthenticationTestCase(unittest.Te...
python
chosen
[ { "from": "system", "value": "Add support for `n` Node.js version manager\n" }, { "from": "human", "value": "import os\nimport platform\nimport subprocess\n\nIS_MACOS = platform.system() == 'Darwin'\nIS_WINDOWS = platform.system() == 'Windows'\n\ndef node_bridge(data, bin, args=[]):\n\tenv = Non...
python
chosen
[ { "from": "system", "value": "Patch from chrischambers to enable south migrations.\n" }, { "from": "human", "value": "from django.db.models import ForeignKey\nfrom django.contrib.auth.models import User\n\nimport threadlocals\n\n\nclass UserField(ForeignKey):\n \"\"\" UserField\n\n By defa...
python
chosen
[ { "from": "system", "value": "Make sure we invoke the response processors even for app content.\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import permission_required\nfrom django.shortcuts import get_object_or_404, render_to_response\nfrom django.template import Reque...
python
chosen
[ { "from": "system", "value": "Use ; instead of , for Shibboleth multi value fields\n\nThis corresponds to what mod_shibboleth does.\n" }, { "from": "human", "value": "from pylons import config\n\n\ndef get_userbadge_mapping(config=config):\n mapping = config.get('adhocracy.shibboleth.userbadg...
python
chosen
[ { "from": "system", "value": "P007: Check only odd numbers after 2\n" }, { "from": "human", "value": "\"\"\"Solution to Project Euler Problem 7\nhttps://projecteuler.net/problem=7\n\"\"\"\n\nINDEX = 10001\n\n\ndef compute(index=INDEX):\n \"\"\"Find the `index`th prime number.\"\"\"\n\n pri...
python
chosen
[ { "from": "system", "value": "Add error output to exec error messages\n\ne.g. for an error like \"env: ‘node’: No such file or directory\"\nthe sublime console was only reporting \"exited with code 127\"\nwhich wasn't very helpful in determining the cause.\n" }, { "from": "human", "value": "impo...
python
chosen
[ { "from": "system", "value": "Rewrite alt_tz as proper fixture. Skip when tzset isn't available.\n" }, { "from": "human", "value": "import datetime\nimport time\nimport contextlib\nimport os\nfrom unittest import mock\n\nfrom tempora import timing\n\n\ndef test_IntervalGovernor():\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Update regex to match sentences starting with ÅÄÖ\n" }, { "from": "human", "value": "import textract\nimport sys\nimport os\nimport re\nimport random\n\n###################################\n# Extracts text from a pdf file and\n# selects one sentence, which it\n# the...
python
chosen
[ { "from": "system", "value": "Allow user access to remote flag" }, { "from": "human", "value": "# Copyright 2020 Google LLC. 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# You may...
python
chosen
[ { "from": "system", "value": "Raise AttributeError if key does not exist when trying to get it from a Record\n" }, { "from": "human", "value": "class Metadata(object):\n def __init__(self, name, value):\n self.name = name\n self.value = value\n\n def __repr__(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove max_length from TextFields and replace short text fields with CharFields\n" }, { "from": "human", "value": "\"\"\"Social auth models\"\"\"\nfrom django.db import models \nfrom django.contrib.auth.models import User\n\n\nclass UserSocialAuth(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Complete removal of reversion usage\n" }, { "from": "human", "value": "#\n# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU Affero General Public License a...
python
chosen
[ { "from": "system", "value": "Add help text describing the image field functionality.\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Sponsor(models.Model):\n name = models.CharField(max_length=255)\n website = models.URLField(max_length=500)\n image = models....
python
chosen
[ { "from": "system", "value": "Increase number of Kociemba test iterations to 100\n" }, { "from": "human", "value": "from src.Move import Move\nfrom src.NaiveCube import NaiveCube\nfrom src.Cubie import Cube\nfrom src.Solver import Kociemba\nimport timeout_decorator\nimport unittest\n\n\nclass Te...
python
chosen
[ { "from": "system", "value": "Add loop to the python example\n" }, { "from": "human", "value": "from gi.repository import Zeitgeist\nlog = Zeitgeist.Log.get_default()\n\ndef callback (x):\n print x\n\nlog.get_events([x for x in xrange(100)], None, callback, None) \n" }, { "from": "gp...
python
chosen