conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Revert \"For travis, let us print the mode\"\n\nThis reverts commit 0c8e9c36219214cf08b33c0ff1812e6cefa53353.\n" }, { "from": "human", "value": "import base64\nimport betamax\nimport os\n\ncredentials = [os.environ.get('GH_USER', 'foo').encode(),\n os....
python
chosen
[ { "from": "system", "value": "Add shebang line to package init file.\n" }, { "from": "human", "value": "\"\"\"\nA set of classes used to dynamically wrap FAUST DSP programs in Python.\n\nThis package defines three types:\n- PythonUI is an implementation of the UIGlue C struct.\n- FAUSTDsp wraps ...
python
chosen
[ { "from": "system", "value": "Add more verbose error to reporte on Travis parserXML.py\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom xml.etree.ElementTree import ParseError\nimport xml.etree.ElementTree as ET\nimport ...
python
chosen
[ { "from": "system", "value": "Update Shape&Shape importer - shapes don't have named fields!\n" }, { "from": "human", "value": "\"\"\"\nImport COUNCIL\n\"\"\"\nimport sys\n\nfrom data_collection.management.commands import BaseShpShpImporter\n\nclass Command(BaseShpShpImporter):\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Increment version to 0.2.1 (unreleased) for all further changes.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nsetup(\n name='WsgiService',\n version='0.2',\n description=\"A lean WSGI framework for easy creation of REST se...
python
chosen
[ { "from": "system", "value": "Add 'all' option for extra packages, which will install all available rather than listing individually.\n" }, { "from": "human", "value": "import sys\nimport os\n\nfrom setuptools import setup\n\nlong_description = open('README.rst').read()\n\nclassifiers = [\n '...
python
chosen
[ { "from": "system", "value": "Add missed 'schedule' package to install_requires\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\n\nfrom setuptools import setup, find_packages\nfrom codecs import open\nfrom os import path\n\n\nhere = path.abspath(path.dirname(__file__))\n\nwith open(path....
python
chosen
[ { "from": "system", "value": "Change the console script name to the same name as the project.\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='planet_alignment',\n version='1.0.0',\n packages=['planet_alignment', 'planet_alignment.test'],\n url='h...
python
chosen
[ { "from": "system", "value": "Add some PyPI tags to package\n" }, { "from": "human", "value": "from setuptools import find_packages\nfrom setuptools import setup\n\n\nwith open('requirements.txt') as fobj:\n install_requires = [line.strip() for line in fobj]\n\n\nwith open('README.rst') as fo...
python
chosen
[ { "from": "system", "value": "Update long description of package.\n" }, { "from": "human", "value": "from os import path\n\nfrom setuptools import setup, find_packages\n\nhere = path.abspath(path.dirname(__file__))\n\n# with open(path.join(here, 'README.rst'), encoding='utf-8') as f:\n# long_...
python
chosen
[ { "from": "system", "value": "Use a saner requirements for python-dateutil\n\nThe requirement >=1.0, <2.0, >=2.1 doesn't make a lot of logical sense and it\r\nwill break in the future. There is no version that is >= 1.0, and < 2.0, and\r\n>= 2.1 becasue these versions are mutually exclusive. Even if you int...
python
chosen
[ { "from": "system", "value": "Remove support for python 2.x\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport codecs\nfrom setuptools import setup, find_packages\n\nfrom axes import get_version\n\nsetup(\n name='django-axes',\n version=get_version(),...
python
chosen
[ { "from": "system", "value": "Switch to local JS/CSS assets - bump version.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nsetup(\n name='wagtailcodeblock',\n version=\"0.2.2\",\n description='Wagtail Code Block provides PrismJS syntax highlighting in Wa...
python
chosen
[ { "from": "system", "value": "Fix long description in README\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\n\nfrom setuptools import setup, find_packages\n\nfrom oscar_support import get_version\n\n\ndef location(path):\n return os.path.join(os.path.dirname(__file__))\n\...
python
chosen
[ { "from": "system", "value": "Add line to make flake8 happy" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\nimport os\nimport re\n\n\ndef read(*parts):\n here = os.path.abspath(os.path.dirname(__file__))\n with open(os.path.join(here, *parts)) as f:\n ...
python
chosen
[ { "from": "system", "value": "Replace hardcoded packages by find_packages\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nfrom setuptools import setup\n\ndescription = \"\"\"\nSimple, powerfull and nonobstructive django email middleware.\n\"\"\"\n\nsetup(\n name=\"djmail\",\n ...
python
chosen
[ { "from": "system", "value": "Solve RuntimeWarning that arose without knowing why.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport sys, os\n\nsetup(name='cc.license',\n version='0.01',\n description=\"License selection based on ccREL-based metadat...
python
chosen
[ { "from": "system", "value": "Add missing comma in classifiers.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='jobcli',\n version='0.1.a1',\n py_modules=['jobcli'],\n install_requires=['click', 'requests',],\n entry_points={'console_scripts':['jo...
python
chosen
[ { "from": "system", "value": "Add PyPI classifiers for python versions\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom glob import glob\nfrom distutils.core import setup\n\n\nsetup(\n name='whisper',\n version='0.9.10',\n url='https://launchpad.net/graphite',\n au...
python
chosen
[ { "from": "system", "value": "Add Python specific Trove classifiers.\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\n\ncur_dir = os.path.dirname(__file__)\nreadme = os.path.join(cur_dir, 'README.md')\nif os.path.exists(readme)...
python
chosen
[ { "from": "system", "value": "Read package long description from readme\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='gears-coffeescript',\n version='0.1.dev',\n url='https://github.com/gears/gears',\n license='ISC',\n author='M...
python
chosen
[ { "from": "system", "value": "Update the PyPI version to 7.0.9.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n retu...
python
chosen
[ { "from": "system", "value": "Remove the dependency on pypandoc. It's unfortunate but we don't want to add dependency just for readability on pypi.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom distutils.core import setup\nimport pypandoc\n\nlong_descri...
python
chosen
[ { "from": "system", "value": "Remove an old version of the Filter() wrapper function\n" }, { "from": "human", "value": "from _botan import *\n\ninit = LibraryInitializer()\n\nclass SymmetricKey(OctetString):\n pass\n\nclass InitializationVector(OctetString):\n pass\n\ndef Filter(name, key ...
python
chosen
[ { "from": "system", "value": "Add classifiers to document Python version support\n" }, { "from": "human", "value": "\"\"\"\nFlask-Twilio\n-------------\n\nMake Twilio voice/SMS calls with Flask\n\"\"\"\nfrom setuptools import setup\nexec(open('flask_twilio.py').readline())\n\n\nsetup(\n name=...
python
chosen
[ { "from": "system", "value": "chore(pins): Update pins for dictionary to release tag\n\n- Update pins for dictionary to release tag\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='gdcdatamodel',\n packages=find_packages(),\n install_requi...
python
chosen
[ { "from": "system", "value": "Add chardet as a dependency\n" }, { "from": "human", "value": "from setuptools import setup\nimport os\n\nimport imbox\n\nversion = imbox.__version__\n\n\ndef read(filename):\n return open(os.path.join(os.path.dirname(__file__), filename)).read()\n\nsetup(\n n...
python
chosen
[ { "from": "system", "value": "Fix mising Plugin in class name\n" }, { "from": "human", "value": "from rtmbot.core import Plugin\n\n\nclass ShutupSlackbot(Plugin):\n def process_message(self, data):\n if data[\"text\"] in [\"Bpye Berg Nyberg\"]:\n self.outputs.append([data[\"...
python
chosen
[ { "from": "system", "value": "Remove unnecessary global variable assignment\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.conf.urls import url\n\nfrom eb_sqs.views import process_task\n\napp_name = 'eb_sqs'\nurlpatterns = [\n url(r'...
python
chosen
[ { "from": "system", "value": "Add dev option to version string\n" }, { "from": "human", "value": "\"\"\"\n\nCamoco Library - CoAnalysis of Molecular Components\n\nCacheMoneyCorn\n\n\"\"\"\n\n__license__ = \"\"\"\n Creative Commons Non-Commercial 4.0 Generic\n http://creativecommons.org/lic...
python
chosen
[ { "from": "system", "value": "Switch ftp server now ftp.kernel.org closed\n" }, { "from": "human", "value": "from wex.url import URL\n\nexpected_lines = [\n b\"FTP/1.0 200 OK\\r\\n\",\n b\"X-wex-url: ftp://anonymous:me@ftp.kernel.org/pub/site/README\\r\\n\",\n b\"\\r\\n\",\n b\"This ...
python
chosen
[ { "from": "system", "value": "Add an empty placeholder tests.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nTest for the tcv module\n\"\"\"\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nTest f...
python
chosen
[ { "from": "system", "value": "Remove test that crashes ArtNet receiver\n" }, { "from": "human", "value": "import collections, copy, queue\nfrom . import control\nfrom .. util import artnet_message, log, server_cache, udp\n\nQUEUE_TIMEOUT = 0.1\n\n\nclass ArtNet(control.ExtractedControl):\n de...
python
chosen
[ { "from": "system", "value": "Make GUI test more robust to HiDPI displays" }, { "from": "human", "value": "import pytest\nfrom distutils.version import LooseVersion\nimport matplotlib as mpl\n\n\nfrom ..gui import PVSlicer\n\nfrom .test_slicer import make_test_hdu\n\ntry:\n import PyQt5\n ...
python
chosen
[ { "from": "system", "value": "Add parent so we can track versions.\n" }, { "from": "human", "value": "from dataitem import DataItem\n\nclass DataFile(DataItem):\n def __init__(self, name, access, owner):\n super(DataFile, self).__init__(name, access, owner, \"datafile\")\n self....
python
chosen
[ { "from": "system", "value": "Use c.request_origin for frame origin.\n" }, { "from": "human", "value": "from pylons import c, g\n\nfrom r2.lib.pages import Ads as BaseAds\n\n\nclass Ads(BaseAds):\n def __init__(self):\n BaseAds.__init__(self)\n adzerk_test_srs = g.live_config.ge...
python
chosen
[ { "from": "system", "value": "Add a new line before displaying the current dir\n\nThis makes it easier for my brain to read.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nimport subprocess\nimport sys\n\ndef execute_command(target):\n os.chdir(t...
python
chosen
[ { "from": "system", "value": "Add file handler for debug logs\n" }, { "from": "human", "value": "'''Utility function for logging'''\nimport logging\nimport sys\n\n\ndef configure_logging(debug, silent=False):\n '''Sets the default logger and the boto logger to appropriate levels of chattiness...
python
chosen
[ { "from": "system", "value": "Document module with docstrings (Google format)\n" }, { "from": "human", "value": "from urllib.request import urlopen\n\n\ndef fetch_words():\n with urlopen('http://sixty-north.com/c/t.txt') as story:\n story_words = []\n for line in story:\n ...
python
chosen
[ { "from": "system", "value": "Fix the license header regex.\n\nMost of the files are attributed to Google Inc so I used this instead of\nChromium Authors.\n\nR=mark@chromium.org\nBUG=\nTEST=\n\nReview URL: http://codereview.chromium.org/7108074" }, { "from": "human", "value": "# Copyright (c) 20...
python
chosen
[ { "from": "system", "value": "Update for Docflow 0.3.2 and PermissionMixin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nimport docflow\nfrom werkzeug.exceptions import Forbidden\n\n__all__ = ['WorkflowStateException', 'WorkflowTransitionEx...
python
chosen
[ { "from": "system", "value": "Add route for admin panel\n" }, { "from": "human", "value": "from app import app\nfrom app.models import Post\nfrom flask import render_template\n\n\n@app.route('/')\n@app.route('/page/<int:page>')\ndef blog(page=1):\n \"\"\"View the blog.\"\"\"\n posts = Post...
python
chosen
[ { "from": "system", "value": "Use clone() method from BaseModel to copy most recent fileversion\n" }, { "from": "human", "value": "from osf.models.base import generate_object_id\n\n\ndef copy_files(src, target_node, parent=None, name=None):\n \"\"\"Copy the files from src to the target node\n...
python
chosen
[ { "from": "system", "value": "Update save Notification, save in nosql database\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport json\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom opps.core.models import Pub...
python
chosen
[ { "from": "system", "value": "Add colormap option to show().\n" }, { "from": "human", "value": "\nimport code\nimport collections\nimport logging\nimport sys\n\nimport numpy\n\nimport rasterio\n\n\nlogger = logging.getLogger('rasterio')\n\nStats = collections.namedtuple('Stats', ['min', 'max', '...
python
chosen
[ { "from": "system", "value": "Simplify and cleanup previous commit.\n" }, { "from": "human", "value": "from numba import autojit\nimport numpy as np\nprint np.zeros(10).dtype\n\n\n@autojit\ndef closure_modulo(a, b):\n c = np.zeros(10)\n @jit('f8[:]()')\n def foo():\n c[0] = a % b...
python
chosen
[ { "from": "system", "value": "Fix definition typo in patched module\n" }, { "from": "human", "value": "from .. import types, alltlobjects\nfrom ..custom.message import Message as _Message\n\nclass MessageEmpty(_Message, types.MessageEmpty):\n pass\n\ntypes.MessageEmpty = MessageEmpty\nalltlob...
python
chosen
[ { "from": "system", "value": "Fix tcdel for the deb package\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nimport sys\n\nfrom tcconfig.tcshow import main\n\n\nif __name__ == '__main...
python
chosen
[ { "from": "system", "value": "Remove unnecessary and broken DELETE check.\n" }, { "from": "human", "value": "from django import forms\n\nfrom go.router.view_definition import RouterViewDefinitionBase, EditRouterView\n\n\nclass KeywordForm(forms.Form):\n keyword = forms.CharField()\n target...
python
chosen
[ { "from": "system", "value": "Add utility function for checking URL safety\n" }, { "from": "human", "value": "def get_or_create(model, **kwargs):\n \"\"\" Returns an instance of model and whether or not it already existed in a tuple. \"\"\"\n instance = model.query.filter_by(**kwargs).firs...
python
chosen
[ { "from": "system", "value": "Use timezone library for dates\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Libraries\nfrom datetime import datetime\n\n# Django stuff\nfrom Instanssi.kompomaatti.misc.events import get_upcoming\nfrom Instanssi.screenshow.models import IRCMessage\...
python
chosen
[ { "from": "system", "value": "Add latitude and longitude in api\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import Conference, ConferenceVenue, Room\n\n\nclass ConferenceSerializer(serializers.HyperlinkedModelSerializer):\n status = serializers.Ch...
python
chosen
[ { "from": "system", "value": "Split SMS sending into multiple jobs (to get around Heroku timeout)\n" }, { "from": "human", "value": "from django_rq import job\n\nfrom .. import utils\n\n\n@job\ndef send_sms(to, body):\n utils.send_sms(to=to, body=body)\n" }, { "from": "gpt", "valu...
python
chosen
[ { "from": "system", "value": "Python: Fix typo in test case\n" }, { "from": "human", "value": "from django.db import connection, models\nfrom django.db.models.expressions import RawSQL\n\n\ndef test_plain():\n cursor = connection.cursor()\n cursor.execute(\"some sql\") # $getSql=\"some sq...
python
chosen
[ { "from": "system", "value": "Create a financial year to test with\n" }, { "from": "human", "value": "import json\n\nfrom django.test import (\n TransactionTestCase,\n Client,\n override_settings,\n)\n\nfrom . import (\n import_data,\n)\nfrom .resources import (\n GeographyResourc...
python
chosen
[ { "from": "system", "value": "Fix index for title without geo abr" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 1815829d365\nRevises: 3fcddd64a72\nCreate Date: 2016-02-09 17:58:47.362133\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '1815829d365'\ndown_...
python
chosen
[ { "from": "system", "value": "Remove unused bare desk URL\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom admin.desk import views\n\nurlpatterns = [\n url(r'^$', views.DeskCaseList.as_view(), name='cases'),\n url(r'^customer/(?P<user_id>[a-z0-9]+)/$', views.Desk...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.4.5\n\nPiperOrigin-RevId: 393155372\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complianc...
python
chosen
[ { "from": "system", "value": "Fix: Correct the name for specified pin\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.views.generic import TemplateView\n\nfrom tastypie.api import Api\n\nfrom .api import ImageResource, ThumbnailResource, PinResource, Use...
python
chosen
[ { "from": "system", "value": "Change to a better shebang\n" }, { "from": "human", "value": "#!venv/bin/python\nfrom app import telomere\ntelomere.run(host='0.0.0.0', debug=True)\n\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom app import telomere\ntelomere.run(host='0.0...
python
chosen
[ { "from": "system", "value": "Patch fixed for expense claim type\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport frappe\n\ndef execute():\n\tfrappe.reload_doc(\"hr\", \"doctype\", \"expense_claim_type\")\n\t\n\tfor expense_claim_type in frappe.get_all(\"Expense...
python
chosen
[ { "from": "system", "value": "[Discord] Handle bot missing permissions for app commands\n\n" }, { "from": "human", "value": "\nfrom discord import app_commands\nfrom discord.ext import commands\n\nimport logging\nimport sys\nimport traceback\n\nimport sentry_sdk\n\n\nclass CommandTree(app_comman...
python
chosen
[ { "from": "system", "value": "Add custom emoji for blackbelt\n" }, { "from": "human", "value": "from slacker import Slacker\nfrom blackbelt.config import config\n\nclass Slack(object):\n def __init__(self, token=None):\n if not token:\n token = config['slack']['access_token'...
python
chosen
[ { "from": "system", "value": "schema: Add missing release group fields\n" }, { "from": "human", "value": "# Copyright (c) 2014 Wieland Hoffmann\n# License: MIT, see LICENSE for details\nfrom mbdata import models\nfrom . import modelext\nfrom .searchentities import SearchEntity as E, SearchField ...
python
chosen
[ { "from": "system", "value": "Move some imports internal so importing services package is not so cluttered\n" }, { "from": "human", "value": "\"\"\"Common services code\"\"\"\n\n\nfrom datetime import datetime\nimport importlib\n\nAVAILABLE_SERVICES = ['habit_list', 'idonethis', 'nikeplus']\nSER...
python
chosen
[ { "from": "system", "value": "Set path names to be byte strings\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\n\ndef where():\n \"\"\"\n Return the installation location of BrewData\n \"\"\"\n f = os.path.split(__file__)[0]\n return os.path.abspath(f)\n\n...
python
chosen
[ { "from": "system", "value": "Add a function to read json config files\n" }, { "from": "human", "value": "from pic import Picture\nfrom path import Path\nimport argparse, json\nparser = argparse.ArgumentParser(\n description=\n \"Process the picture or the directory, given the json config ...
python
chosen
[ { "from": "system", "value": "Put in call to to UsersService to actually change password\n" }, { "from": "human", "value": "from flask_login import current_user\n\nfrom app.brain.user_management.change_password_result import ChangePasswordResult\nfrom app.brain.utilities import hash_password\n\n...
python
chosen
[ { "from": "system", "value": "Add report() method to Greens\n" }, { "from": "human", "value": "import numpy as np\n\nimport _pybinding\nfrom .results import LDOSpoint\n\n__all__ = ['Greens', 'make_kpm']\n\n\nclass Greens:\n def __init__(self, impl: _pybinding.Greens):\n self.impl = imp...
python
chosen
[ { "from": "system", "value": "Add function to make residuals plot\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"This module contains functions for making plots relevant to regressors.\"\"\"\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __futu...
python
chosen
[ { "from": "system", "value": "Fix missing word in sum up numbers problem\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n# Code Fights Sum Up Problem\n\nimport re\n\n\ndef sumUpNumbers(inputString):\n return sum([int(n) for n in re.findall(r'\\d+', inputString)])\n\n\ndef main():\...
python
chosen
[ { "from": "system", "value": "Use stanford search logic only if configured\n" }, { "from": "human", "value": "\"\"\"\nCustom override of SearchFilterGenerator to use course tiles for\ndiscovery search.\n\"\"\"\nfrom search.filter_generator import SearchFilterGenerator\n\nfrom branding_stanford.m...
python
chosen
[ { "from": "system", "value": "Add data setter and getter for Plot\n" }, { "from": "human", "value": "from PyOpenWorm import *\n\n\nclass Plot(DataObject):\n \"\"\"\n Object for storing plot data in PyOpenWorm.\n\n Must be instantiated with a 2D list of coordinates.\n \"\"\"\n\n de...
python
chosen
[ { "from": "system", "value": "Fix survey_scenario (use core v20 syntax)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom openfisca_senegal import CountryTaxBenefitSystem as SenegalTaxBenefitSystem\n\nfrom openfisca_survey_manager.scenarios import AbstractSurveyScenario\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Add default value on property\n" }, { "from": "human", "value": "from filter import FilterException\nfrom common import PluginType\nfrom yapsy.IPlugin import IPlugin\nimport logging\n\n\nclass DepthFilter(IPlugin):\n\n category = PluginType.FILTER\n id = \"dep...
python
chosen
[ { "from": "system", "value": "Use fixed value in the helper\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom ..layer import Layer\n\n\ndef color_category_layer(source, value, top=11, palette='bold', title='', othersLabel='Others'):\n return Layer(\n sou...
python
chosen
[ { "from": "system", "value": "Raise exception instead of returnning it\n" }, { "from": "human", "value": "import requests\nimport os\nimport shutil\n\nclient_id = '' # Imgur application Client ID, fill this in.\ndirectory_name = 'Imgur Albums\\\\' # Directory for the images to be stored\n\n\nd...
python
chosen
[ { "from": "system", "value": "Add on_receive and send methods.\n\non_receive method is called when a new data is got.\nsend method is used to send data to the client.\n" }, { "from": "human", "value": "import threading\nimport select\n\n\nclass Client(object):\n def __init__(self, sock, addre...
python
chosen
[ { "from": "system", "value": "Set delay to 0, because ETN is slow.\n" }, { "from": "human", "value": "# Screen size\nWIDTH = 320\nHEIGHT = 240\nSCREEN_SIZE = (WIDTH, HEIGHT)\n\n# Update delay in ms\nDELAY = 100\n\nALIVE_IMG_PATH=\"data/alive.png\"\nDEAD_IMG_PATH=\"data/dead.png\"\nCURSOR_DEAD_IM...
python
chosen
[ { "from": "system", "value": "Add copy url to clipboard setting\n" }, { "from": "human", "value": "import ftplib\r\nimport ntpath\r\nimport logging\r\nimport urllib.parse\r\nimport win32clipboard\r\n\r\nclass FileUploader:\r\n \r\n def __init__(self, config):\r\n self._host = confi...
python
chosen
[ { "from": "system", "value": "Read standard input instead of hard-coded strings.\n" }, { "from": "human", "value": "from telnetlib import Telnet\nimport time\ntn = Telnet('192.168.1.15', 13666, None)\n\n#tn.interact()\n\ntn.write(\"hello\\n\")\ntn.write(\"screen_add s1\\n\")\ntn.write(\"screen_s...
python
chosen
[ { "from": "system", "value": "Fix encoding (thanks to Yasushi Masuda)\n\n" }, { "from": "human", "value": "#$HeadURL$\r\n#$LastChangedDate$\r\n#$LastChangedRevision$\r\nimport sys\r\nfrom reportlab.platypus import PageBreak, Spacer\r\nfrom flowables import *\r\nimport shlex\r\nfrom log import lo...
python
chosen
[ { "from": "system", "value": "Add tests for data pre-processing in fetch_directions\n" }, { "from": "human", "value": "from pydirections.director import Director\nfrom unittest import TestCase\n\nclass TestModeValidity(TestCase):\n\tdef test_invalid_mode(self):\n\t\t\"\"\"\n\t\t Tests the is_...
python
chosen
[ { "from": "system", "value": "Fix download command in error message\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nMISSING_CORPUS_MESSAGE = \"\"\"\nLooks like you are missing some required data for this feature.\n\nTo download the necessary data, simply run\n\n curl https://raw...
python
chosen
[ { "from": "system", "value": "Send first_name and last_name in JSON.\n" }, { "from": "human", "value": "\nfrom rest_framework import serializers\nfrom roledb.models import User\n\n\nclass UserSerializer(serializers.ModelSerializer):\n roles = serializers.SerializerMethodField('role_data')\n at...
python
chosen
[ { "from": "system", "value": "Handle Nonetype values in `html_to_md`\n" }, { "from": "human", "value": "import re\nimport textwrap\n\nimport html2text\n\ntext_maker = html2text.HTML2Text()\ntext_maker.body_width = 0\n\n\ndef strip_html_tags(text):\n return re.sub('<[^<]+?>', '', text)\n\n\nde...
python
chosen
[ { "from": "system", "value": "DMCloud: Add Support For RTMP Streams\n" }, { "from": "human", "value": "from livestreamer.exceptions import NoStreamsError\nfrom livestreamer.plugin import Plugin\nfrom livestreamer.stream import HLSStream\nfrom livestreamer.utils import urlget, parse_json\n\nimpor...
python
chosen
[ { "from": "system", "value": "Disable youtube searcher as key has been revoked. " }, { "from": "human", "value": "from search.searchers.instagram import MediaSearchInstagram\nfrom search.searchers.vkontakte import MediaSearchVK\nfrom search.searchers.youtube import MediaSearchYouTube\nfrom searc...
python
chosen
[ { "from": "system", "value": "Revert \"Review ex11 and ex12\"\n\nThis reverts commit e5fe21acd40e9ebeae548e906747702783058d06.\n" }, { "from": "human", "value": "# Upper is ex11, lower part is ex 12\n# Both print out are same, but ex11 needs 8 lines,\n# ex 12 just need it for 4 lines.\n\n\nprint...
python
chosen
[ { "from": "system", "value": "Add a runtime version of if.\n\nelif/else can't have runtime versions 'cause they are purely syntactic.\n" }, { "from": "human", "value": "import builtins\nimport operator\nimport functools\n\nfrom ..compile import varary\n\n\nbuiltins.__dict__.update({\n # Runti...
python
chosen
[ { "from": "human", "value": "Add API wrapper to saltapi\n" }, { "from": "gpt", "value": "'''\nMake api awesomeness\n'''\n\n# Import python libs\n#\n# Import Salt libs\nimport salt.utils\nimport salt.client\nimport salt.runner\n\nclass API(object):\n '''\n '''\n def __init__(self, opts):...
python
chosen
[ { "from": "system", "value": "Make the update-inputs command an option\n" }, { "from": "human", "value": "import sys\n\nfrom twisted.python import usage\n\nfrom ooni.resources import __version__\nfrom ooni.resources import update\n\n\nclass Options(usage.Options):\n synopsis = \"\"\"%s\"\"\"\...
python
chosen
[ { "from": "system", "value": "Correct path to parent dir\n" }, { "from": "human", "value": "# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in configuration values, see the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html...
python
chosen
[ { "from": "system", "value": "Stop using patterns() in the test URLs.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.views.generic import TemplateView\n\n\nurlpatterns = patterns(\n '',\n url(r'^$',\n TemplateView.as_view(\n tem...
python
chosen
[ { "from": "system", "value": "Add explicit anonymous user update parameter to user profile command\n\nThe set_user_profiles_to_default management command should only update\nthe anonymous user if explicitely stated. This commit adds the\n'--update-anon-user' switch to do let the user state that also the\nan...
python
chosen
[ { "from": "system", "value": "Remove obsolete TODO and add version\n" }, { "from": "human", "value": "\"\"\"\n'Dusk' command system for Amethyst.\nBased loosely (heh) off of discord.py's ext command system.\n\nTODO: refactor arg parsing probably.\n\"\"\"\n\nfrom .context import Context # NOQA\n...
python
chosen
[ { "from": "system", "value": "tests/basics: Add test for dict.fromkeys where arg is a generator.\n\nImproves coverage because it tests the case where the arg does not have a\n__len__ slot.\n" }, { "from": "human", "value": "d = dict.fromkeys([1, 2, 3, 4])\nl = list(d.keys())\nl.sort()\nprint(l)\...
python
chosen
[ { "from": "system", "value": "Buildbot: Make the acceptance tests dependent on the unit tests passing\n" }, { "from": "human", "value": "\"\"\"\nThis module contains the logic which returns the set of\nschedulers to use for the build master.\n\"\"\"\n\nfrom buildbot.changes.filter import ChangeF...
python
chosen
[ { "from": "system", "value": "Add reference to md5 method." }, { "from": "human", "value": "import hashlib\nimport os\n\ndef get_hash(path):\n\treturn get_md5(path)\n\ndef get_md5(path):\n\thash_md5 = hashlib.md5()\n\tif os.path.isfile(path):\n\t\twith open(path, \"rb\") as file:\n\t\t\twhile Tr...
python
chosen
[ { "from": "system", "value": "Add Piece() to serve as the parent class for all chess pieces\n" }, { "from": "human", "value": "# Use x, y coords for unit positions\n# (97, 56) ... (104, 56)\n# ... ...\n# (97, 49) ... (104, 49)\n#\n# Algebraic notation for a position is:\n# algebraic_...
python
chosen