conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove an old filter reference\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom django import template\nfrom django.http import QueryDict\n\nfrom classytags.core import Tag, Options\nfrom classytags.arguments import MultiKeywordArgument, MultiValueArgume...
python
chosen
[ { "from": "system", "value": "Add newsig.c as a dependency to sigtools module.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@5176 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\ndef configuration(parent_package='',top_path=None):\n fr...
python
chosen
[ { "from": "system", "value": "Fix missing newline at EOF\n" }, { "from": "human", "value": "from abundsolar import elsolarlogepsilon\n\nzfactor = 10 ** -1.92\n# Smith et al. (2000) ROA 219 in Omega Centauri\n# [Fe/H] is about ~-1.7\n#logxtofe = log epsilon(X) - log epsilon(Fe)\ntargetlogxtofe = ...
python
chosen
[ { "from": "system", "value": "Add placeholders for new secondary repo details\n" }, { "from": "human", "value": "\"\"\"\nFile to easily switch between configurations between production and\ndevelopment, etc.\n\"\"\"\n\nimport os\n\n\n# You must set each of these in your heroku environment with t...
python
chosen
[ { "from": "system", "value": "Remove redundant keyword argument from create_test_args\n" }, { "from": "human", "value": "import os\nimport yaml\n\n\ndef read_file(path):\n with open(path) as f:\n return f.read()\n\n\nPVT_KEY_FILE = os.path.join(os.path.dirname(__file__), \"id_rsa\")\nP...
python
chosen
[ { "from": "system", "value": "Set up the DB schema for posts.\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\n\nclass Author(models.Model):\n name = models.CharField(max_le...
python
chosen
[ { "from": "system", "value": "Update client version to 1.3.0\n" }, { "from": "human", "value": "__all__ = ['client', 'user_auth', 'aws_auth', 'util']\n\nCLIENT_VERSION = '1.2.0'\n\n\nclass CerberusClientException(Exception):\n \"\"\"Wrap third-party exceptions expected by the Cerberus client....
python
chosen
[ { "from": "system", "value": "Fix a small docstring bug.\n" }, { "from": "human", "value": "#------------------------------------------------------------------------------\n# Copyright (c) 2012, Enthought, Inc.\n# All rights reserved.\n#---------------------------------------------------------...
python
chosen
[ { "from": "system", "value": "Change code-account name triggered during creation\n" }, { "from": "human", "value": "from accounts import models, names\n\n\ndef ensure_core_accounts_exists(sender, **kwargs):\n # We only create core accounts the first time syncdb is run\n if models.Account.o...
python
chosen
[ { "from": "system", "value": "Set sample rate to 1.0\n" }, { "from": "human", "value": "# Initialize Sentry\nimport sentry_sdk\n\nsentry_sdk.init(\n \"https://95c4106659044cbda2ea0fe499f4be7e@o323465.ingest.sentry.io/5445901\",\n traces_sample_rate=0.5\n)\n\nfrom socli.socli import main\nm...
python
chosen
[ { "from": "system", "value": "MSS: Fix pylint: Import outside toplevel (%s) (import-outside-toplevel)\n" }, { "from": "human", "value": "\"\"\"\nThis is part of the MSS Python's module.\nSource: https://github.com/BoboTiG/python-mss\n\"\"\"\n\nimport platform\nfrom typing import TYPE_CHECKING\n\...
python
chosen
[ { "from": "system", "value": "Rename the generic model to Document\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contric.auth.models import User\nfrom django.template.defaultfilters import slugify\n\n\n#class MyModel(models.Model):\n# title = models.CharField(ma...
python
chosen
[ { "from": "system", "value": "Handle resources with no outputs\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport json\n\nfrom . import ATTRIBUTE_SPECIFICATION_PATH, REF_SPECIFICATION_PATH\n\n\nclass OutputSpecification(object):\n\n def __init__(\n self, attribute...
python
chosen
[ { "from": "system", "value": "Allow running tests with postgres\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom os.path import dirname, abspath\n\nfrom django.conf import settings\n\nif not settings.configured:\n settings.configure(\n DATABASE_ENGINE = 'sqlit...
python
chosen
[ { "from": "system", "value": "Add the RLS client import to init file\n\nSigned-off-by: drummersbrother <d12fd520b57756512907f841763cabff8eb36464@icloud.com>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__author__ = 'Hugo Berg'\n__email__ = 'hb11002@icloud.com'\n__version__ = '0....
python
chosen
[ { "from": "system", "value": "Allow to configure the virtualenv path from the Apache configuration\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for moocng project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It ...
python
chosen
[ { "from": "system", "value": "Add links to Android/iOS apps\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- #\nfrom __future__ import unicode_literals\n\nAUTHOR = u'Mappy'\nSITENAME = u'Mappy Labs'\nSITEURL = ''\n\nTIMEZONE = 'Europe/Paris'\n\nDEFAULT_LANG = u'e...
python
chosen
[ { "from": "system", "value": "Work around for SERVER_SOFTWARE not being set\n" }, { "from": "human", "value": "import os\n\nDEBUG = os.environ['SERVER_SOFTWARE'].startswith('Dev')\n\n# The CONFIG variables should have exactly the same structure between environments\n# Eventually a test environme...
python
chosen
[ { "from": "system", "value": "Write a function to covert far to kelvin\n" }, { "from": "human", "value": "def k_to_c(temp):\n\treturn temp - 273.15\n" }, { "from": "gpt", "value": "def k_to_c(temp):\n\treturn temp - 273.15\n\ndef f_to_k(temp):\n\treturn ((temp - 32) * (5 / 9)) + 273....
python
chosen
[ { "from": "system", "value": "Add optional hi and lo params to reverse_insort\n" }, { "from": "human", "value": "def reverse_insort(seq, val):\n lo = 0\n hi = len(seq)\n while lo < hi:\n mid = (lo + hi) // 2\n if val > seq[mid]:\n hi = mid\n else:\n ...
python
chosen
[ { "from": "system", "value": "Raise assertion error when creating a device with no pv\n" }, { "from": "human", "value": "from pml.exceptions import PvException\nimport pml.device\nimport pytest\nimport mock\n\n\n@pytest.fixture\ndef create_device(readback, setpoint):\n _rb = readback\n _sp...
python
chosen
[ { "from": "system", "value": "Fix a packaging bug and make sure we also include templates directory.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed ...
python
chosen
[ { "from": "system", "value": "Update QLDB per 2021-07-22 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n#\n# *** Do not modify - this file is autogenerated ***\n# Resource specifica...
python
chosen
[ { "from": "system", "value": "Add a correct parsing of the file\n" }, { "from": "human", "value": "#! /bin/python\nimport argparse\nfrom xml.dom import minidom\n\nparser = argparse.ArgumentParser(description='Parse a dive in xml formt.')\nparser.add_argument('-f', '--file', required=True,\n\t\t...
python
chosen
[ { "from": "system", "value": "Fix simple typo: specifcally -> specifically\n\nCloses #526\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntwython.advisory\n~~~~~~~~~~~~~~~~\n\nThis module contains Warning classes for Twython to specifically\nalert the user about.\n\nThis ma...
python
chosen
[ { "from": "system", "value": "Document the type of NamedEnumField properly\n" }, { "from": "human", "value": "from django.utils import six\nfrom django.utils.translation import ugettext_lazy as _\nfrom rest_framework import serializers\n\n\nclass EnumField(serializers.ChoiceField):\n default_...
python
chosen
[ { "from": "system", "value": "Fix silly error. This makes more sense." }, { "from": "human", "value": "__version__ = '0.3.2-dev'\n\nVERSION = __version__ # synonym\n" }, { "from": "gpt", "value": "__version__ = '0.3.3-dev'\n\nVERSION = __version__ # synonym\n" } ]
python
chosen
[ { "from": "system", "value": "Add the default options for the salt master\n" }, { "from": "human", "value": "'''\nAll salt configuration loading and defaults should be in this module\n'''\n# Import python modules\nimport os\nimport sys\nimport socket\n# Import third party libs\nimport yaml\n\nde...
python
chosen
[ { "from": "system", "value": "Fix the 'Independent' party pages for UK elections\n\nThere's no Electoral Commission identifier for the 'Independent'\npseudo-party, so the party page for independents was failing.\n" }, { "from": "human", "value": "from candidates.views import PartyDetailView\n\nc...
python
chosen
[ { "from": "system", "value": "Add '*.json' file extensions to test pattern list.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport fnmatch\nimport os\nimport unittest\n\nfrom . import validate_json_format\n\n\nclass TestSettings(unittest.TestCase):\n def _get...
python
chosen
[ { "from": "system", "value": "Add E226 to default ignores for pep8\n\nE226 - missing whitespace around arithmetic operator\n2*3 + 5*6 must pass\n" }, { "from": "human", "value": "\"\"\"Check files with flake8.\"\"\"\nimport flake8.main\nimport re\n\n\nDEFAULTS = {\n 'ignore': '',\n 'comple...
python
chosen
[ { "from": "system", "value": "Return a JSON payload, rather than stringified JSON\n" }, { "from": "human", "value": "\"\"\"The API definition for the metrics API.\n\nThis defines the APIs and the handlers for the APIs.\n\"\"\"\n\nimport api_util\nimport metrics\n\nfrom protorpc import protojson\...
python
chosen
[ { "from": "system", "value": "[Instabot] Make example bot react to SIGINT better\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: ascii -*-\n\nimport sys\n\nimport instabot\n\nNICKNAME = 'Echo'\n\ndef post_cb(self, msg, meta):\n if msg['text'].startswith('!echo '):\n ...
python
chosen
[ { "from": "system", "value": "Throw CfnSphereException on IOErrors. Fix landmark issue.\n" }, { "from": "human", "value": "\nclass FileResolver(object):\n\n def read(self, path):\n with open(path, 'r') as file:\n return file.read()\n" }, { "from": "gpt", "value"...
python
chosen
[ { "from": "system", "value": "Add a test_get_partial_dict unit test, which currently fails\n" }, { "from": "human", "value": "import tg\nfrom tg.util import *\nfrom nose.tools import eq_\nimport os\n\npath = None\ndef setup():\n global path\n path = os.curdir\n os.chdir(os.path.abspath(...
python
chosen
[ { "from": "system", "value": "Update how schema is built\n" }, { "from": "human", "value": "import pyxb.Namespace\nimport pyxb.xmlschema as xs\nimport sys\n\nimport pyxb.standard.bindings.wsdl as wsdl\nimport pyxb.standard.bindings.soaphttp as soaphttp\nfrom xml.dom import Node\nfrom xml.dom imp...
python
chosen
[ { "from": "system", "value": "Fix import for statepoint for test_union_energy_grids\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\n# import statepoint\nsys.path.insert(0, '../../src/utils')\nimport statepoint\n\n# read in statepoint file\nif len(sys.argv) > 1:\n sp ...
python
chosen
[ { "from": "system", "value": "Add time to debug log format\n" }, { "from": "human", "value": "from flask import Flask\nimport os\nimport os.path\n\n__version__ = \"0.1.0\"\n\n\ndef create_app(config=None):\n app = Flask(__name__, instance_relative_config=True)\n\n config_name = \"eyeflask....
python
chosen
[ { "from": "system", "value": "Use typical domain value (no trailing slash)\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys, os\nfrom opentreetesting import test_http_json_method, config\nDOMAIN = config('host', 'apihost')\nSUBMIT_URI = DOMAIN + 'v3/amendments/list_all'\nr = ...
python
chosen
[ { "from": "system", "value": "Revert \"Change version for dev\"\n\nThis reverts commit 56a9db4cfeda91235313c5e72cb06420a6110673.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom elfi.core import Transform, Simulator, Summary, Discrepancy\nfrom elfi.distributions import *\nfrom el...
python
chosen
[ { "from": "system", "value": "Add missing import statement for whitenoise\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for untitled1 project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.django...
python
chosen
[ { "from": "system", "value": "Add unknown language error catching\n" }, { "from": "human", "value": "def restrict_len(content):\n if len(content) > 320:\n content = content[:310].strip() + '...'\n return content\n\n\ndef detect_language(config, langs, word):\n from yandex_transla...
python
chosen
[ { "from": "system", "value": "Make test get correct url\n" }, { "from": "human", "value": "\"\"\"Functional tests for the xml api part of aniauth project.\n\nThis is a temporary app as EVE Online's xml api is deprecated and will be\ndisabled March 2018.\n\n\"\"\"\nfrom django.contrib.staticfiles...
python
chosen
[ { "from": "system", "value": "FIX website sale clear line\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n# For copyright and license notices, see __openerp__.py file in module root\n# directory\n########...
python
chosen
[ { "from": "system", "value": "Add test case to test non-standard input\n" }, { "from": "human", "value": "from context import core\nfrom context import models\n\nfrom models import model\nfrom core import logic\n\nimport unittest\n\nclass test_logic(unittest.TestCase):\n\tdef test_create_room_of...
python
chosen
[ { "from": "system", "value": "Make is_owner_or not return True always\n" }, { "from": "human", "value": "from discord.ext import commands\r\n\r\n\r\ndef is_owner_or(**perms):\r\n async def predicate(ctx):\r\n owner = ctx.bot.is_owner(ctx.author)\r\n permissions = ctx.channel.per...
python
chosen
[ { "from": "system", "value": "Add util for loading main config\n" }, { "from": "human", "value": "import sys\nimport yaml\n\n\ndef job_config(args):\n\ttry:\n\t\tconfig_file = './config/{0}.yml'.format(args[0])\n\texcept IndexError:\n\t\tsys.exit(\"Job name is a required argument. Example: chica...
python
chosen
[ { "from": "system", "value": "Revert \"Fix 502 on admin page, is_authenticated() is now a boolean\"\n\nThis reverts commit 0d9a7f86c1d988b4e0f4617c5e4f0409c0754e19.\n" }, { "from": "human", "value": "from database import User, Paste, ApiKey\nfrom flask import abort, current_app\nfrom flask_login...
python
chosen
[ { "from": "system", "value": "Remove the 'user@' prefix before checking status\n\nSigned-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>\n" }, { "from": "human", "value": "import requests\nimport os\nfrom .config import config\n\n\ndef get_status(name):\n uri = os.pa...
python
chosen
[ { "from": "system", "value": "Make fixed learning rates not crash.\n\nThere was a slight bug in this code before, which I fixed.\n" }, { "from": "human", "value": "\"\"\" Classes that simplify learning rate modification. \"\"\"\n\n\nimport theano\nimport theano.tensor as TT\n\n\nclass _LearningR...
python
chosen
[ { "from": "system", "value": "Implement unittest.TestCase.assertGreaterEqual for pythons less than 2.7\n" }, { "from": "human", "value": "\nimport unittest\n\n\nclass TestCase(unittest.TestCase):\n \"\"\"\n Parent TestCase to use for all tests.\n \"\"\"\n pass\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Clean up built images for ephemeral cluster.\n\nReviewers: tail, pi, jeff\n\nReviewed By: jeff\n\nDifferential Revision: http://phabricator.local.disqus.net/D19797\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport subprocess\nimport sys\nimport uuid\n...
python
chosen
[ { "from": "system", "value": "Add a TagDetailSerializer for returning more details of a Tag then id and name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom...
python
chosen
[ { "from": "system", "value": "Allow multiple requests to be made at once by iterating over selections\n" }, { "from": "human", "value": "import sublime, sublime_plugin\n\nimport requests\nfrom requests import delete, get, head, options, patch, post, put\n\n\nclass RequestCommand(sublime_plugin.T...
python
chosen
[ { "from": "system", "value": "Fix broken unittests in Python 2.7.\n\nOriginally all test classes were decorated by going over the class via\ninspection - however, this doesn't work in Python 2.7 because the\nmethods that are returned from getmembers are all unbound (in Python 3+,\nthis is fixed as all metho...
python
chosen
[ { "from": "system", "value": "Return stub records in testing.\n" }, { "from": "human", "value": "# Copyright (c) 2014 Ansible, Inc.\n# All Rights Reserved.\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.functional import cached_property\n\n\nclass InstanceMa...
python
chosen
[ { "from": "system", "value": "ext_blog: Sort by date, remove post limit.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.contrib.syndication.views import Feed, FeedDoesNotExist\nfrom django.shortcuts import get_object_or_404\nfrom Instanssi.ext_blog.models import BlogEn...
python
chosen
[ { "from": "system", "value": "Use LooseVersion in version check (to avoid errors for e.g. '3.7.2+')\n" }, { "from": "human", "value": "from distutils.version import StrictVersion\nfrom platform import python_version\n\nmin_supported_python_version = '3.6'\n\nif StrictVersion(python_version()) < ...
python
chosen
[ { "from": "system", "value": "Remove display_title field from Post model.\n\nIt wasn't being used anyway.\n" }, { "from": "human", "value": "from django.db import models\n\nclass Post(models.Model):\n body = models.TextField()\n title = models.CharField(max_length=50)\n display_title = ...
python
chosen
[ { "from": "system", "value": "Disable indexing via robots.txt url." }, { "from": "human", "value": "from django.conf.urls import patterns, url, include\nfrom django.views.generic.base import TemplateView\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth import ...
python
chosen
[ { "from": "system", "value": "tests: Update splay_health() test to new module\n" }, { "from": "human", "value": "\"\"\"Test ELB creation functions.\"\"\"\nfrom foremast.elb.create_elb import SpinnakerELB\n\n\ndef test_splay():\n \"\"\"Splay should split Health Checks properly.\"\"\"\n heal...
python
chosen
[ { "from": "system", "value": "Create the database and table if they don't exist\n\nI think... :/\n" }, { "from": "human", "value": "import rethinkdb as r\n\n\nclass MetaEngine(object):\n def __init__(self, hostname, port, db, table):\n self.rdb = r.connect(host=hostname, port=port, db=...
python
chosen
[ { "from": "system", "value": "Make Django 1.9+ accept the settings file\n" }, { "from": "human", "value": "\"\"\"\nSettings file for the Auditlog test suite.\n\"\"\"\n\nSECRET_KEY = 'test'\n\nINSTALLED_APPS = [\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'auditlog',\n ...
python
chosen
[ { "from": "system", "value": "Use ModelSignal over plain Signal" }, { "from": "human", "value": "import django.dispatch\n\n# Behaves like Djangos normal pre-/post_save signals signals with the\n# added arguments ``target`` and ``position`` that matches those of\n# ``move_to``.\n# If the signal i...
python
chosen
[ { "from": "system", "value": "Add residence as an inline to person/people\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Person, Residence, RelationshipType, Relationship\n\nadmin.site.register(Person)\nadmin.site.register(Residence)\nadmin.site.regist...
python
chosen
[ { "from": "system", "value": "Remove '/blog/' from the post url.\n\nWas pretty unnecessary.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\n\...
python
chosen
[ { "from": "system", "value": "Add start/finish debug info while generating\n" }, { "from": "human", "value": "from copy import copy\n\nfrom preparation.resources.Resource import names_registered, resource_by_name\nfrom hb_res.storage import get_storage\n\n\ndef rebuild_from_resource(resource_nam...
python
chosen
[ { "from": "system", "value": "Prepare for next dev version" }, { "from": "human", "value": "from __future__ import absolute_import\nimport deployer.logger\nfrom celery.signals import setup_logging\n\n\n__version__ = '0.3.8'\n__author__ = 'sukrit'\n\ndeployer.logger.init_logging()\nsetup_logging....
python
chosen
[ { "from": "system", "value": "Remove any existing DKIM signature and set the Sender: header before sending.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nfrom ses import email_message_from_s3_bucket, event_msg_is_to_command, recipient_destination_overlap\nfrom cnc i...
python
chosen
[ { "from": "system", "value": "Add gen exp solution to 1\n" }, { "from": "human", "value": "from itertools import chain\n\ndef threes_and_fives_gen(num=1000):\n for i in range(num):\n if i % 3 == 0 or i % 5 == 0:\n yield i\n\ndef threes_and_fives_fun(n):\n return set(chain...
python
chosen
[ { "from": "system", "value": "Add test for invalid integer\n\nA valid integer in Whitesapce ends with '\\n', if an invalid integer is found the\ncode should raise a IntError exception.\n\nAs part of this, I have renamed `_valid_ws()` to `_sample_ws()`, which now takes\na argument for the type of whitespace ...
python
chosen
[ { "from": "system", "value": "Fix broad regex for the ``search`` URLs.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n\nurlpatterns = patterns(\n 'us_ignite.search.views',\n url(r'apps/', 'search_apps', name='search_apps'),\n url(r'events/', 'search_eve...
python
chosen
[ { "from": "system", "value": "Allow user to use ava without TTS on Linux\n" }, { "from": "human", "value": "import time\nimport os\n\nfrom tempfile import NamedTemporaryFile\nfrom sys import platform as _platform\n\nfrom gtts import gTTS\n\nfrom .playsound import playsound\nfrom ..queues import ...
python
chosen
[ { "from": "system", "value": "Use a function to write.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport settings\nimport os\nimport urllib2\nfrom proto import gtfs_realtime_pb2\n\nmessage = gtfs_realtime_pb2.FeedMessage()\nurl = urllib2.urlopen('http://datamine.mta...
python
chosen
[ { "from": "system", "value": "Simplify conditional for choosing WheelDistribution\n" }, { "from": "human", "value": "from pip._internal.distributions.source import SourceDistribution\nfrom pip._internal.distributions.wheel import WheelDistribution\n\nfrom pip._internal.utils.typing import MYPY_C...
python
chosen
[ { "from": "system", "value": "Enable import hook by default\n" }, { "from": "human", "value": "\"\"\"A python library wrapping the Cap'n Proto C++ library\n\nExample Usage::\n \n import capnp\n\n addressbook = capnp.load('addressbook.capnp')\n\n # Building\n addresses = addressboo...
python
chosen
[ { "from": "system", "value": "Allow use of a custom environment for tests.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom unittest import TestCase\n\nfrom byceps.application import create_app\nfrom byceps.blueprints.brand.models import Brand\nfrom byceps.blueprints.party.mode...
python
chosen
[ { "from": "system", "value": "Add method to verify that all strategy probabilities add to 1\n" }, { "from": "human", "value": "import scipy.misc\nimport scipy.special\n\n\ndef get_num_hole_card_combinations(game):\n num_players = game.get_num_players()\n num_hole_cards = game.get_num_hole_...
python
chosen
[ { "from": "system", "value": "Update for compat w/ djangorestframework 3.2\n\nChange request.QUERY_PARAMS to request.query_params" }, { "from": "human", "value": "\"\"\"\nProvides JSONP rendering support.\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom rest_framework.renderers import JS...
python
chosen
[ { "from": "system", "value": "Add WorkflowTestCase to integration tests\n" }, { "from": "human", "value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: miha@reciprocit...
python
chosen
[ { "from": "system", "value": "Fix indentation for break keyword.\n" }, { "from": "human", "value": "'''\nGiven the names and grades for each student in a Physics class of N students,\nstore them in a nested list and print the name(s) of any student(s) having the second lowest grade.\n\nNote: If ...
python
chosen
[ { "from": "system", "value": "Correct redirect after search from submission\n" }, { "from": "human", "value": "from flask import Flask, render_template\nfrom flask_bootstrap import Bootstrap\nfrom flask_nav import Nav\n\nfrom flask_wtf import FlaskForm\nfrom wtforms import StringField\nfrom wtfo...
python
chosen
[ { "from": "system", "value": "Update JednostkaAdministracyjnaFilter for new django-filters\n" }, { "from": "human", "value": "import django_filters\nfrom django.shortcuts import get_object_or_404\ntry:\n from django_filters import rest_framework as filters\nexcept ImportError: # Back-ward co...
python
chosen
[ { "from": "system", "value": "Mark all exist security groups as synced\n\n - itacloud-4843\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django_fsm\n\n\nclass Migration(migrations.Migration)...
python
chosen
[ { "from": "system", "value": "Add fixture for exemplar primitive generators\n" }, { "from": "human", "value": "import pytest\n\nfrom .context import tohu\nfrom tohu.v5.primitive_generators import *\n\n\nEXEMPLAR_GENERATORS = [\n Constant(\"quux\"),\n Boolean(p=0.3),\n]\n\n\n@pytest.fixture...
python
chosen
[ { "from": "system", "value": "Append trailing slash to detail URL\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom cms_shiny.views import ShinyAppListView, ShinyAppDetailView\n\nurlpatterns = patterns('',\n url(r'^$', ShinyAppListView.as_view(), name='shiny_...
python
chosen
[ { "from": "system", "value": "Remove lat/long from zika download\n\n" }, { "from": "human", "value": "import os,datetime\nfrom download import download\nfrom download import get_parser\n\nclass zika_download(download):\n def __init__(self, **kwargs):\n download.__init__(self, **kwargs)...
python
chosen
[ { "from": "system", "value": "Add ProgressTracker class for tracking progress in long operations\n\n" }, { "from": "human", "value": "STEP_COUNTS = {\n \"import_reference\": 0,\n \"setup_remote_reference\": 0,\n \"update_remote_reference\": 0,\n \"update_software\": 0,\n \"install...
python
chosen
[ { "from": "system", "value": "Use isinstance check so library can be used for more types" }, { "from": "human", "value": "# -*- coding: UTF-8 -*-\n\n__version__ = '0.1.0'\n\n\ndef flatkeys(d, sep=\".\"):\n \"\"\"\n Flatten a dictionary: build a new dictionary from a given one where all\n ...
python
chosen
[ { "from": "system", "value": "Fix for generate colors py\n" }, { "from": "human", "value": "\"\"\"Generates color arrays for use in a C project.\n\nThis scipt generates a dump of array/color data for use in a A project. This simplifies the need\nto hand-create and edit the data in many projects....
python
chosen
[ { "from": "system", "value": "Add typedef generation to the main script\n" }, { "from": "human", "value": "import sys\nfrom SteamworksParser import steamworksparser\nimport interfaces\nimport constants\nimport enums\nimport structs\n\ndef main():\n if len(sys.argv) != 2:\n print(\"TODO...
python
chosen
[ { "from": "system", "value": "Use XDG directory for caching\n" }, { "from": "human", "value": "import os\n\nfrom catchy import HttpCacher, DirectoryCacher, NoCachingStrategy\n\nfrom .installer import Installer\nfrom .sources import PackageSourceFetcher\nfrom .providers import CachingPackageProvi...
python
chosen
[ { "from": "system", "value": "Add file created when using add -p\n\nWhen using 'git add -p' or 'git checkout -p', if the user chooses\nto manually edit the .diff file, Git creates a file called\n'addp-hunk-edit.diff' (same file name for both operations).\n" }, { "from": "human", "value": "\"\"\"...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Modify copy method into inherit\n" }, { "from": "human", "value": "from openerp import fields, models \n ...
python
chosen
[ { "from": "system", "value": "Sort the processes by start time by default in the Admin.\n" }, { "from": "human", "value": "from flask.ext.admin import Admin\nfrom flask.ext.admin.contrib.sqla import ModelView\n\nfrom dadd.master import models\n\n\ndef admin(app):\n admin = Admin(app)\n ses...
python
chosen
[ { "from": "system", "value": "Fix the path to fake database data\n" }, { "from": "human", "value": "import json\n\nfrom meetup_facebook_bot import server\nfrom meetup_facebook_bot.models import base, talk, speaker\n\n\nbase.Base.metadata.create_all(bind=server.engine)\nsession = server.Session()...
python
chosen
[ { "from": "system", "value": "Include API validation response into `TalonOneAPIError` details\n" }, { "from": "human", "value": "import json\nimport requests\n\nclass TalonOneAPIError(Exception):\n \"\"\"\n TalonOne API Exceptions\n \"\"\"\n def __init__(self, message, *args):\n ...
python
chosen
[ { "from": "system", "value": "Add blank line - pep8\n" }, { "from": "human", "value": "from django.shortcuts import get_object_or_404\nfrom rest_framework.generics import RetrieveAPIView\n\nfrom jarbas.core.models import Company\nfrom jarbas.core.serializers import CompanySerializer\nfrom jarbas...
python
chosen
[ { "from": "system", "value": "Return just path when getting redirect location from REFERER\n\nIn response.get_redirect_location(). There's no need to include the\nscheme and host in a redirect back to the same site. Removing them makes\nredirect URLs more concise.\n" }, { "from": "human", "value...
python
chosen
[ { "from": "system", "value": "DOC: Document test system a bit\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014, Vispy Development Team.\n# Distributed under the (new) BSD License. See LICENSE.txt for more info.\n\nfrom ._testing import (SkipTest, requires_applicat...
python
chosen