conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Tag commit for v0.0.15-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=14\nbranch=\"master\"\ntimestamp=1376507766.02" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=15\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Include the helpers module tests in the full library testsuite.\n" }, { "from": "human", "value": "import unittest\nimport test_primitives, test_astypes\n\ndef get_suite():\n primitives = unittest.TestLoader().loadTestsFromModule(test_primitives)\n astypes = u...
python
chosen
[ { "from": "system", "value": "Make the Satoyama Movement a scope.\n" }, { "from": "human", "value": "from model_utils import Choices\n\nfrom ohashi.constants import OTHER\n\n\nBLOOD_TYPE = Choices('A', 'B', 'O', 'AB')\n\nCLASSIFICATIONS = Choices(\n (1, 'major', 'Major Unit'),\n (2, 'minor...
python
chosen
[ { "from": "system", "value": "Add constructor with required arguments to the `Person` class\n" }, { "from": "human", "value": "__all__ = ['Person']\n\n\nclass Person(object):\n pass" }, { "from": "gpt", "value": "__all__ = ['Person']\n\n\nclass Person(object):\n\n def __init__(...
python
chosen
[ { "from": "system", "value": "Fix course mode settings import\n\nWithout this, we were pulling edx's default (audit) from common,\ninstead of pulling \"ours\" from aws/json (honor).\n" }, { "from": "human", "value": "from cms.envs.aws import *\nfrom lms.envs.common import COURSE_MODE_DEFAULTS\n\...
python
chosen
[ { "from": "system", "value": "Add example of a scoped resource\n\nAdd the Project resource and set the `url` setting in the domain to allow it to sit as a sub resource under accounts. See: http://python-eve.org/features.html#sub-resources\n" }, { "from": "human", "value": "\"\"\"\nEve playground...
python
chosen
[ { "from": "system", "value": "Test that poet uses sha256's from pypi\n\nCloses #25. Closes #23. Closes #6.\n" }, { "from": "human", "value": "# Integration tests for poet\n\nimport subprocess\nimport sys\n\n\ndef poet(*args):\n return subprocess.check_output(\n [\"poet\"] + list(args),...
python
chosen
[ { "from": "system", "value": "Add a docstring to the poppinsbag module\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n__version__ = \"0.1.0\"\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\" Mary Poppins a...
python
chosen
[ { "from": "system", "value": "Allow pages to appear anywhere they aren't excluded\n" }, { "from": "human", "value": "from django.db import models\n\nfrom wagtail.wagtailcore.models import Page as WagtailPage\nfrom wagtail.wagtailcore.fields import RichTextField\nfrom wagtail.wagtailadmin.edit_ha...
python
chosen
[ { "from": "system", "value": "Add additional fields to permission type\n" }, { "from": "human", "value": "import graphene\nfrom django.contrib.auth.models import Permission as DjangoPermission\nfrom graphene_django import DjangoObjectType\nfrom . import models\n\n\nclass ClientUser(DjangoObjectT...
python
chosen
[ { "from": "system", "value": "Document new {{import:file.txt}} command for Anki card definitions.\n" }, { "from": "human", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain ...
python
chosen
[ { "from": "system", "value": "Add route to get specific group\n" }, { "from": "human", "value": "\"\"\"Group manangement.\"\"\"\nfrom flask import jsonify\nfrom flask_restplus import Namespace, Resource\n\nimport api.team\nimport api.user\n\nns = Namespace('groups', description='Group management...
python
chosen
[ { "from": "system", "value": "Fix one coding style problem\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass NonAsciiRepr:\n def __repr__(self):\n return \"nôt åscíì\"\n\n\nclass Binary(models.Model):\n field = models.BinaryField()\n\n\ntry:\n from django...
python
chosen
[ { "from": "system", "value": "Fix the Nick command help text\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom heufybot.moduleinterface import IBotModule\nfrom heufybot.modules.commandinterface import BotCommand\nfrom zope.interface import implements\n\n\nclass NickComm...
python
chosen
[ { "from": "system", "value": "Add specification of output directory from command line\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Grab runs from S3 and do analysis\n#\n# Daniel Klein, 2015-08-14\n\nimport sys\nimport subprocess\nimport glob\nimport argparse\n\nparser = argparse...
python
chosen
[ { "from": "system", "value": "Convert public key string type in server\n\nThis fixes a segmentation fault caused by an incorrect string encoding\nwhen run in Python 2.7.\n" }, { "from": "human", "value": "import base64\nimport json\nimport struct\n\nfrom flask import Flask, request\nfrom scarab ...
python
chosen
[ { "from": "system", "value": "Add a ModeType enum for later benefit\n" }, { "from": "human", "value": "def unescapeEndpointDescription(desc):\n result = []\n escape = []\n depth = 0\n desc = iter(desc)\n for char in desc:\n if char == \"\\\\\":\n try:\n ...
python
chosen
[ { "from": "system", "value": "Remove forum siblings from forum serializer\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom machina.core.db.models import get_model\nfrom rest_framework import serializers\n\nForum = get_model('forum', 'F...
python
chosen
[ { "from": "system", "value": "Fix to pass python linter, this slipped through as the master branch wasnt protected\n" }, { "from": "human", "value": "import os\nimport markdown\nimport yaml\nfrom flask import render_template, render_template_string, session\nfrom .. import main\nfrom application...
python
chosen
[ { "from": "system", "value": "Add unique constraints to Enum definitions\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nfrom enum import Enum\n\n\nclass Context(E...
python
chosen
[ { "from": "system", "value": "Update the version to 3.0.0\n" }, { "from": "human", "value": "# Copyright 2012-2014 Hewlett Packard Development Company, L.P.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except i...
python
chosen
[ { "from": "system", "value": "Add params_timestamp_key and response_timestamp_key methods\n" }, { "from": "human", "value": "class ApiSubscribeRequest(object):\n \"\"\"Api request class.\"\"\"\n\n def __init__(self):\n self._action = None\n self._request = {}\n self._p...
python
chosen
[ { "from": "system", "value": "Remove `username` from keycloack payload.\n" }, { "from": "human", "value": "from urlparse import urljoin\n\nfrom django.conf import settings\nimport jwt\nfrom social_core.backends.oauth import BaseOAuth2\n\n\nclass KeycloakOAuth2(BaseOAuth2):\n \"\"\"Keycloak OA...
python
chosen
[ { "from": "system", "value": "TBR: Fix circ dep issue with cbuildbot\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\...
python
chosen
[ { "from": "system", "value": "Add host and remove debug\n" }, { "from": "human", "value": "#!bin/python\nimport json\nimport lib_zpr\n\nfrom flask import Flask, jsonify, make_response\n\n\napp = Flask(__name__)\n\napi_version = 'v1.0'\napi_base = str('/zpr/{v}'.format(v=api_version))\n\n@app.err...
python
chosen
[ { "from": "system", "value": "Add docstrings to Users class\n" }, { "from": "human", "value": "from .base import AuthenticationBase\n\n\nclass Users(AuthenticationBase):\n\n def __init__(self, domain):\n self.domain = domain\n\n def userinfo(self, access_token):\n return self...
python
chosen
[ { "from": "system", "value": "Clear screen at start of program\n" }, { "from": "human", "value": "import cmd\nimport argparse\nfrom Interface import *\n\n\nclass Lexeme(cmd.Cmd):\n intro = \"Welcome to Lexeme! Input '?' for help and commands.\"\n prompt = \"Enter command: \"\n\n def do_...
python
chosen
[ { "from": "system", "value": "Fix ImportErrors when running tests, make sure pre-commit hooks still pass\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# flake8: noqa\nimport views\nfrom flask import Flask\nfrom flask_themes2 import Themes\n\nimport config\nfrom util.auth import is_...
python
chosen
[ { "from": "system", "value": "Set jointplot example axis limits in main call\n" }, { "from": "human", "value": "\"\"\"\nLinear regression with marginal distributions\n=============================================\n\n\"\"\"\nimport seaborn as sns\nsns.set(style=\"darkgrid\")\n\ntips = sns.load_da...
python
chosen
[ { "from": "system", "value": "tests: Add testcases for \"complicated\" args to generator functions.\n" }, { "from": "human", "value": "# Handling of \"complicated\" arg forms to generators\n# https://github.com/micropython/micropython/issues/397\ndef gen(v=5):\n for i in range(v):\n yi...
python
chosen
[ { "from": "system", "value": "Call type instead of which\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"Information overview for command line tools.\n\nUsage:\n nani <command>\n nani -h | --help\n nani --version\n\nOptions:\n -h, --help Print this message and exit.\n --ve...
python
chosen
[ { "from": "system", "value": "Add some basic error handling and remove tuples.\n\nNo need for tuples when the lists are going to be\nso small. The speed difference between the two\nwill be minimal.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom config import WOLFRAM_KEY\nimport ...
python
chosen
[ { "from": "system", "value": "Support json encoding of datetime objects\n" }, { "from": "human", "value": "from flask import Flask, render_template, jsonify\nfrom logbook import Logger\nfrom functools import wraps\n\nimport maildump\nimport maildump.db as db\n\n\napp = Flask(__name__)\napp._logg...
python
chosen
[ { "from": "system", "value": "Fix version conflict and bump to 0.6\n" }, { "from": "human", "value": "<<<<<<< HEAD\n__version_info__ = (0, 6, 0)\n=======\n__version_info__ = (0, 5, 7)\n>>>>>>> hotfix/0.5.7\n__version__ = '.'.join([str(i) for i in __version_info__])\n" }, { "from": "gpt",...
python
chosen
[ { "from": "system", "value": "Add auto binning test to stats.\n" }, { "from": "human", "value": "import pytest\n\nfrom bokeh.charts.stats import Bins\nfrom bokeh.models import ColumnDataSource\n\n\n@pytest.fixture\ndef ds(test_data):\n return ColumnDataSource(test_data.auto_data)\n\n\ndef tes...
python
chosen
[ { "from": "system", "value": "Add log level setting to mailer function\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport smtplib\nimport arrow\n\nfrom email.mime.text import MIMEText\n\n\ndef send_on_email(report, subject, mail_from, mail_to, smtp_auth):\n smtp_login, smtp_...
python
chosen
[ { "from": "system", "value": "Add log to self play\n" }, { "from": "human", "value": "from game import Game\nfrom self_play import SelfPlay\n\ng = Game()\n\nruntime = SelfPlay(g)\nruntime.play()\n" }, { "from": "gpt", "value": "from game import Game\nfrom self_play import SelfPlay\n\...
python
chosen
[ { "from": "system", "value": "Check if song is_playing before play\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport sys\nfrom appscript import *\nfrom termcolor import colored, cprint\n\n\ndef open(itunes):\n return itunes.activate()\n\n\ndef close(itunes):\n return itun...
python
chosen
[ { "from": "system", "value": "Remove mixins from namespace after monkey patching\n\nAfter their job is done, they can go home ;-)\n" }, { "from": "human", "value": "# Copyright (c) 2014, German Neuroinformatics Node (G-Node)\n#\n# All rights reserved.\n#\n# Redistribution and use in source and b...
python
chosen
[ { "from": "system", "value": "Revert \"Deliberately break status check\"\n\nThis reverts commit da7f671ec287afc0c42f58794053b8bf69ddf620.\n" }, { "from": "human", "value": "from django.db import connection, DatabaseError\nfrom django.http import HttpResponse\nfrom django.views.decorators.csrf im...
python
chosen
[ { "from": "system", "value": "Fix bugs and increment version number\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\"\"\"Command line runtime for Tea.\"\"\"\n\nfrom runtime import tokenizer, parser, ast, std\n\nTEA_VERSION = \"0.0.3-dev\"\nTEA_TITLE = \"Tea @\" + TEA_VERSION\nCLI_SYMBOL ...
python
chosen
[ { "from": "system", "value": "Add fields attribute to CalendarEntriesAdminForm.\n\nDjango 1.8 requires either the 'fields' or 'exclude' attribute to be set for modelForm. Omitting any definition of the fields to use will result in an ImproperlyConfigured exception. See https://docs.djangoproject.com/en/1.8/...
python
chosen
[ { "from": "system", "value": "Update Root URL config to set the default mapping\n" }, { "from": "human", "value": "__author__ = 'ankesh'\nfrom django.conf.urls import patterns, include, url\nfrom django.http import HttpResponseRedirect\n\n# Uncomment the next two lines to enable the admin:\nfrom...
python
chosen
[ { "from": "system", "value": "[DJ1.10] Support for string view arguments to url() will be removed\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf import settings\nfrom django.conf.urls import url, include\n\nurlpatterns = [\n url(r'^auth/', include('helios_auth.ur...
python
chosen
[ { "from": "system", "value": "Fix is_worker_running + new seed\n" }, { "from": "human", "value": "from crawler import tasks\nfrom crawler.db import db_mongodb as db\nfrom time import sleep\n\nfrom celery.app.control import Control\nfrom crawler.celery import app\n\n# Temporal solution\ndb.insert...
python
chosen
[ { "from": "system", "value": "Make it work with Py3\n" }, { "from": "human", "value": "from curses import wrapper\nfrom ui import ChatUI\nfrom client import Client\nimport ConfigParser\n\ndef main(stdscr):\n cp = ConfigParser.ConfigParser()\n cp.read('config.cfg')\n username = cp.get('c...
python
chosen
[ { "from": "system", "value": "Fix handling of missing config file\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom web import app\nimport db, config\nimport os.path\n\nif __name__ == '__main__':\n\tif not config.check():\n\t\tprint >>sys.stderr, \"Couldn't find configuration file\"\n\t...
python
chosen
[ { "from": "human", "value": "TDD: Add test for first compatibility function.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Tests for patois.\"\"\"\nfrom __future__ import (print_function, absolute_import,\n unicode_literals, divisio...
python
chosen
[ { "from": "system", "value": "Fix and re-enable the reset management command test.\n\nNot 100% sure of why this fixes the issue - it appears that changes to django.test.TestCase in Django 2.0 led to the test failing.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ imp...
python
chosen
[ { "from": "system", "value": "Fix a 3.0 compat issue\n" }, { "from": "human", "value": "import functools\n\nfrom django.contrib.auth import REDIRECT_FIELD_NAME\nfrom django.utils.decorators import available_attrs\n\nfrom account.utils import handle_redirect_to_login\n\n\ndef login_required(func=...
python
chosen
[ { "from": "system", "value": "Read config file passed as --appopts param.\n" }, { "from": "human", "value": "\"\"\"\nCyclone application for Vumi Go contacts API.\n\"\"\"\n\nfrom go_api.cyclone import ApiApplication\nfrom go_contacts.backends.riak import RiakContactsBackend\n\n\nclass ContactsAp...
python
chosen
[ { "from": "system", "value": "Add special handling for NotImplementedError\n\nIf the function called by run_command() raises a NotImplementedError,\ndon't print the full stacktrace. Do a mild amount of custom formatting,\nthen exit with status 1 (failure).\n" }, { "from": "human", "value": "from...
python
chosen
[ { "from": "system", "value": "Add support for pix4d meta file format.\n\n\nFormer-commit-id: 7330412d726bf8cc4bd9d8659fb067e4921af798" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nsys.path.insert(0, \"/usr/local/opencv-2.4.11/lib/python2.7/site-packages/\")\n\nimport argparse...
python
chosen
[ { "from": "system", "value": "Change PHP error matching regex\n\nOn my system (OS X 10.7 w/stock PHP 5.3.8), the PHP lint frequently\nmisses errors due to over-specificity in the regex. This one is\ncatching them.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# php.py - sublimelint...
python
chosen
[ { "from": "system", "value": "Define constatns for rcon commands\n" }, { "from": "human", "value": "from __future__ import unicode_literals, absolute_import\n\n# Opcode definitions\nOPCODE_INFO = 'i'\nOPCODE_RULES = 'r'\nOPCODE_CLIENTS = 'c'\nOPCODE_CLIENTS_DETAILED = 'd'\nOPCODE_RCON = 'x'\nOPC...
python
chosen
[ { "from": "system", "value": "Fix imports for Python 3\n" }, { "from": "human", "value": "from pyramid.exceptions import NotFound\nfrom pyramid.renderers import get_renderer\nfrom pyramid.view import view_config\n\nfrom webnut import WebNUT\nimport config\n\nclass NUTViews(object):\n def __in...
python
chosen
[ { "from": "system", "value": "Change the structure of directory\n" }, { "from": "human", "value": "import random\nimport time\nimport os\nimport openpyxl\nfrom util import util\n\nfrom pyquery import PyQuery\nfrom selenium import webdriver\nfrom selenium.common.exceptions import NoSuchElementExc...
python
chosen
[ { "from": "system", "value": "Change version to reflect current dev status.\n" }, { "from": "human", "value": "\"\"\"\ndjango-selectable is a collection of tools and widgets for using/creating auto-complete selection widgets using Django and jQuery UI.\n\"\"\"\n\n__version_info__ = {\n 'major...
python
chosen
[ { "from": "system", "value": "Exit with status code 1 if retrieval of the configuration filename from the environment fails\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nbyceps.util.system\n~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2016 Jochen Kupperschmidt\n:License: Modifi...
python
chosen
[ { "from": "system", "value": "Add more tests to database\n" }, { "from": "human", "value": "import database\n\n\ndef test_encode_csv():\n attributes = (\n # strand, ref, alt, cdna_pos, exon, protein_id, is_ptm\n '+', 'R', 'H', 204, 'exon1', 123, False\n )\n result = databa...
python
chosen
[ { "from": "system", "value": "Use class-based generic view for redirect.\n\nFixes #29; legacy method-based generic views are deprecated in Django." }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\nfrom surlex.dj import surl\n\nfrom .feeds import NewspeakRSSFeed, News...
python
chosen
[ { "from": "system", "value": "Write downloaded observations into a Visual Format file.\n" }, { "from": "human", "value": "from __future__ import unicode_literals, print_function\n\nimport sys\nimport logging\n\nfrom pyaavso.utils import download_observations\n\n\nif __name__ == '__main__':\n ...
python
chosen
[ { "from": "system", "value": "Move success/failure properties into WebEvent base class.\n" }, { "from": "human", "value": "# Module: events\n# Date: 3rd February 2009\n# Author: James Mills, prologic at shortcircuit dot net dot au\n\n\"\"\"Events\n\nThis module implements the necessary E...
python
chosen
[ { "from": "system", "value": "Add source to author build index query\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, unicode_literals\n\nfrom flask import session\nfrom sqlalchemy.orm import joinedload\n\nfrom changes.api.base import APIView\nfrom changes.mod...
python
chosen
[ { "from": "system", "value": "Switch from modelviewset to mixins\n" }, { "from": "human", "value": "\"\"\"\nAPI file for news and event app\n\nconsists of the news list, detail and add api\nevents list, detail and add api\n\"\"\"\n\nfrom django.utils import timezone\n\nfrom rest_framework import...
python
chosen
[ { "from": "system", "value": "scripts: Move logic inside the main function\n\nSigned-off-by: Sayan Chowdhury <5f0367a2b3b757615b57f51d912cf16f2c0ad827@gmail.com>\n" }, { "from": "human", "value": "#!/bin/env python\n# -*- coding: utf8 -*-\n\"\"\" Triggers an upload process with the specified raw...
python
chosen
[ { "from": "system", "value": "Fix up error handling for flowd\n" }, { "from": "human", "value": "# flowtools_wrapper.py\n# Copyright 2014 Bo Bayles (bbayles@gmail.com)\n# See http://github.com/bbayles/py3flowtools for documentation and license\n\nfrom __future__ import division, print_function, ...
python
chosen
[ { "from": "system", "value": "Clean dispatch methods exposed to api.\n" }, { "from": "human", "value": "# flake8: noqa\n#from .registry import Registry, CachingKeyLookup, Lookup\nfrom .dispatch import dispatch, dispatch_method, auto_methodify\nfrom .mapply import mapply\nfrom .arginfo import arg...
python
chosen
[ { "from": "system", "value": "Remove debug mode default setting of true\n" }, { "from": "human", "value": "from bucky import create_app\n\napp = create_app('development')\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n" }, { "from": "gpt", "value": "from bucky import creat...
python
chosen
[ { "from": "system", "value": "Change default value for line number\n" }, { "from": "human", "value": "#!/usr/local/bin/python2.7\n# -*- coding: utf-8 -*-\n\"\"\"\nIntelligence Platform CLI Fabric File\n\"\"\"\n\n__author__ = 'Dongjoon Hyun (dongjoon@apache.org)'\n__license__ = 'Apache License'\n...
python
chosen
[ { "from": "system", "value": "Add some timing and fix debug output from HDFS client.\n" }, { "from": "human", "value": "import sys, os\nimport shlex, subprocess\n\ndef hdfs_fetch_file(hdfs_path, local_path):\n print \"Getting %s...\"\n command = \"hadoop fs -get %s %s\" % (hdfs_path, local_pat...
python
chosen
[ { "from": "system", "value": "Test DEBUG to serve static files by django\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf.urls.defaults import *\nfrom django.contrib import admin\nfrom django.conf import settings\n\nadmin.autodiscover()\n\nurlpatterns = patterns(\n ...
python
chosen
[ { "from": "system", "value": "Add assert to prevent invalid input\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"roll simulates rolling polyhedral dice.\"\"\"\n# roll.py\n\n# Michael McMahon\n\nfrom random import randrange\n\n# Die roll function\n# This function rolls polyhedral...
python
chosen
[ { "from": "system", "value": "Make qipype and QUIT version numbers match\n" }, { "from": "human", "value": "\"\"\"Setup file to Not Another Neuroimaging Slicer\n\n\"\"\"\n\nfrom setuptools import setup, find_packages\nfrom codecs import open\nfrom os import path\n\nhere = path.abspath(path.dirna...
python
chosen
[ { "from": "system", "value": "Remove dirty lies from doctstring\n\nThis was a leftover from wherever I originally copied this config from.\n" }, { "from": "human", "value": "\"\"\"Configuration for testtube.\nAutomatically run tests when files change by running: stir\nSee: https://github.com/tho...
python
chosen
[ { "from": "system", "value": "Use python libs to do file operations\n" }, { "from": "human", "value": "def do_step(context):\n\n call(\"mkdir -p ./bosh\", shell=True)\n call(\"mkdir -p ./bosh/manifests\", shell=True)\n\n # Generate the private key and certificate\n call(\"sh create_c...
python
chosen
[ { "from": "human", "value": "Write permission for user api, make POST public\n" }, { "from": "gpt", "value": "from rest_framework import permissions\n\nclass CustomUserAPIPermission(permissions.BasePermission):\n \"\"\"\n Define custom permission for UserAPI and UserDetailAPI\n\n GET : ...
python
chosen
[ { "from": "system", "value": "Add experimental sessions code for CoreNLP requests\n" }, { "from": "human", "value": "# Temporary inclusion of pycorenlp code for easier edits\n# https://github.com/smilli/py-corenlp\n\nimport json, requests\nimport six\n\nclass StanfordCoreNLP:\n\n\tdef __init__(s...
python
chosen
[ { "from": "system", "value": "Allow evidence to be list of single instance.\n" }, { "from": "human", "value": "class MockStatement(object):\n def __init__(self, evidence, mk_hash, supports):\n self.evidence = evidence\n self.__mk_hash = mk_hash\n self.supports = supports\...
python
chosen
[ { "from": "system", "value": "Modify example to make camera vs. outside humidity plot\n" }, { "from": "human", "value": "import matplotlib.pyplot as plt\nfrom aux2mongodb import MagicWeather\nfrom datetime import date\n\n\nm = MagicWeather(auxdir='/fact/aux')\n\ndf = m.read_date(date(2015, 12, 3...
python
chosen
[ { "from": "system", "value": "Add a test for product title\n" }, { "from": "human", "value": "from wagtail.tests.utils import WagtailPageTests\nfrom longclaw.utils import maybe_get_product_model\nfrom longclaw.tests.products.models import ProductIndex\nfrom longclaw.tests.utils import ProductVar...
python
chosen
[ { "from": "system", "value": "Fix parameters on test nodes\n" }, { "from": "human", "value": "\"\"\"\nNodetree test nodes.\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport types\n\nfrom . import node\n\n\nclass Number(node.Node):\n \"\"\"A number constant.\"\"\"\n intypes = []\n...
python
chosen
[ { "from": "system", "value": "Fix issue with latest changes in haystack\n\nA merge into haystack has resulted in an additional argument for\n``index_queryset``, I updated the search index for Oscar's product\nto fix the issue.\n" }, { "from": "human", "value": "from haystack import indexes\n\nfr...
python
chosen
[ { "from": "system", "value": "Remove get_context_data override and use the paginator total count instead\n" }, { "from": "human", "value": "from django.views.generic.list import ListView\n\nfrom edxmako.shortcuts import render_to_response\n\nfrom .models import Job\n\n\nclass JobListView(ListVie...
python
chosen
[ { "from": "system", "value": "Fix flaky Hadoop smoke tests - make sure the exported files are unique\n" }, { "from": "human", "value": "#! /usr/env/python\n\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nfrom tests import pyunit_utils\nfrom datetime import datetime\nimp...
python
chosen
[ { "from": "system", "value": "Set MIDDLEWARE_CLASSES so Django will stop complaining\n" }, { "from": "human", "value": "import os\nimport sys\nfrom django.conf import settings\n\ndef pytest_configure():\n sys.path.append(os.path.join(os.path.dirname(__file__), 'tests'))\n settings.configur...
python
chosen
[ { "from": "system", "value": "Fix mistyped input file name\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport glob\nimport os\n\nout_files = glob.glob('pcreo_??????????.csv')\nout_files.sort()\nif len(out_files) == 0:\n print(\"WARNING: No PCreo output files found.\")\nelse:\...
python
chosen
[ { "from": "system", "value": "Define a model for 'Analyses' in Analysis Request inherit from records_field_artemplate.\n" }, { "from": "human", "value": "from openerp import fields, models, api\nfrom base_olims_model import BaseOLiMSModel\n\nschema = (fields.Many2one(string='Services',\n ...
python
chosen
[ { "from": "system", "value": "Make unit test attachment fixtures always enabled\n\nThe code used in the base test class was copied from other projects and\nmade the stdout, stderr, and logging attachments enabled optionally by\nenv variables. However there is no reason to do that since if there is\nany outp...
python
chosen
[ { "from": "system", "value": "Sort files by modification date when testing streaming to preserve order\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n#\n# test a streaming app by dumping files from one directory\n# into another, at a specified rate\n#\n# <streaming_test> srcPath tar...
python
chosen
[ { "from": "system", "value": "Make the initialization wait optional\n" }, { "from": "human", "value": "# License under the MIT License - see LICENSE\n\nimport boto.ec2\nimport os\nimport time\n\n\ndef launch(key_name, region='us-west-2', image_id='ami-5189a661',\n instance_type='t2.mic...
python
chosen
[ { "from": "system", "value": "Copy the template name list from the fragment so we don't mutate it\n" }, { "from": "human", "value": "\nfrom django import template\nfrom django.template.loaders import select_template\n\nregister = template.Library()\n\n\nclass PlaceholderNode(template.Node):\n ...
python
chosen
[ { "from": "system", "value": "Disable SQLAlchemy change tracking signals\n\nThis is enabled by default, which currently emits a warning.\nThe default will be False in the future.\n" }, { "from": "human", "value": "import os\n\n\nclass Config:\n \"\"\"Base configuration.\"\"\"\n\n ENV = Non...
python
chosen
[ { "from": "system", "value": "Add download and compile step to mimic\n" }, { "from": "human", "value": "from subprocess import call\n\nfrom mycroft.frontends.tts.tts_plugin import TtsPlugin\n\n\nclass MimicTts(TtsPlugin):\n def read(self, text):\n call(['mimic', '-t', text, '-voice', s...
python
chosen
[ { "from": "system", "value": "Add documentation, refactor to use config\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n Execute via:\n python -m preprocessing/collect_unigrams\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_litera...
python
chosen
[ { "from": "system", "value": "Add user facet for SMS\n" }, { "from": "human", "value": "from .es_query import HQESQuery\nfrom . import filters\n\n\nclass SMSES(HQESQuery):\n index = 'sms'\n\n @property\n def builtin_filters(self):\n return [\n incoming_messages,\n ...
python
chosen
[ { "from": "system", "value": "Use \"owner\" in place of \"manager\" for bar roles\n" }, { "from": "human", "value": "from flask_sqlalchemy import SQLAlchemy\nfrom flask_alembic import Alembic\n\ndb = SQLAlchemy()\nalembic = Alembic()\n\ndef init_db():\n # import all modules here that might de...
python
chosen
[ { "from": "system", "value": "Move signal ignore to run\n" }, { "from": "human", "value": "from multiprocessing import Process, Value\nimport os\nimport config\nimport servo\nimport signal\n\nclass ServoProcess(Process):\n def __init__(self):\n signal.signal(signal.SIGINT, signal.SIG_I...
python
chosen
[ { "from": "system", "value": "Set instances variables in auth before init\n" }, { "from": "human", "value": "\"\"\"Base formgrade authenticator.\"\"\"\nfrom traitlets.config.configurable import LoggingConfigurable\n\n\nclass BaseAuth(LoggingConfigurable):\n \"\"\"Base formgrade authenticator....
python
chosen
[ { "from": "system", "value": "Make sure the tests exit with status 1 when there are errors or failures" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport optparse\nimport sys\nimport unittest2\n\nUSAGE = \"\"\"%prog SDK_PATH TEST_PATH <THIRD_PARTY>\nRun unit tests for App Engine apps.\...
python
chosen