conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add install_requires six for universal Python support\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(\n name='screenplain',\n version='0.7.0',\n description='Convert text file to viewable screenplay.',\...
python
chosen
[ { "from": "system", "value": "Set up Travis tests with pytest for all versions\n" }, { "from": "human", "value": "import setuptools\n\nsetuptools.setup(\n name='ChatExchange6',\n version='0.0.1',\n url='https://github.com/ByteCommander/ChatExchange6',\n packages=[\n 'chatexcha...
python
chosen
[ { "from": "system", "value": "Upgrade gevent to 1.2 and bump version to 0.1.20\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nconsole_scripts = [\n 'makiki = makiki.cli:main_parser',\n]\n\nrequires = [\n 'blinker>=1.4',\n 'ge...
python
chosen
[ { "from": "system", "value": "Fix for dependencies using pip\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\n\nsetup(name='igtdetect',\n version='1.1.0',\n description='Line-level classifier for IGT instances, part of RiPLEs pipeline.',\n au...
python
chosen
[ { "from": "system", "value": "Set a correct version number.\n" }, { "from": "human", "value": "\"\"\"Setup script for `kozai`.\"\"\"\n\nfrom setuptools import setup\n\n\ndef readme():\n with open('README.md') as f:\n return f.read()\n\n\nsetup(\n author='Joseph O\\'Brien Antognini',...
python
chosen
[ { "from": "system", "value": "Change dependency to libxml2-python-2.7.8 (github).\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''FiscalHr Setup'''\n\nfrom distutils.core import setup\n\nimport fiscalhr\n\nsetup(\n name=fiscalhr.__title__,\n version=fiscalhr.__version__,\n ...
python
chosen
[ { "from": "system", "value": "Add 'sure' to package reqs\n\nChange-Id: Ie08d1a8b23e4fc8f4f18d53403fff8145022af32\n" }, { "from": "human", "value": "#!/usr/bin/env python\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nrequirements = [\n]\n\nt...
python
chosen
[ { "from": "system", "value": "Add `pytest-cov` to collect test coverages\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import with_statement\nfrom setuptools import setup, find_packages\nimport re\n\nversion = \"0.0.1.dev.0\"\nwith open(\"tdclient/version.py\") as f...
python
chosen
[ { "from": "system", "value": "Change package owner and homepage\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2010 KenTyde\n# All rights reserved.\n#\n# This software is licensed as described in the file LICENSE,\n# which you should have re...
python
chosen
[ { "from": "system", "value": "Update URL to github repository.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport re\n\nfrom setuptools import find_packages, setup\n\n\ndef get_version(filename):\n content = open(filename).read()\n metadata = dict(re.finda...
python
chosen
[ { "from": "system", "value": "Update DUA requirement to support Django 1.9\n" }, { "from": "human", "value": "import codecs\n\nfrom os import path\nfrom setuptools import find_packages, setup\n\n\ndef read(*parts):\n filename = path.join(path.dirname(__file__), *parts)\n with codecs.open(f...
python
chosen
[ { "from": "system", "value": "Fix crash on empty report by converting to string\n" }, { "from": "human", "value": "import logging\n\n\nclass Browser:\n def __init__(self, actors, subreddit, db, cursor):\n self.actors = actors\n self.subreddit = subreddit\n self.db = db\n ...
python
chosen
[ { "from": "system", "value": "Remove complex exception mechanism for celery task" }, { "from": "human", "value": "import sys\n\nfrom celery.task import task\n\nfrom django.conf import settings\nfrom django.utils import translation\nfrom django.db import transaction\n\nfrom .crawler import crawl_...
python
chosen
[ { "from": "system", "value": "Put whole message out to stderr, not just part of it\n" }, { "from": "human", "value": "import PyWXSB.XMLSchema as xs\n\nimport sys\nimport traceback\nfrom xml.dom import minidom\nfrom xml.dom import Node\n\nfiles = sys.argv[1:]\nif 0 == len(files):\n files = [ '...
python
chosen
[ { "from": "system", "value": "Add usage info to comment\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"Main executable for ShivyC compiler\n\n\"\"\"\n\nimport argparse\n\ndef get_arguments():\n \"\"\"Set up the argument parser and return an object storing the\n argument...
python
chosen
[ { "from": "system", "value": "Add a cookie class test\n" }, { "from": "human", "value": "import unittest, time\n\nimport ocookie\n\nclass OcookieTest(unittest.TestCase):\n def test_foo(self):\n pass\n\nclass CookieParserTest(unittest.TestCase):\n def test_parsing(self):\n tex...
python
chosen
[ { "from": "system", "value": "Throw more data into the autocomplete view.\n" }, { "from": "human", "value": "from django.views.generic import View\nfrom django.views.generic.base import TemplateView\n\nfrom braces.views import AjaxResponseMixin, JSONResponseMixin\nfrom haystack.query import Sear...
python
chosen
[ { "from": "system", "value": "Use struct.pack instead of int.to_bytes\n\nint.to_bytes is not available on Python 2\n" }, { "from": "human", "value": "import sys\nfrom socket import htonl, inet_ntoa\n\nimport pytest\n\nfrom arpreq import arpreq\n\n\ndef test_localhost():\n assert arpreq('127.0...
python
chosen
[ { "from": "system", "value": "Switch from weakreflist library to own implementation\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 31.08.2017 11:18\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom weakreflist import WeakList\nfrom .IsMethods...
python
chosen
[ { "from": "system", "value": "Make event loop work for runner\n" }, { "from": "human", "value": "from pytest import mark, raises\nfrom oshino.run import main\nfrom mock import patch\n\n\n@mark.integration\n@patch(\"oshino.core.heart.forever\", lambda: False)\ndef test_startup():\n with raises...
python
chosen
[ { "from": "system", "value": "Clean up changes to thread test\n" }, { "from": "human", "value": "#!/usr/bin/python2\n\nimport pstack\nimport json\n\nthreads, text = pstack.JSON([\"tests/thread\"])\nresult = json.loads(text)\n# we have 10 threads + main\nassert len(threads) == 11\nentryThreads = ...
python
chosen
[ { "from": "system", "value": "Add imaginary fence list comprehension\n" }, { "from": "human", "value": "# File: rail_fence_cipher.py\n# Purpose: Implement encoding and decoding for the rail fence cipher.\n# Programmer: Amal Shehu\n# Course: Exercism\n# Date: Friday 30 Sep...
python
chosen
[ { "from": "system", "value": "Use BulkText instead of Text in input keyword\n\nFixes #164\n" }, { "from": "human", "value": "from TestStack.White.UIItems import TextBox\nfrom WhiteLibrary.keywords.librarycomponent import LibraryComponent\nfrom WhiteLibrary.keywords.robotlibcore import keyword\n\...
python
chosen
[ { "from": "human", "value": "Add shared db connection to the package\n" }, { "from": "gpt", "value": "import mongoengine\n\n# Open a connection to the MongoDB database, to be shared throughout the\n# application.\ndb = mongoengine.connect('lazy', host='127.0.0.1', port=27017)\n" } ]
python
chosen
[ { "from": "system", "value": "Add an example for event usage\n" }, { "from": "human", "value": "class ListenerRegister(object):\n def __init__(self):\n self._register = {}\n\n def add_listener(self, event, listener):\n event = event.upper()\n listeners = self._register...
python
chosen
[ { "from": "system", "value": "Add a new context processor to include the NAME_TYPE_CHOICES in every request context.\n" }, { "from": "human", "value": "def baseurl(request):\n \"\"\"\n Return a BASE_URL template context for the current request\n \"\"\"\n if request.is_secure():\n ...
python
chosen
[ { "from": "system", "value": "Fix migration tree for journal 0035\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.23 on 2019-11-03 20:56\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n...
python
chosen
[ { "from": "system", "value": "Remove a database access from the template tag.\n" }, { "from": "human", "value": "from django import template\n\nfrom ..schema import is_shared_model as _is_shared_model\nfrom ..schema import get_schema_model\n\nSchema = get_schema_model()\n\nregister = template.Li...
python
chosen
[ { "from": "system", "value": "Fix Tox/Travis testing on Python 2.7" }, { "from": "human", "value": "\nfrom __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nimport locale\nimport sys\n\n\n__all__ = ['PY2']\n\n\nPY2 = sys.version_info < (3...
python
chosen
[ { "from": "system", "value": "Fix import to match the new directory structure\n" }, { "from": "human", "value": "# Create a dummy user for the app store review testing\n# This needs to be done every time we switch to a new database\n\nimport sys\nfrom dao.user import User\n\ndef create_fake_JWT_...
python
chosen
[ { "from": "system", "value": "Update the crential dialog for perforce - untested" }, { "from": "human", "value": "'''\n ====================================================================\n Copyright (c) 2018 Barry A Scott. All rights reserved.\n\n This software is licensed as described in the...
python
chosen
[ { "from": "system", "value": "Add public method to get token.\n\nSigned-off-by: Tomoe Sugihara <6015414ca332492cf0bb4dbbac212276d1c110a7@midokura.com>\n" }, { "from": "human", "value": "\nfrom keystoneclient.v2_0 import client as keystone_client\n\nfrom datetime import datetime\nfrom datetime im...
python
chosen
[ { "from": "system", "value": "Fix str/int usage in MockConferenceHolder\n" }, { "from": "human", "value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify it und...
python
chosen
[ { "from": "system", "value": "Add FT to test if angular is loaded\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .base import FunctionalTestCase\nfrom .pages import game\n\nclass HomePageTest(FunctionalTestCase):\n def test_create_game(self):\n # Alice is a user who v...
python
chosen
[ { "from": "system", "value": "Add the command that failed to the error log and the error email to help debug problems where the error produces no output.\n" }, { "from": "human", "value": "import os, sys, time, traceback\nimport smtplib\nfrom boto.utils import ShellCommand, get_ts\nimport boto\n...
python
chosen
[ { "from": "system", "value": "Comment out the tests so that the diagnostic test can run.\n" }, { "from": "human", "value": "from pyQuantuccia import quantuccia\n\n\ndef test_get_holiday_date():\n \"\"\" At the moment the only thing this function\n can do is return NULL.\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Fix flake8 issue in init\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__author__ = 'Raphael Pierzina'\n__email__ = 'raphael@hackebrot.de'\n__version__ = '0.1.0'\n\nfrom .jinja2_time import TimeExtension\n\n__all__ = ['TimeExtension']\n" }, { ...
python
chosen
[ { "from": "system", "value": "Set logging level depenging on environment\n" }, { "from": "human", "value": "import os\nimport webapp2\n\nimport handlers\n\n\ndebug = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')\n\ntask_app = webapp2.WSGIApplication([\n ('/task/index', handlers.Inde...
python
chosen
[ { "from": "system", "value": "Build out hash item class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''Implementation of a simple hash table.\nThe table has `hash`, `get` and `set` methods.\nThe hash function uses a very basic hash algorithm to insert the value\ninto the table.\n...
python
chosen
[ { "from": "system", "value": "Add product_security.xml file entry in update_xml section\n\nbzr revid: mga@tinyerp.com-c1c968b6c0a6dd356a1ae7bc971a2daa2356a46d" }, { "from": "human", "value": "{\n\t\"name\" : \"Products & Pricelists\",\n\t\"version\" : \"1.0\",\n\t\"author\" : \"Tiny\",\n\t\"cate...
python
chosen
[ { "from": "system", "value": "Add cppcheck issue id as code field" }, { "from": "human", "value": "from SublimeLinter.lint import Linter, util\n\n\nclass Cppcheck(Linter):\n cmd = (\n 'cppcheck',\n '--template={file}:{line}: {severity}: {message}',\n '--inline-suppr',\n ...
python
chosen
[ { "from": "system", "value": "Use find_library to search for openssl libs\n" }, { "from": "human", "value": "\"\"\"\n Interface to some libcrypto functions\n\n\"\"\"\n\n\nfrom ctypes import CDLL, c_char_p\n\ndef config(filename=None):\n \"\"\"\n Loads OpenSSL Config file. If none ar...
python
chosen
[ { "from": "system", "value": "Make services only receive their related configs\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom os.path import abspath\nfrom os.path import dirname\nfrom flask import Flask, request\nimport yaml\nimport utils.config\nfrom services im...
python
chosen
[ { "from": "system", "value": "Fix typehint that is invalid in python 3.8\n" }, { "from": "human", "value": "from django.core.cache import cache\n\nfrom .models import PodcastProvider\nfrom .remote.interface import PodcastDetails\nfrom .remote.timbre import fetch_podcasts, fetch_podcast\n\n__all_...
python
chosen
[ { "from": "system", "value": "Create TelegramBotApi and Config classes\n\nTo clean up code\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport requests\n\nAUTH_TOKEN = open(\"config/auth_token\").read().strip()\nUSER_ID = open(\"config/user_id\").read().strip()\n\nBASE_URL = \"ht...
python
chosen
[ { "from": "system", "value": "Fix testHarness call for Windows\n" }, { "from": "human", "value": "from SCons.Script import *\nimport inspect\n\n\ndef run_tests(env):\n import shlex\n import subprocess\n import sys\n\n cmd = shlex.split(env.get('TEST_COMMAND'))\n print('Executing:'...
python
chosen
[ { "from": "system", "value": "Support Python 3.6 event loops in this example\n" }, { "from": "human", "value": "from pythonosc.osc_server import AsyncIOOSCUDPServer\nfrom pythonosc.dispatcher import Dispatcher\nimport asyncio\n\n\ndef filter_handler(address, *args):\n print(f\"{address}: {arg...
python
chosen
[ { "from": "system", "value": "Adjust the interface for split function\n" }, { "from": "human", "value": "import argparse\nimport logging\n\nfrom create_dataset import *\n\nif __name__ == '__main__':\n logging.basicConfig(format='%(asctime)s %(message)s', datefmt='[%Y/%m/%d][%I:%M:%S %p] ', le...
python
chosen
[ { "from": "system", "value": "Change newline character to LF\n" }, { "from": "human", "value": "#!/usr/bin/env python3\r\n# -*- coding: utf-8 -*-\r\nimport Tool\r\nimport time\r\nfrom Tieba import Tieba\r\n\r\n\r\ndef main():\r\n print(\"Local Time:\", time.asctime(time.localtime()))\r\n #...
python
chosen
[ { "from": "system", "value": "feat: Implement __abs__ and __sub__ dunder methods\n\nImplement methods which are required to apply assertEqual and assertAlmostEqual to points." }, { "from": "human", "value": "#!/usr/bin/env python\nimport math\n\nfrom geometry_msgs.msg import Point\n\n\nclass Neg...
python
chosen
[ { "from": "system", "value": "Fix imports when using the client on Solaris\n\nPreviously the incorrect syntax had been used for inserting an item at\nthe beginning of sys.path.\n\nChange-Id: I98a1451dd84619a0ba5f5be3dc4163509b867149\nAddresses-Issue: Jira/AQUILON-1276\nReviewed-by: Gabor Gombas <3bb8c49439d...
python
chosen
[ { "from": "system", "value": "Add readline support with vi keybindings\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport shutil\nimport sys\nimport traceback\n\nbuiltin_cmds = {'cd', 'pwd', 'exit',}\n\ndef prompt():\n print('%s $ ' % os.getcwd(), end='', flush=Tru...
python
chosen
[ { "from": "system", "value": "Add camera selection based on desired feed and camera number\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport rospy\nimport Adafruit_BBIO.GPIO as GPIO\nfrom vortex_msgs.msg import CameraFeedSelection\n\nPIN_MAP_FEED0 = rospy.get_param('/camera/pin_ma...
python
chosen
[ { "from": "system", "value": "Fix forgotten 'request' parameter to hasattr\n" }, { "from": "human", "value": "from django.forms.widgets import Media\nfrom django.utils.encoding import smart_unicode\nfrom django.conf import settings\nfrom cms.middleware.toolbar import HTML_TYPES\n\ndef inster_bef...
python
chosen
[ { "from": "system", "value": "Remove unused imports, clean up trailing whitespace.\n" }, { "from": "human", "value": "from test_support import verify,verbose\nimport imaplib\nimport time\n\n# We can check only that it successfully produces a result,\n# not the correctness of the result itself, s...
python
chosen
[ { "from": "system", "value": "Fix target_id support in JenkinsGenericBuilder\n" }, { "from": "human", "value": "from .builder import JenkinsBuilder\n\n\nclass JenkinsGenericBuilder(JenkinsBuilder):\n def __init__(self, *args, **kwargs):\n self.script = kwargs.pop('script')\n sel...
python
chosen
[ { "from": "system", "value": "Add auto-pdb fallback when not in translated mode for target\n" }, { "from": "human", "value": "from pycket.expand import load_json_ast_rpython\nfrom pycket.interpreter import interpret_one\nfrom pycket.error import SchemeException\n\nfrom rpython.rlib import jit\n\...
python
chosen
[ { "from": "system", "value": "Add test for attribute instance assertion\n" }, { "from": "human", "value": "import uuid\n\nfrom datetime import datetime\n\nfrom dateutil.tz import UTC\n\nfrom event_manager.event import Attribute\nfrom tests.utils import BaseTest\n\n\nclass TestAttribute(BaseTest)...
python
chosen
[ { "from": "system", "value": "Augment unit test for show_hist\n" }, { "from": "human", "value": "import openpnm as op\n\n\nclass GenericGeometryTest:\n\n def setup_class(self):\n self.net = op.network.Cubic(shape=[3, 3, 3])\n self.geo = op.geometry.StickAndBall(network=self.net,...
python
chosen
[ { "from": "system", "value": "Fix QDataStream <</>> QPixmap test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport unittest\nimport sys\n\nfrom PySide import QtGui, QtCore\n\n\nclass QAppPresence(unittest.TestCase):\n\n def testQPixmap(self):\n ds = QtCore.QDataStrea...
python
chosen
[ { "from": "system", "value": "Create a GET products method\n" }, { "from": "human", "value": "from flask import Flask\n\n# Create Flask application\napp = Flask(__name__)\n\n@app.route('/inventory')\ndef index():\n \"\"\" Intro page of the inventory API\n\n This method will only return some we...
python
chosen
[ { "from": "system", "value": "doit: Fix call to \"coverage run\"\n" }, { "from": "human", "value": "from doitpy.pyflakes import Pyflakes\n\n\nDOIT_CONFIG = {'default_tasks': ['pyflakes', 'test', 'doctest']}\n\n\ndef task_pyflakes():\n yield Pyflakes().tasks('*.py')\n\ndef task_test():\n re...
python
chosen
[ { "from": "system", "value": "Add custom permissions to admin profile for spam, metrics, and prereg\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass AdminProfile(models.Model):\n\n user = models.OneToOneField('osf.OSFUser', related_name='admin_profile')\n\n desk_t...
python
chosen
[ { "from": "system", "value": "Fix regex matching coverage output\n\nThe coverage library now returns the file extensions.\n" }, { "from": "human", "value": "import os.path\n\nfrom nose2.tests._common import FunctionalTestCase\n\n\nclass TestCoverage(FunctionalTestCase):\n def test_run(self):\...
python
chosen
[ { "from": "system", "value": "Use a private RNG for guids. Avoids potential for trouble w/ the global instance.\n" }, { "from": "human", "value": "\"\"\" Utility functions\n\"\"\"\nimport random\nimport time\nfrom . import constants\n\ndef _service_url_from_hostport(secure, host, port):\n \"\...
python
chosen
[ { "from": "system", "value": "Use unit test.TestCase instead of SimpleTestCase\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom django.test import SimpleTestCase\nfrom guardian.compat import get_user_model\nfrom guardian.c...
python
chosen
[ { "from": "system", "value": "Add Apache 2.0 license to source file\n\nAs per OpenStack licensing guide lines [1]:\n[H102 H103] Newly contributed Source Code should be licensed under\nthe Apache 2.0 license.\n[H104] Files with no code shouldn't contain any license header nor\ncomments, and must be left comp...
python
chosen
[ { "from": "system", "value": "Update longname for Boise state\n" }, { "from": "human", "value": "'''\nHarvester for the ScholarWorks for the SHARE project\n\nExample API call: http://scholarworks.boisestate.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc\n'''\nfrom __future__ import unicode_l...
python
chosen
[ { "from": "system", "value": "Change the LD search path\n" }, { "from": "human", "value": "from cffi import FFI\n\nffi = FFI()\nffi.cdef(\"\"\"\ntypedef struct _fluid_hashtable_t fluid_settings_t;\ntypedef struct _fluid_synth_t fluid_synth_t;\ntypedef struct _fluid_audio_driver_t fluid_audio_dri...
python
chosen
[ { "from": "system", "value": "Make AlsaMixer work on hosts without a mixer named 'Master'\n" }, { "from": "human", "value": "import alsaaudio\n\nfrom mopidy.mixers import BaseMixer\n\nclass AlsaMixer(BaseMixer):\n \"\"\"\n Mixer which uses the Advanced Linux Sound Architecture (ALSA) to co...
python
chosen
[ { "from": "system", "value": "Fix java.nio.file import in AutoCloseable example\n" }, { "from": "human", "value": "import jpype\n\n\nclass Thread:\n \"\"\" Thread support for Python\n\n JPype adds methods to ``java.lang.Thread`` to interact with \n Python threads. These methods are al...
python
chosen
[ { "from": "system", "value": "Enable passing str to echo\n" }, { "from": "human", "value": "import sys\nfrom functools import partial, wraps\n\nimport click\n\n\ndef verify_response(func):\n \"\"\"Decorator verifies response from the function.\n It expects function to return (bool, []), wh...
python
chosen
[ { "from": "system", "value": "Read testdata from file, print valid transactions\n" }, { "from": "human", "value": "import ndaparser\n\nif __name__ == \"__main__\" : \n trns = ndaparser.parseLine(\"T10188000060SCTSZFW3GT3WU1B 1501131501131501121710Viitemaksu +00000000...
python
chosen
[ { "from": "system", "value": "Add the SQL to update account balance direction field bal_direct\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport time\nfrom openerp.report import report_sxw\nfrom openerp.osv import fields, osv\n \nclass account_account(osv.osv):\n _inherit ...
python
chosen
[ { "from": "system", "value": "Send text to wget/curl unless html content-type\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom flask import Flask, render_template, request, make_response\nfrom names import get_full_name\n\n\napp = Flask(__name__)\n\n\n@app.route(\"/\")\n...
python
chosen
[ { "from": "system", "value": "Scripts: Fix for working directory containing whitespace\n" }, { "from": "human", "value": "def getUserPath(filename, is_command):\n import lib.app, os\n # Places quotation marks around the full path, to handle cases where the user-specified path / file name conta...
python
chosen
[ { "from": "system", "value": "Add Category model and expanding Post model.\n\nPost model now contains a publish date and a foreign key reference\nto the Category model.\n" }, { "from": "human", "value": "\"\"\"Collection of Models used in blogsite.\"\"\"\nfrom . import db\n\n\nclass Post(db.Mode...
python
chosen
[ { "from": "system", "value": "Remove a test that is no longer relevant\n" }, { "from": "human", "value": "import json\n\nfrom django.conf import settings\nfrom django.test import TestCase\n\nfrom go.api.go_api import client\n\nfrom mock import patch\n\n\nclass ClientTestCase(TestCase):\n @pat...
python
chosen
[ { "from": "system", "value": "Fix the same typo in GrabLaunchpadBugs\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom mysite.search.models import Project\nfrom celery.task import PeriodicTask\nfrom celery.registry import tasks\nfrom mysite.search.launchpad_crawl import gra...
python
chosen
[ { "from": "system", "value": "Make it easier to find the source map for app.js\n\n(imported from commit bca27c9838573fb4b74e2d269b253a48702c9e1c)\n" }, { "from": "human", "value": "from django.conf import settings\nfrom hashlib import sha1\nfrom os import path\n\nfrom pipeline.compr...
python
chosen
[ { "from": "system", "value": "Add run solver first exception type\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom datetime import datetime\n\nclass BaseSolver(object):\n task = None\n\n best_solution = None\n best_distance = float('inf')\n search_t...
python
chosen
[ { "from": "system", "value": "Move WxApplication into its own Wx submodule\n" }, { "from": "human", "value": "from Cura.WxApplication import WxApplication\n\nimport wx\n\nclass PrinterApplication(WxApplication):\n def __init__(self):\n super(PrinterApplication, self).__init__()\n ...
python
chosen
[ { "from": "system", "value": "Write short blurb about module and its usage\n" }, { "from": "human", "value": "from .api import process_from_web\nfrom .processor import OmniPathProcessor\n" }, { "from": "gpt", "value": "\"\"\"\nThe OmniPath module accesses biomolecular interaction dat...
python
chosen
[ { "from": "system", "value": "Add scikit-image to test header information" }, { "from": "human", "value": "# this contains imports plugins that configure py.test for astropy tests.\n# by importing them here in conftest.py they are discoverable by py.test\n# no matter how it is invoked within the...
python
chosen
[ { "from": "system", "value": "Index action ready with \"Hello, World!\" message\n" }, { "from": "human", "value": "from flask import Flask\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef hello_world():\n return 'Hello World!'\n\n\nif __name__ == '__main__':\n app.run()\n" }, { "...
python
chosen
[ { "from": "system", "value": "Increase wrap mode test coverage\n" }, { "from": "human", "value": "from hypothesis_auto import auto_pytest_magic\n\nfrom isort import wrap_modes\n\nauto_pytest_magic(wrap_modes.grid, auto_allow_exceptions_=(ValueError,))\nauto_pytest_magic(wrap_modes.vertical, auto...
python
chosen
[ { "from": "system", "value": "Use absolute path to make the node work.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport rospy\nfrom std_msgs.msg import Int32\n\npub = rospy.Publisher('/pub_val', Int32, queue_size=10)\n\n\ndef pub_foo():\n rospy.init_node('pub_foo', anonymous...
python
chosen
[ { "from": "system", "value": "Read secret key from env var explicitly\n" }, { "from": "human", "value": "\"\"\"\nBased on:\n\nhttps://devcenter.heroku.com/articles/getting-started-with-django\n\"\"\"\n\nimport settings\n\nDEBUG = False\n\n# Parse database configuration from $DATABASE_URL\nimport...
python
chosen
[ { "from": "system", "value": "Rename var to comply with pylint\n" }, { "from": "human", "value": "\"\"\"\n TODO load balancer check settings\n\"\"\"\n\nfrom biothings.web.api.es.handlers.base_handler import BaseESRequestHandler\nfrom elasticsearch.exceptions import ElasticsearchException\nfro...
python
chosen
[ { "from": "system", "value": "Use registration form to prevent duplicate emails\n\nFixes #725.\n\nWe enforce this both at the database level, and here, using django\nregistration's ready-made form class.\n" }, { "from": "human", "value": "from django.conf.urls import patterns\nfrom django.conf.u...
python
chosen
[ { "from": "system", "value": "Discard charcode 254 at end of URL\n" }, { "from": "human", "value": "import signal\nimport time\n\nfrom pirc522 import RFID\n\nloop = True\nrfid = RFID()\nutil = rfid.util()\n\ndef end_read(signal, frame):\n global loop\n print(\"\\nCtrl+C captured, ending re...
python
chosen
[ { "from": "system", "value": "Fix incorrect column in IndexFile model\n\n* Change `reference` to `index`.\n* Removed unused import of `enum`" }, { "from": "human", "value": "import enum\nfrom sqlalchemy import Column, Integer, String, Enum\n\nfrom virtool.pg.utils import Base, SQLEnum\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Fix lirear regression model loss calculation\n" }, { "from": "human", "value": "import random\nfrom keras.models import Sequential\nfrom keras.layers import Dense, Activation\nimport numpy as np\n\ndef generate_data(size):\n \"\"\"\"\n x_train = []\n y_tra...
python
chosen
[ { "from": "system", "value": "Fix stoptimes in range function to actually take a full blown address\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom django.conf import settings\nimport os\n\n# Uncomment the next two lines to enable the admin:\n# from django.contri...
python
chosen
[ { "from": "system", "value": "Add test of slack rtm read\n" }, { "from": "human", "value": "import slackclient\nimport time\nimport os\n\n" }, { "from": "gpt", "value": "import slackclient\nimport time\nimport os\n\nslackClient = slackClient.SLackClient(os.environ[\"SLACK_TOKEN\"])\n...
python
chosen
[ { "from": "system", "value": "Fix admin URLs; turn deprecation warnings into errors\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\n# Uncomment the next two lines to enable the admin:\nf...
python
chosen
[ { "from": "system", "value": "Refactor view to use fixtures from `pytest-django`.\n" }, { "from": "human", "value": "from django.test import LiveServerTestCase\n\ntry:\n from django.urls import reverse\nexcept ImportError: # django < 1.10\n from django.core.urlresolvers import reverse\n\n...
python
chosen
[ { "from": "system", "value": "Add more attributes for User, update db\n" }, { "from": "human", "value": "from app import db\nfrom hashlib import md5\n\n\nclass User(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n nickname = db.Column(db.String(64), index=True, unique=True)\n ...
python
chosen
[ { "from": "system", "value": "Add more defaults to Maya exporter" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom . import base\n\nfrom maya import cmds\n\n__also_reload__ = ['.base']\n\n\nclass Exporter(base.Exporter):\n \n def get_previous_publish_ids(self)...
python
chosen
[ { "from": "system", "value": "Declare app_label in model Meta class to work with Django 1.9\n\nFixes RemovedInDjango19Warning:\n\nModel class db_mutex.models.DBMutex doesn't declare an explicit\napp_label and either isn't in an application in INSTALLED_APPS or else\nwas imported before its application was l...
python
chosen