conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove print statements from daemon\n" }, { "from": "human", "value": "#!/usr/bin/env python\n \n#Script adapted from example by Sander Marechal, released into public domain\n#Taken from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/\n \...
python
chosen
[ { "from": "system", "value": "Fix attribute error in vsphere controller\n\nSigned-off-by: Adam Stokes <49c255c1d074742f60d19fdba5e2aa5a34add567@users.noreply.github.com>\n" }, { "from": "human", "value": "from conjureup import controllers\nfrom conjureup.app_config import app\n\n\nclass BaseVSph...
python
chosen
[ { "from": "system", "value": "Add ability to add notes to a Chord.\n\nSigned-off-by: Charlotte Pierce <351429ca27f6e4bff2dbb77adb5046c88cd12fae@malformed-bits.com>\n" }, { "from": "human", "value": "class Chord(object):\n # TODO: doctring\n def __init__(self, root_note):\n # TODO: d...
python
chosen
[ { "from": "system", "value": "Remove set comprehension to support python 2.6\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom prompt_toolkit.validation import Validator, ValidationError\nfrom six import string_types\n\n\nclass SentenceValidator(Validator):\n \"...
python
chosen
[ { "from": "system", "value": "Allow more complex targetting in script test\n" }, { "from": "human", "value": "from gevent import monkey\nmonkey.patch_all() # noqa\nimport sys\nimport time\n\nfrom ethereum import slogging\n\nfrom raiden.network.transport import UDPTransport\nfrom raiden.network....
python
chosen
[ { "from": "system", "value": "Make package version string major.minor only\n" }, { "from": "human", "value": "from pkg_resources import get_distribution, DistributionNotFound\ntry:\n __version__ = get_distribution('kbcstorage').version\nexcept DistributionNotFound:\n # package is not insta...
python
chosen
[ { "from": "system", "value": "Fix failing test caused by new toolchain\n\nThe challenge with floating point values in tests is that the value can\nchange slightly based on the order of operations, which can legally\nbe affected by optimizations. The results aren't visible (often just\n1 ULP), but the tests ...
python
chosen
[ { "from": "system", "value": "Remove unused test fixture `create_order_item`\n" }, { "from": "human", "value": "\"\"\"\ntestfixtures.shop_order\n~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom byceps.services...
python
chosen
[ { "from": "system", "value": "Fix test on Django 1.9\n" }, { "from": "human", "value": "from django import template\n\nfrom lazy_tags.decorators import lazy_tag\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef test():\n return '<p>hello world</p>'\n\n\n@register.simple_tag\n@...
python
chosen
[ { "from": "system", "value": "Fix support of fresh keysym file\n" }, { "from": "human", "value": "import os\nimport re\n\nkeysym_re = re.compile(r\"^#define\\s+(XF86)?XK_(\\w+)\\s+(\\S+)\")\n\n\nclass Keysyms(object):\n __slots__ = ('name_to_code', 'code_to_name', '__dict__')\n\n def __ini...
python
chosen
[ { "from": "system", "value": "Fix error submitting article caused by extra HTML attribute.\n" }, { "from": "human", "value": "from django import forms\n\nfrom twobuntu.articles.models import Article, ScheduledArticle\n\n\nclass EditorForm(forms.ModelForm):\n \"\"\"\n Form for entering or e...
python
chosen
[ { "from": "system", "value": "Add some draft weather types\n\ntemperature_night_offset should possibly be the range so difference\nbetween night and day is not always the same.\n" }, { "from": "human", "value": "class WeatherType:\n def __init__(self, weathers, temperature_range, temperature_...
python
chosen
[ { "from": "system", "value": "Allow the option of specifying a path in startup\n" }, { "from": "human", "value": "import subprocess\nimport commands\nimport re\nimport signal\nimport os\nimport logging\n\n_logger = logging.getLogger(__name__)\n\nTARGET_DIR='test/target'\nPORT='27018'\n\ndef star...
python
chosen
[ { "from": "system", "value": "Rename some variables to try to explain magic\n" }, { "from": "human", "value": "from factory import DjangoModelFactory, CREATE_STRATEGY, LazyAttribute, post_generation, SubFactory\n\nfrom yunity.models import Category\nfrom yunity.utils.tests.fake import faker\n\n\...
python
chosen
[ { "from": "system", "value": "Set the git author name and e-mail\n" }, { "from": "human", "value": "import git\nimport os\n\nfrom django.conf import settings\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import render\n\nclass SaveContentMixin():\n \n \"\"\"Save exam...
python
chosen
[ { "from": "system", "value": "Add initi for beautiful API\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# @Author: balicanta\n# @Date: 2014-11-01 21:02:00\n# @Last Modified by: balicanta\n# @Last Modified time: 2014-11-01 21:02:00\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Fix some characters messing up the SECRET_KEY\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport os, re\nimport tenma\n\nfrom django.conf import settings\nfrom django.core import management\nfrom django.utils.crypto import get_rando...
python
chosen
[ { "from": "system", "value": "Fix slot release on method exception\n" }, { "from": "human", "value": "import functools\n\nfrom pkit.slot import get_slot_pool\n\n\ndef acquire(pool_name):\n \"\"\"Actor's method decorator to auto-acquire a slot before execution\"\"\"\n def decorator(method):...
python
chosen
[ { "from": "system", "value": "Remove cronos_debug, un-hardcode the mail address in mail_cronos_admin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\nfrom django.core.mail import send_mail\nimport logging\n#import traceback\n\ndef cronos_debug(msg, ...
python
chosen
[ { "from": "system", "value": "Fix some pylint found errors and warnings\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nDjango forms data generators\n\n\"\"\"\nfrom django import forms\nfrom django_any import xunit\n\nclass FormFieldDataFactory(object):\n def __init__(self...
python
chosen
[ { "from": "system", "value": "Rewrite crawler for \"Whomp!\" after feed change\n" }, { "from": "human", "value": "import re\n\nfrom comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Whom...
python
chosen
[ { "from": "system", "value": "Remove redundant status code from error response body.\n" }, { "from": "human", "value": "\"\"\"API errors.\"\"\"\nfrom werkzeug.exceptions import HTTPException\n\n\nclass Error(Exception):\n status = 500\n error = \"internal server error\"\n\n def __init__...
python
chosen
[ { "from": "system", "value": "Increment version number for git master\n" }, { "from": "human", "value": "'Scrypt for Python'\n\n__version__ = '1.1.0'\n\n# First, try loading libscrypt\n_done = False\ntry:\n from pylibscrypt import *\nexcept ImportError:\n pass\nelse:\n _done = True\n\n#...
python
chosen
[ { "from": "system", "value": "Fix the test to disassemble as if at address zero, not at an invalid address. The default SBAddress constructor sets the offset to 0xffffffffffffffff and the section to NULL.\n\nThis was causing problems on clang 602 branches that use MemoryObjects to as the container for opcod...
python
chosen
[ { "from": "system", "value": "[FIX] Change the name of module in the manifest\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © <YEAR(S)> <AUTHOR(S)>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n{\n \"name\": \"Field(s) Required Res Partner\",\n \"su...
python
chosen
[ { "from": "system", "value": "Mark test slow via nose attrib plugin\n" }, { "from": "human", "value": "import time as _time\nimport subprocess\nimport sys\nimport redisdl\nimport unittest\nimport json\nimport os.path\nfrom . import util\nfrom . import big_data\n\nclass RaceDeletingKeysTest(unitt...
python
chosen
[ { "from": "system", "value": "Move retrieving output into method.\n" }, { "from": "human", "value": "import subprocess\nimport unittest\n\nclass CompareErrorMessages(unittest.TestCase):\n def test_missing_file_return_code_the_same_as_ls(self):\n args = ['./lss.sh', 'foo']\n ret ...
python
chosen
[ { "from": "system", "value": "Add hourly, daily, weelky and monthly sched helpers\n" }, { "from": "human", "value": "from apscheduler.schedulers.background import BackgroundScheduler\n\n\nclass Scheduler(BackgroundScheduler):\n\n def __init__(self):\n super().__init__()\n self.s...
python
chosen
[ { "from": "system", "value": "Refactor to change the workflow\n\nThis is functionally the same code, but this reads a little better (to\nme). I've also added a code comment to explain what's going on here\nsince it does seem so weird.\n" }, { "from": "human", "value": "import hashlib\nfrom Stri...
python
chosen
[ { "from": "system", "value": "Create constant to store path for results\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nTRAJECTORY = 'squared'\nCONTROLLER = 'pid'\n\n# control constants\nK_X = 0.90\nK_Y = 0.90\nK_THETA = 0.90\n\n# PID control constants\nK_P_V = 0.2\nK_I_V = 1.905\nK_...
python
chosen
[ { "from": "system", "value": "Change manual listing of submodules to automatic\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport importlib\n\n__all__ = [\"linalg\", \"single_parameter\"]\n\nfor m in __all__:\n importlib.import_module(\"continuate.\" + m)\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Refactor argument processing to list comprehension\n" }, { "from": "human", "value": "import types\nfrom query_builder import FILTER_FIELDS, TEXT_FIELDS\nfrom conversions import strip_and_lowercase\n\n\ndef process_values_for_matching(request_json, key):\n values...
python
chosen
[ { "from": "system", "value": "Allow specifying which project to udpate with the management command\n" }, { "from": "human", "value": "\nimport datetime\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom pontoon.administration.utils.files import (\n update_from_reposi...
python
chosen
[ { "from": "system", "value": "Fix error where self.config was undefined\n\nThese decorators are harsh\n" }, { "from": "human", "value": "import zirc\nimport ssl\nimport socket\nimport utils\nimport commands\n\n\ndebug = False\n\nclass Bot(zirc.Client):\n def __init__(self):\n self.conn...
python
chosen
[ { "from": "system", "value": "Add parameter capacity to circular-buffer example\n\nFixes #550" }, { "from": "human", "value": "class BufferFullException(Exception):\n pass\n\n\nclass BufferEmptyException(Exception):\n pass\n\n\nclass CircularBuffer(object):\n def __init__(self):\n ...
python
chosen
[ { "from": "system", "value": "Handle unexpected errors and store stack trace to the log\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport logging\n\nfrom tenhou.client import TenhouClient\nfrom utils.settings_handler import settings\n\n\nlogger = logging.getLogger('tenhou')\n\n\...
python
chosen
[ { "from": "system", "value": "Fix tests by passing default settings object rather than empty dict.\n" }, { "from": "human", "value": "from contextlib import contextmanager\nfrom os import path\nfrom unittest import TestCase\n\nfrom dictdiffer import diff\nfrom jsontest import JsonTest\nfrom mock...
python
chosen
[ { "from": "system", "value": "Add method for getting PIL image\n\nAlso change function names to be uniform throughout\n" }, { "from": "human", "value": "import json\nimport os\nimport random\n\nimport requests\n\nfrom PIL import Image\n\n# GLOBALS\n\nendpoint = \"https://www.googleapis.com/custo...
python
chosen
[ { "from": "system", "value": "Fix docstring in `PacmanUnpackGroup` fact.\n" }, { "from": "human", "value": "from pyinfra.api import FactBase\n\nfrom .util.packaging import parse_packages\n\nPACMAN_REGEX = r'^([0-9a-zA-Z\\-]+)\\s([0-9\\._+a-z\\-]+)'\n\n\nclass PacmanUnpackGroup(FactBase):\n ''...
python
chosen
[ { "from": "human", "value": "Add read image in color\n" }, { "from": "gpt", "value": "import numpy as np\nimport cv2\n\n# Load an image in color\nimg = cv2.imread(\"doge.jpeg\", 1)\ncv2.imshow(\"image\", img)\nkey = cv2.waitKey(0)\n\ncv2.destroyAllWindows()" } ]
python
chosen
[ { "from": "system", "value": "Update command line interface to accept floating point input\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import division\nimport argparse\n\nticks = ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')\n\ndef scale_data(data):\n m = min(data)\...
python
chosen
[ { "from": "system", "value": "Debug flags back to false. Can't use it on prod D:\n\nThis reverts commit 4bf055370da89b13fbe4d1076562183d661904ce.\n" }, { "from": "human", "value": "import os\nfrom flask import Flask\nfrom flask import render_template\nfrom flask import send_from_directory\nimpor...
python
chosen
[ { "from": "system", "value": "Add support for executing in a virtual env\n" }, { "from": "human", "value": "#!/usr/bin/python3.5\n# -*- coding: utf-8 -*-\n\nimport sys\n\ndef check_dependencies():\n deps = [\"PyQt5\", \"unicorn\", \"capstone\", \"keystone\", \"pygments\"]\n for d in deps:\...
python
chosen
[ { "from": "system", "value": "Add API layer using Flask :dancers:\n" }, { "from": "human", "value": "from crawlers.one337x import One337x\n\n\nif __name__ == '__main__':\n crawler = One337x()\n torrents = list(crawler.fetch_torrents('arrow'))\n" }, { "from": "gpt", "value": "fr...
python
chosen
[ { "from": "system", "value": "Use new Bottle debug API\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom glob import glob\nimport os.path\nimport re\n\nimport bottle\n\n\n@bottle.route('/')\n@bottle.view('index')\ndef index():\n return dict(debug=bottle.request.GET.get('debug')...
python
chosen
[ { "from": "system", "value": "Add explanatory docstring for the purpose of the go api proxy view\n" }, { "from": "human", "value": "from django.http import HttpResponse\nfrom django.contrib.auth.decorators import login_required\nfrom django.views.decorators.http import require_http_methods\nfrom...
python
chosen
[ { "from": "system", "value": "Improve password handling in UserFactory.\n" }, { "from": "human", "value": "import factory\n\nfrom django.contrib.auth import get_user_model\n\n\nclass UserFactory(factory.DjangoModelFactory):\n FACTORY_FOR = get_user_model()\n name = factory.Sequence(lambda ...
python
chosen
[ { "from": "system", "value": "Use start of month/year dates instead of end.\n" }, { "from": "human", "value": "def get_monthly_anomaly(ts, start, end):\n \"\"\"\n Get monthly anomaly.\n\n Monthly anomalies calculated from the mean of the data between the specified start and end ...
python
chosen
[ { "from": "system", "value": "Add vectorized version of np.linalg.pinv\n" }, { "from": "human", "value": "\"\"\" Utilities to manipulate numpy arrays \"\"\"\n\nimport sys\n\nimport numpy as np\n\nfrom nibabel.volumeutils import endian_codes, native_code, swapped_code\n\n\ndef as_native_array(arr...
python
chosen
[ { "from": "system", "value": "Fix formatting file for travis\n" }, { "from": "human", "value": "# Copyright (c) 2016 Canonical Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# ...
python
chosen
[ { "from": "system", "value": "Add url for static files [development]\n" }, { "from": "human", "value": "\"\"\"delphi URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/http/urls/\nExamples:\nFunctio...
python
chosen
[ { "from": "system", "value": "Switch from scanner to tokenizer.\n" }, { "from": "human", "value": "import verify\n\nclass Tree:\n def __init__(self, elements):\n self._elements = elements\n\n def count(self):\n return len(self._elements)\n\n def elements(self):\n result = []\n for...
python
chosen
[ { "from": "system", "value": "Add support another classes for filters, not only Item and Items\n" }, { "from": "human", "value": "import os\nimport glob\nimport inspect\nimport saw.items\n\ncurr_path = os.path.dirname(__file__)\n__all__ = [ os.path.basename(f)[:-3] for f in glob.glob(curr_path +...
python
chosen
[ { "from": "system", "value": "Change parameter names in acquire.\nAdd some doc.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport os\nimport fcntl\n\n\nclass FileLock(object):\n\n def __init__(self, fd):\n\n # the fd is borrowed, so do not close it\n self.fd...
python
chosen
[ { "from": "system", "value": "Add a description of what the output represents \n\n" }, { "from": "human", "value": "\"\"\"The search command.\"\"\"\n\nfrom paci.helpers import display_helper, cache_helper\nfrom .base import Base\n\n\nclass Search(Base):\n \"\"\"Searches for a package!\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Add created and is_active field to match appschema model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.conf import settings\n\nfrom tenant.utils import parse_connection_string\nfrom tenant.utils import connect_tenant_provider, disconne...
python
chosen
[ { "from": "system", "value": "Fix help text of unignore command\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom linkcheck.utils import unignore\n\n\nclass Command(BaseCommand):\n\n help = \"Goes through all models registered with Linkcheck and re...
python
chosen
[ { "from": "system", "value": "Add comment to explain the test with HARPS instrument\n" }, { "from": "human", "value": "import unittest\nfrom astropy.tests.helper import remote_data\nfrom astroquery.dace import Dace\n\nHARPS_PUBLICATION = '2009A&A...493..639M'\n\n\n@remote_data\nclass TestDaceCla...
python
chosen
[ { "from": "system", "value": "Fix AmplitudeLimiter > to >= for expected behavour" }, { "from": "human", "value": "\"\"\".\"\"\"\n\nclass AmplitudeLimiter(object):\n \"\"\".\"\"\"\n\n def __init__(self, f, *args, **kwargs):\n \"\"\"If thereareno decorator args the function tobe decor...
python
chosen
[ { "from": "system", "value": "Write .msg of chunk to file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n This example demonstrates a client fetching images from a server running img_server.py.\n\n The first packet contains the number of chunks to expect, and then that n...
python
chosen
[ { "from": "system", "value": "[Python] Complete 'About Triangle Project 2' koans\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Triangle Project Code.\n\n# Triangle analyzes the lengths of the sides of a triangle\n# (represented by a, b and c) and returns ...
python
chosen
[ { "from": "system", "value": "Add priority option to send_queued\n" }, { "from": "human", "value": "__version__ = '2.0.0'\n\ndef get_account(using=None):\n from django.conf import settings\n accounts = settings.SMSGATEWAY_ACCOUNTS\n if using is not None:\n return accounts[using]\...
python
chosen
[ { "from": "system", "value": "Add 'newusername' id to username on signup page\n\nNeeded for js frontend.\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, TextAreaField, PasswordField, HiddenField\nfrom wtforms.validators import DataRequired, Le...
python
chosen
[ { "from": "system", "value": "Add public profile account menu link" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.utils.translation import gettext_lazy as _\nfrom django.urls import reverse\n\nfrom .menu import menu_registry, MenuItem\n\n\nclass AccountConfig(App...
python
chosen
[ { "from": "system", "value": "Use only accelerometer for orientation.\n" }, { "from": "human", "value": "from flask import Flask, Response\nfrom sense_hat import SenseHat\n\n\nsense = SenseHat()\nsense.set_imu_config(True, True, True)\napp = Flask(__name__)\n\n\n@app.route('/')\ndef all_sensors(...
python
chosen
[ { "from": "system", "value": "Add a test for CmdRunner.\n" }, { "from": "human", "value": "\nfrom nose.tools import *\n\nfrom libeeyore.cpp.cppcompiler import CppCompiler\n\n\nclass FakeProcess( object ):\n def __init__( self, sys_op, retcode ):\n self.sys_op = sys_op\n self.ret...
python
chosen
[ { "from": "system", "value": "Modify to avoid excessive logger initialization\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimpo...
python
chosen
[ { "from": "system", "value": "Implement tokenization in preprocess function\n\n" }, { "from": "human", "value": "from nltk.tokenize import word_tokenize, sent_tokenize\nimport getopt\nimport sys\nimport os\nimport io\n\ndef load_data(dir_doc):\n\tdocs = {}\n\tfor dirpath, dirnames, filenames in ...
python
chosen
[ { "from": "system", "value": "Use a copypastable format for function tests\n" }, { "from": "human", "value": "\"\"\"A plugin to format test names uniformly for easy comparison\n\nUsage:\n\n # collect django tests\n COLLECT_ONLY=1 ./manage.py test -v2 --settings=settings 2> tests-django.txt...
python
chosen
[ { "from": "system", "value": "Set concurrency to 2 for local\n" }, { "from": "human", "value": "import sys\nfrom deployer.celery import app\n\nif __name__ == '__main__':\n argv = sys.argv if len(sys.argv) > 1 else [__file__, '--loglevel=info']\n app.worker_main(argv=argv)\n" }, { "...
python
chosen
[ { "from": "system", "value": "Allow loading discussions from file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\nimport argparse\nfrom models import DiscussionMarker\nimport re\nfrom datetime import datetime\nfrom database import db_session\n\n...
python
chosen
[ { "from": "system", "value": "Add boilerplate code to configure the Flask app.\n" }, { "from": "human", "value": "# Copyright 2007-2014 University Of Southern California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with...
python
chosen
[ { "from": "system", "value": "Fix missing metaclass for an interface class\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\n\nimport ...
python
chosen
[ { "from": "system", "value": "Add an alias to file_open_zip_aware as openz.\n" }, { "from": "human", "value": "__author__ = \"Shyue Ping Ong, Anubhav Jain, Michael Kocher, Geoffroy Hautier, Will Richards, Dan Gunter, Shreyas Cholia, Vincent L Chevrier, Rickard Armiento\"\n__date__ = \"Jun 28, 20...
python
chosen
[ { "from": "system", "value": "Set standard state of wizard to one (so first step automatically starts)\n" }, { "from": "human", "value": "from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot,pyqtSignal, pyqtProperty\n\nclass ToolbarProxy(QObject):\n def __init__(self, parent = None):\n ...
python
chosen
[ { "from": "system", "value": "Return to list generator to enable pandas cmd output\n" }, { "from": "human", "value": "__author__ = 'max'\n\nimport gpxpy\nimport pandas as pd\n\n\ndef parse_gpx(gpx_file_name):\n return gpxpy.parse(gpx_file_name)\n\n\ndef data_frame_for_track_segment(segment):\...
python
chosen
[ { "from": "system", "value": "Remove some Python 2 syntax.\n" }, { "from": "human", "value": "from django.template import loader\nfrom django.template.backends.django import Template as DjangoTemplate\ntry:\n from django.template.backends.jinja2 import Template as Jinja2Template\nexcept Impor...
python
chosen
[ { "from": "system", "value": "Create and modify lines in same loop\n" }, { "from": "human", "value": "from operator import itemgetter\n\nimport numpy as np\nfrom lxml.etree import fromstring, XMLSyntaxError\n\n\ndef parse_lines(lines):\n for line in lines:\n try:\n xml_line ...
python
chosen
[ { "from": "system", "value": "Add view for news details\n" }, { "from": "human", "value": "from django.shortcuts import render\n\nfrom akllt.models import NewsStory\n\n\ndef news_items(request):\n return render(request, 'akllt/news/news_items.html', {\n 'news_items': NewsStory.objects....
python
chosen
[ { "from": "system", "value": "Add regex support call to the command line\n" }, { "from": "human", "value": "'''\nThe management of salt command line utilities are stored in here\n'''\n# Import python libs\nimport optparse\nimport os\nimport sys\n\n# Import salt components\nimport salt.client\n\n...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"EAFP and removing redundant functions\"\"\n\nThis reverts commit b03c0898897bbd89f8701e1c4d6d84d263bbd039.\n" }, { "from": "human", "value": "import amqp\nfrom contextlib import closing\n\n\ndef __get_channel(connection):\n return connection.cha...
python
chosen
[ { "from": "system", "value": "Add expiry fields on card model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Checkout Models\"\"\"\nimport functools\n\nfrom flask import redirect, url_for\nfrom fulfil_client.model import ModelType, StringType\nfrom shop.fulfilio import Model\n...
python
chosen
[ { "from": "system", "value": "Return k with other results.\n" }, { "from": "human", "value": "'''\ncomparison.py - Comparison of analytic and calculated solutions\nCreated on 12 Aug 2010\n\n@author: Ian Huston\n'''\nfrom __future__ import division\n\nimport numpy as np\n\nimport analyticsolution...
python
chosen
[ { "from": "system", "value": "Add send_contact_{form,response} functions to mail init\n" }, { "from": "human", "value": "__all__ = ['mail']\nfrom .mail import send_mail, SUBJECTS\n" }, { "from": "gpt", "value": "__all__ = ['mail']\nfrom .mail import send_mail, SUBJECTS, send_contact_...
python
chosen
[ { "from": "system", "value": "Fix off-by-one in header line wrapping.\n" }, { "from": "human", "value": "from os import makedirs\nimport textwrap\n\nwith open('../resources/sounds/blip.wav', 'rb') as i:\n data = i.read()\n\nheader = \"\"\"\\\n#ifndef BLIP_H\n#define BLIP_H\n\n#include <cstdint>...
python
chosen
[ { "from": "system", "value": "Use longer sleep time for workflow launcher.\n" }, { "from": "human", "value": "import sys\nimport os\nimport uuid\nfrom time import sleep\n\nif len(sys.argv) != 3:\n print \"Wrong number of args\"\n exit(1)\n \nworkflow_name = sys.argv[1]\nnum_runs = int(s...
python
chosen
[ { "from": "system", "value": "[telemetry] Disable power and smoke unit tests on Mac 10.9.\n\npowermetrics is failing on the bots.\n\nBUG=423688\nTEST=trybots\nR=tonyg\n\nReview URL: https://codereview.chromium.org/746793002\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#305147}\n" }, ...
python
chosen
[ { "from": "system", "value": "Prepare for new Nordea header\n\nIn June, Nordea will switch to a new web-interface.\nThis new interface also has a new csv-export format.\nThis commit adapts Nordea to the new format, while the previous\nheader is called \"Nordea (gamal)\".\nI might remove the previous heade...
python
chosen
[ { "from": "system", "value": "utils: Switch to IkaMatcher2 (Numpy_8bit_fast); 10% faster in overall performance\n\nSigned-off-by: Takeshi HASEGAWA <80595b5c49522665976d35e515d02ac963124d00@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# IkaLog...
python
chosen
[ { "from": "system", "value": "Add allowed_system as a class variable\n" }, { "from": "human", "value": "import platform\n\n\nclass OSXDodger(object):\n allowed_version = \"10.12.1\"\n\n def __init__(self, applications_dir):\n self.app_dir = applications_dir\n\n def load_applicati...
python
chosen
[ { "from": "system", "value": "[FIX] Make RecordingManager work with new plugin system\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##\n## $Id: __init__.py,v 1.10 2009/04/09 13:13:18 dmartinc Exp $\n##\n## This file is part of CDS Indico.\n## Copyright (C) 2002, 2003, 2004, 2005, 2...
python
chosen
[ { "from": "system", "value": "trivial: Use __version__ to fix new versions of python-markdown\n" }, { "from": "human", "value": "#!/usr/bin/python3\n# SPDX-License-Identifier: LGPL-2.1+\n\nimport sys\nimport markdown\n\nfrom packaging.version import Version\n\n# https://github.com/fwupd/fwupd/pu...
python
chosen
[ { "from": "system", "value": "PRJ: Increase version 3.0.0 -> 3.1.1\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages # This setup relies on setuptools since distutils is insufficient and badly hacked code\n\nversion = '3.0.0'\nauthor = 'David-...
python
chosen
[ { "from": "system", "value": "Update classifiers with python3.6 version support and update version\n" }, { "from": "human", "value": "import os\nimport codecs\nfrom setuptools import setup\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read(*parts):\n # intentionally *not* addi...
python
chosen
[ { "from": "system", "value": "Allow tests to be run with pytest-runner.\n" }, { "from": "human", "value": "#!/usr/bin/python\nfrom setuptools import setup\n\nsetup(\n name='sseclient',\n version='0.0.7',\n author='Brent Tubbs',\n author_email='brent.tubbs@gmail.com',\n py_modules=...
python
chosen
[ { "from": "system", "value": "Remove size keyword when generating netlist\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(name='lcapy',\n version='0.21.5',\n description='Symbolic linear circuit analysis',\n author='Michael Hay...
python
chosen
[ { "from": "system", "value": "Change version name to 1.0.4.1\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom distutils.core import setup\n\nsetup(\n name='AMFM_decompy',\n version='1.0.4',\n author='Bernardo J.B. Schmitt',\n author_email='bernardo.jb.schmitt@gmail....
python
chosen
[ { "from": "system", "value": "Remove [] from around open()...split('\\n')\n\n`split()` already returns a list so you don't need to wrap it in another list." }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\n\nfrom setuptools import setup\nimport versioneer\n\nhere = os.path.abspa...
python
chosen
[ { "from": "system", "value": "Rename distributable name to avoid conflicts with releases from the\nparent project\n\nSince this is a fork we need to diferentiate between our project and\nparent project releases. If we rely only on the version we won't be able\nto avoid conflicts with oficial releases on pyp...
python
chosen
[ { "from": "system", "value": "Upgrade tangled 0.1a9 => 1.0a11\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='tangled.mako',\n version='1.0a4.dev0',\n description='Tangled Mako integration',\n long_description=open('README.rst').read(),\n url='h...
python
chosen