conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add a run method for the entry point\n" }, { "from": "human", "value": "import sys\nfrom labonneboite.importer import util as import_util\nfrom labonneboite.importer import settings\n\nif __name__ == \"__main__\":\n filename = import_util.detect_runnable_file(\"e...
python
chosen
[ { "from": "system", "value": "Make YAML handler safe by default\n\nFixes #43" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\"\"\"\n kaptan.handlers.yaml_handler\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: (c) 2013 by the authors and contributors (See AUTHORS file).\n :l...
python
chosen
[ { "from": "system", "value": "Add completed list assignments koan.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n# Based on AboutArrayAssignments in the Ruby Koans\n#\n\nfrom runner.koan import *\n\nclass AboutListAssignments(Koan):\n def test_non_par...
python
chosen
[ { "from": "system", "value": "Increment version number to 2.0.0-alpha.4\n" }, { "from": "human", "value": "\"\"\"Module for Django system configuration.\"\"\"\n\n__version__ = \"2.0.0-alpha.3\"\n__version_english__ = \"2.0 Alpha 3\"\n" }, { "from": "gpt", "value": "\"\"\"Module for D...
python
chosen
[ { "from": "system", "value": "Fix bug in problem caused by flag file having new lines\n" }, { "from": "human", "value": "#!/usr/bin/python2\nfrom Crypto.Cipher import AES\nimport os, sys\n\nflag = open(\"flag\", \"r\").read()\nkey = open(\"key\", \"r\").read().strip()\n\nwelcome = \"\"\"\n{{welc...
python
chosen
[ { "from": "system", "value": "Add ld alias for the link subcommand.\n" }, { "from": "human", "value": "\"\"\" Main entry point \"\"\"\n\n# from ppci.cli import main\n\n\nimport sys\nimport importlib\n\n\nvalid_programs = [\n \"archive\",\n \"asm\",\n \"build\",\n \"c3c\",\n \"cc\"...
python
chosen
[ { "from": "system", "value": "Read file as text not binary\n\nReads the working PHIL file, but reading this as binary breaks the phil\nparsing as the data are a byte array on Python 3 - open as text seems to\nfix this - fixes #483\n" }, { "from": "human", "value": "import os\nimport sys\n\nimpor...
python
chosen
[ { "from": "system", "value": "Implement core counting of OS X\n" }, { "from": "human", "value": "def get_core_count():\n \"\"\"\n Count the number of cores in the system.\n\n Returns a tuple (physical, logical) with counts of physical and logical\n cores.\n \"\"\"\n pass\n\n\nd...
python
chosen
[ { "from": "system", "value": "Increase lib version to make all projects compatible\n\nPlease, publish this version on pypi\n" }, { "from": "human", "value": "\"\"\"The ofx parser package. A package to parse OpenFlow messages.\n\nThis package is a library that parses and creates OpenFlow Messages...
python
chosen
[ { "from": "system", "value": "Correct 'message status' nav label" }, { "from": "human", "value": "def features_nav():\n return [\n {\n \"name\": \"Features\",\n \"link\": \"main.features\",\n },\n {\n \"name\": \"Emails\",\n \"l...
python
chosen
[ { "from": "system", "value": "Add plt to rio_insp locals.\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', 'mea...
python
chosen
[ { "from": "system", "value": "Check for async_lru when importing asynchronous subpackage\n\n" }, { "from": "human", "value": "# Tweepy\n# Copyright 2009-2022 Joshua Roesslein\n# See LICENSE for details.\n\n\"\"\"\nTweepy.asynchronoous\n\nAsynchronous interfaces with the Twitter API\n\"\"\"\n\ntr...
python
chosen
[ { "from": "system", "value": "Adjust unittesting config for CI\n" }, { "from": "human", "value": "from os.path import abspath, dirname, join\nimport json\n\n\nif __name__ == '__main__':\n file = abspath(join(dirname(__file__), '..', 'unittesting.json'))\n with open(file, 'w') as fp:\n ...
python
chosen
[ { "from": "system", "value": "Allow data=None, even though the spec doesn't allow it\n" }, { "from": "human", "value": "import pymongo\nimport bson\n\nfrom datastore import DataStore\n\nclass MongoDBDataStore(pymongo.Connection, DataStore):\n def _store(self, uid, content, data):\n \"\...
python
chosen
[ { "from": "system", "value": "Test `sentry init` for directory branch\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom sentry.testutils import CliTestCase\nfrom sentry.runner.commands.init import init\n\n\nclass InitTest(CliT...
python
chosen
[ { "from": "system", "value": "Remove unused code + follow only specific user status\n" }, { "from": "human", "value": "\nimport time\nimport os\nfrom tweepy import API\nfrom tweepy import Stream\nfrom tweepy import OAuthHandler\nfrom tweepy.streaming import StreamListener\nfrom credentials impor...
python
chosen
[ { "from": "system", "value": "Add missing cap and join style imports\n" }, { "from": "human", "value": "\"\"\"Geometry classes and factories\n\"\"\"\n\nfrom geo import box, shape, asShape, mapping\nfrom point import Point, asPoint\nfrom linestring import LineString, asLineString\nfrom polygon im...
python
chosen
[ { "from": "system", "value": "Add test for adding report\n" }, { "from": "human", "value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n\"\"\"\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Replace assertEqual(None, *) with assertIsNone\n\nReplace assertEqual(None, *) with assertIsNone in tests\n\nChange-Id: I257c479b7a23e39178d292c347d04ad979c48f0f\nCloses-bug: #1280522\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Licensed under the...
python
chosen
[ { "from": "system", "value": "partner_industry_Secondary: Make api constrains multi to avoid error when create a company with 2 contacts\n" }, { "from": "human", "value": "# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta\n# Copyright 2016 Tecnativa S.L. - Vicent Cubells\n# Copyright 2018...
python
chosen
[ { "from": "system", "value": "Add bold and italic helpers\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nfrom reportlab.platypus import (\n Paragraph as BaseParagraph,\n Image as BaseImage,\n Spacer,\n)\nfro...
python
chosen
[ { "from": "system", "value": "Move the APIKey bits out to the init\n" }, { "from": "human", "value": "from pupa.scrape import Legislator\nfrom .base import OpenstatesBaseScraper\n\n\nclass OpenstatesPersonScraper(OpenstatesBaseScraper):\n def scrape_legislator(self, legislator_id):\n o...
python
chosen
[ { "from": "system", "value": "Revert last change (breaks XSPT)" }, { "from": "human", "value": "class RepeatTracker(object):\n def __init__(self):\n self.repeater_map = {}\n\n def __setitem__(self, key, value):\n try:\n self.repeater_map[key].index = value\n except KeyError, e:\n...
python
chosen
[ { "from": "system", "value": "Remove children of a suspended project from internet.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\r\n##############################################################################\r\n#\r\n# Copyright (C) 2014-2015 Compassion CH (http://www.compas...
python
chosen
[ { "from": "system", "value": "Make sure we're sorting results\n" }, { "from": "human", "value": "import os\nimport unittest\n\nfrom carbonate.list import listMetrics\n\n\nclass ListTest(unittest.TestCase):\n\n metrics_tree = [\"foo\",\n \"foo/sprockets.wsp\",\n ...
python
chosen
[ { "from": "system", "value": "Expand path for other folder structures.\n" }, { "from": "human", "value": "#MenuTitle: Run preglyphs\n# -*- coding: utf-8 -*-\n__doc__=\"\"\"\nRuns preglyphs from your chosen project folder then open the generated file\n\"\"\"\n\n__copyright__ = 'Copyright (c) 2019...
python
chosen
[ { "from": "system", "value": "Remove `error_stream`; Add `on_stderr` to make it works\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Ben Edwards\n# Copyright (c) 2015 Ben Edwards\n#\n# License: MIT\n#\...
python
chosen
[ { "from": "system", "value": "Add handling for failed setup\n" }, { "from": "human", "value": "class TestResult(object):\n def __init__(self):\n self.runCount = 0\n self.errorCount = 0\n\n def summary(self):\n return \"{} run, {} failed\".format(self.runCount, self.err...
python
chosen
[ { "from": "system", "value": "Fix white space in python example.\n" }, { "from": "human", "value": "#using the pymssql driver\nimport pymssql\n\n#Connect to your database. \n#Replace server name, username, password, and database name with your credentials \nconn = pymssql.connect(server='yourser...
python
chosen
[ { "from": "system", "value": "Make workspace symbols interactive in denite\n\nSome servers limit the amount of symbols they return.\nHaving an interactive implementation allows us to use the server instead\nof the client which means we allways get the best results of the query.\n" }, { "from": "huma...
python
chosen
[ { "from": "system", "value": "[ADD] Add checks on init file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n##############################################################################\n#\n# Authors: Adrien Peiffer\n# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)\...
python
chosen
[ { "from": "system", "value": "Update unit test for changes to topf\n" }, { "from": "human", "value": "\"\"\"Test functions for util.mrbump_util\"\"\"\n\nimport cPickle\nimport os\nimport unittest\n\nfrom ample.constants import AMPLE_PKL, SHARE_DIR\nfrom ample.util import mrbump_util\n\nclass Tes...
python
chosen
[ { "from": "system", "value": "DOC: Document the reason msvc requires SSE2 on 32 bit platforms.\n" }, { "from": "human", "value": "import os\nimport distutils.msvccompiler\nfrom distutils.msvccompiler import *\n\nfrom .system_info import platform_bits\n\n\nclass MSVCCompiler(distutils.msvccompile...
python
chosen
[ { "from": "system", "value": "Remove line that sets content type text/plain\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nimport csv\nfrom io import BytesIO\n\nfrom aspen import renderers\n\n\nclass Renderer(renderers.Ren...
python
chosen
[ { "from": "system", "value": "Add summary to html parser\n" }, { "from": "human", "value": "#\n# Konstrukteur - Static website generator\n# Copyright 2013 Sebastian Fastner\n#\n\n__all__ = [\"parse\"]\n\nfrom jasy.env.State import session\nfrom jasy.core import Console\nfrom bs4 import Beautiful...
python
chosen
[ { "from": "system", "value": "Add some info in the fab tasks\n" }, { "from": "human", "value": "from fabric.api import *\n\n\ndef update():\n require('code_root')\n\n git_pull()\n\n restart_web_server()\n\n\ndef git_pull():\n run('cd %s; git stash; git pull' % (env.code_root))\n\n\nd...
python
chosen
[ { "from": "system", "value": "Fix try-except-finally statement for python 2.4 support\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport logging\nimport threading\nimport traceback\n\n\nclass Handler(object):\n \"\"\"\n Handlers process metrics that are collected by Collectors.\n ...
python
chosen
[ { "from": "system", "value": "Add unit tests for transfer/secret_registry\n" }, { "from": "human", "value": "import pytest\nfrom eth_utils import decode_hex\n\nfrom raiden.constants import EMPTY_HASH, EMPTY_MERKLE_ROOT\nfrom raiden.transfer.utils import hash_balance_data\n\n\n@pytest.mark.parame...
python
chosen
[ { "from": "system", "value": "Enable environment variables for settings\n" }, { "from": "human", "value": "host = 'http://mech-ai.appspot.com'\n\ntry:\n from local_config import * # Override with config-local if exists\nexcept ImportError:\n pass\n\n" }, { "from": "gpt", "valu...
python
chosen
[ { "from": "system", "value": "Use absolute import for python3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\ncli.py\n===\nUser-facing command-line functions for :module:`fto`.\n\"\"\"\nimport string\n\nfrom .fto import print_exercise, MassUnit\n\n\ndef process_input(units='l...
python
chosen
[ { "from": "system", "value": "Add streak to list_display, remove created and updated from list_editable.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom .models import Ticket\n\n\nclass TicketAdmin(admin.ModelAdmin):\n list_display = ['name...
python
chosen
[ { "from": "system", "value": "Add heading to export mail\n" }, { "from": "human", "value": "import sendgrid\nimport config as config\nfrom sendgrid.helpers.mail import Mail, Content\n\nsg = sendgrid.SendGridAPIClient(apikey=config.SENDGRID_API_KEY)\nfrom_mail = sendgrid.Email(config.SENDGRID_FR...
python
chosen
[ { "from": "system", "value": "Add bridge between Entry and User(which will be created on the next commit)\n" }, { "from": "human", "value": "import datetime\nimport psycopg2\nfrom sqlalchemy import (\n Column,\n DateTime,\n Integer,\n Unicode,\n UnicodeText,\n )\nfrom pyramid.s...
python
chosen
[ { "from": "system", "value": "Remove wrong reference to quantum\n\nChange-Id: Ic3d8b26e061e85c1d128a79b115fd2da4412e705\nSigned-off-by: Rosario Di Somma <73b2fe5f91895aea2b4d0e8942a5edf9f18fa897@dreamhost.com>\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy ...
python
chosen
[ { "from": "system", "value": "Remove old way of sorting\n\nThis is redundant since the model layer has built-in sorting.\n\nIt’s also not a good separation of concerns for something presentational\n(sort order) to be in the API client layer.\n" }, { "from": "human", "value": "from app.notify_cli...
python
chosen
[ { "from": "system", "value": "Add call to show at pynotify\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport urllib2\nimport ssl\n\n# Define the sites we want to poll and the timeout.\nSITES = (\n 'https://redmine.codegrove.org',\n 'http://koodilehto.fi',\n 'http://vakiop...
python
chosen
[ { "from": "system", "value": "Fix whitespace in file_glob and attempt coverage modification\n" }, { "from": "human", "value": "import glob\nimport shutil\nimport os\n\nif os.name == \"nt\": # pragma: no branch\n from .ntcommonpath import commonpath\nelse:\n from .posixcommonpath import com...
python
chosen
[ { "from": "system", "value": "Add normalization and stemming, use fine grained selection of words.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport nltk\n\nfrom hazm import word_tokenize\nfrom hazm.HamshahriReader import HamshahriReader\n\nimport config\n\n\ndef doc_features(do...
python
chosen
[ { "from": "system", "value": "Add to static_html decorator code\n" }, { "from": "human", "value": "__author__ = 'mkaplenko'\n\n\nviews = []\n\n\ndef to_static_html(func):\n def wrapper(*args, **kwargs):\n if func not in views:\n views.append(func)\n print views\n ...
python
chosen
[ { "from": "system", "value": "Use distinct() when getting section items\n" }, { "from": "human", "value": "from django.db.models import Q\n\nfrom .utils import get_section_relations, get_item_model_class\n\n\nclass ItemFilter(object):\n manager_attr = 'objects'\n\n def get_manager(self, mo...
python
chosen
[ { "from": "system", "value": "Set default encoding to utf-8\n" }, { "from": "human", "value": "import os\nfrom utils import Reader\nimport code\n\nif __name__ == '__main__':\n working_directory = os.getcwd()\n files = Reader.read_directory(working_directory)\n print '{} available data f...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.4.3" }, { "from": "human", "value": "from setuptools import setup\n\nname = \"Bitmessage\"\nversion = \"0.4.2\"\nmainscript = [\"bitmessagemain.py\"]\n\nsetup(\n\tname = name,\n\tversion = version,\n\tapp = mainscript,\n\tsetup_requires...
python
chosen
[ { "from": "system", "value": "Fix redis prefix for existing sessions\n" }, { "from": "human", "value": "from django.conf import settings\n\n\nSESSION_REDIS_HOST = getattr(settings, 'SESSION_REDIS_HOST', 'localhost')\nSESSION_REDIS_PORT = getattr(settings, 'SESSION_REDIS_PORT', 6379)\nSESSION_RED...
python
chosen
[ { "from": "system", "value": "Revert \"This should break the flakes8 check on Travis\"\n\nThis reverts commit 91c3d6c30d75ce66228d52c74bf8a4d8e7628670.\n" }, { "from": "human", "value": "import random, datetime\n\nfrom hamper.interfaces import ChatCommandPlugin, Command\n\n\nclass Roulette(ChatC...
python
chosen
[ { "from": "system", "value": "Fix error in ouputting system\n" }, { "from": "human", "value": "import yaml\n\nclass data:\n def __init__(self, name=None):\n if name:\n self.name = name\n\n def output(self, data, name=None):\n if name:\n self.name = name\...
python
chosen
[ { "from": "system", "value": "Fix assignment issue in coallatz\n" }, { "from": "human", "value": "'''\nModule for running arbitrairy tests\n'''\n\nimport time\n\ndef echo(text):\n '''\n Return a string - used for testing the connection\n\n CLI Example:\n salt '*' test.echo 'foo bar b...
python
chosen
[ { "from": "system", "value": "Add function to save tpcc-mysql results" }, { "from": "human", "value": "#!/usr/bin/env python\n#-*- coding: utf-8 -*-\n'''\nCreated on 2015-06-19\n\n@author: mizhon\n'''\n#from common import CommonActions\nfrom Logs import logger\nlog = logger.Log()\n\nclass Tpccmy...
python
chosen
[ { "from": "system", "value": "Add a clip to the frameless example\n" }, { "from": "human", "value": "\"\"\"\n===============================\nPlotting a Map without any Axes\n===============================\n\nThis examples shows you how to plot a Map without any annotations at all, i.e.\nto sav...
python
chosen
[ { "from": "system", "value": "Add config ini file name.\n\n" }, { "from": "human", "value": "import os\n\n_CURRENTPATH = os.path.dirname(os.path.realpath(__file__))\n\npreferencesIconPath = os.path.join(_CURRENTPATH, 'static', 'gear.svg')\npreferencesUIPath = os.path.join(_CURRENTPATH, 'ui', 'pr...
python
chosen
[ { "from": "system", "value": "Fix a stupid typo in the Google Closure Compiler processor that prevented it from working properly.\n" }, { "from": "human", "value": "__author__ = \"Wim Leers (work@wimleers.com)\"\n__version__ = \"$Rev$\"\n__date__ = \"$Date$\"\n__license__ = \"GPL\"\n\n\nfrom pro...
python
chosen
[ { "from": "system", "value": "Add the option to enable debug mode with Heroku\n\nDon't do this public servers, use it locally with foreman." }, { "from": "human", "value": "#!/usr/bin/env python\nfrom evesrp import create_app\nfrom evesrp.killmail import CRESTMail, ShipURLMixin\nimport evesrp.au...
python
chosen
[ { "from": "system", "value": "Fix issue with smoothscroll pattern\n" }, { "from": "human", "value": "\"\"\"\nSmooth scroll pattern\n\"\"\"\n\nfrom .pattern import Pattern\nimport time\nimport math\n\n# fast linear sin approx\ndef fastApprox(val):\n return 1.0 - math.fabs( math.fmod(val, 2.0) ...
python
chosen
[ { "from": "system", "value": "Add switch (-d or --debug) for debug mode\n" }, { "from": "human", "value": "from flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route('/retrieve', methods=['POST'])\ndef get():\n public_key = request.form['PUBLIC_KEY']\n enc_index = request.for...
python
chosen
[ { "from": "system", "value": "Refactor Command action to dragonglue.command\n" }, { "from": "human", "value": "from dragonfly import (Grammar, MappingRule, Choice, Text, Key, Function)\nfrom dragonglue.command import send_command\n\ngrammar = Grammar(\"launch\")\n\n\napplications = {\n\t'sublime...
python
chosen
[ { "from": "system", "value": "[NG] Read Heroku port envvar and use if given.\n" }, { "from": "human", "value": "\"\"\"\nWSGI script run on Heroku using gunicorn.\nExposes the app and configures it to use Heroku environment vars.\n\"\"\"\nfrom suddendev import create_app, socketio\n\n\napp = crea...
python
chosen
[ { "from": "system", "value": "Improve detecting available test modules in test package\n\nBy using glob and path.splitext instead of manually iterating over files\nin the directory and filtering out files based on their names.\n" }, { "from": "human", "value": "\"\"\"\n distutilazy.tests\n ...
python
chosen
[ { "from": "system", "value": "Change error message for missing pillow libs.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2014, 2015 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance ...
python
chosen
[ { "from": "system", "value": "Add tests to update Mailbox.last_polling\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom django_mailbox.models import Mailbox\n\n\n__all__ = ['TestMailbox']\n\n\nclass TestMailbox(TestCase):\n def test_protocol_info(self):\n mai...
python
chosen
[ { "from": "system", "value": "Update anagram index spec data source.\n" }, { "from": "human", "value": "from data import anagram_index, warehouse\nfrom spec.mamba import *\n\nwith description('anagram_index'):\n with before.all:\n self.subject = anagram_index.AnagramIndex(warehouse.get('/wor...
python
chosen
[ { "from": "system", "value": "Simplify the icon finder function.\n\nWe statically know our bundle identifier, so we don’t have too find the bundle by runtime class.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom Foundation import objc\nfrom Foundation i...
python
chosen
[ { "from": "system", "value": "Correct typo in test name\n" }, { "from": "human", "value": "import os\n\nimport numpy\nimport pytest\n\nimport helpers\nimport meshio\n\n\n@pytest.mark.parametrize(\n \"mesh\", [helpers.tri_mesh, helpers.quad_mesh, helpers.tri_quad_mesh]\n)\ndef test_ply(mesh):\...
python
chosen
[ { "from": "system", "value": "Add a timeout to the delta detector\n\nMake it so that the detector doesn't beep more than\nonce per second. It would be even better if the beeping\noccurred in another thread...\n" }, { "from": "human", "value": "import numpy as N\nimport gtk.gdk\n\nclass DeltaDete...
python
chosen
[ { "from": "system", "value": "Modify the home page URL mapper to be consistent with other mappers.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls.defaults import *\n\nfrom registration.views import register\n\nfrom pytask.profile.forms import CustomReg...
python
chosen
[ { "from": "system", "value": "Make DeferredHelper even more like a Deferred by subclassing\n" }, { "from": "human", "value": "import datetime\nimport mock\n\n\nfrom functools import wraps\nfrom twisted.internet.defer import Deferred\n\n\nclass NewDate(datetime.date):\n @classmethod\n def t...
python
chosen
[ { "from": "system", "value": "Add for_each to chain exports\n" }, { "from": "human", "value": "from microcosm_pubsub.chain.chain import Chain # noqa: F401\nfrom microcosm_pubsub.chain.decorators import binds, extracts # noqa: F401\nfrom microcosm_pubsub.chain.statements import extract, when, s...
python
chosen
[ { "from": "system", "value": "Fix formatting issue for \\G.\n\nCloses #49\n" }, { "from": "human", "value": "from .tabulate import _text_type\n\ndef pad(field, total, char=u\" \"):\n return field + (char * (total - len(field)))\n\ndef get_separator(num, header_len, data_len):\n total_len =...
python
chosen
[ { "from": "system", "value": "Fix the plugin mount text. And make it way more intelligent.\n" }, { "from": "human", "value": "from JsonStats.FetchStats.Plugins import *\n\nfrom . import TestCase\n\nimport JsonStats.FetchStats.Plugins\nfrom JsonStats.FetchStats import Fetcher\n\n\nclass TestPlugi...
python
chosen
[ { "from": "system", "value": "Add test for open file\n" }, { "from": "human", "value": "import os\n\nfrom cffitsio._cfitsio import ffi, lib\n\n\ndef test_create_file(tmpdir):\n filename = str(tmpdir.join('test.fits'))\n f = ffi.new('fitsfile **')\n status = ffi.new('int *')\n lib.fit...
python
chosen
[ { "from": "system", "value": "Add the GitHub issue number as a new line in the commitMessage field.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom AbstractVisitor import AbstractVisitor\n\nfrom duralex.alinea_parser import *\n\nfrom github import Github\n\nclass AddGitHubIssu...
python
chosen
[ { "from": "system", "value": "Set stories to inactive if a story with the same title has been published recently\n" }, { "from": "human", "value": "from newswall.models import Story\n\n\nclass ProviderBase(object):\n def __init__(self, source, config):\n self.source = source\n s...
python
chosen
[ { "from": "system", "value": "Use sentence faker for email subjects\n" }, { "from": "human", "value": "import factory\n\nfrom adhocracy4.follows import models as follow_models\nfrom adhocracy4.test import factories as a4_factories\nfrom meinberlin.apps.newsletters import models\nfrom tests impor...
python
chosen
[ { "from": "system", "value": "tests/negation: Test that negation is involutive\n" }, { "from": "human", "value": "from hypothesis import given\n\nfrom ppb_vector import Vector2\nfrom utils import vectors\n\n@given(vector=vectors())\ndef test_negation_scalar(vector: Vector2):\n assert - vector...
python
chosen
[ { "from": "system", "value": "8: Create documentation of DataSource Settings \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christoph....
python
chosen
[ { "from": "system", "value": "Edit to the regular expression pattern used to identify meta-mapped references.\n" }, { "from": "human", "value": "#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n''' Constant mapping appropriate quantipy types to pandas dtypes\r\n'...
python
chosen
[ { "from": "system", "value": "Add audience field to Document resource\n\n- 'audience' field is displayed on list of invoices (bookings/<booking_id>/invoices) and now, also on list of documents (bookings/<booking_id>/documents) to match what is being returned in the API " }, { "from": "human", "v...
python
chosen
[ { "from": "system", "value": "VC/Zoom: Use more specific PyJWT version pin\n" }, { "from": "human", "value": "# This file is part of the Indico plugins.\n# Copyright (C) 2020 CERN and ENEA\n#\n# The Indico plugins are free software; you can redistribute\n# them and/or modify them under the terms...
python
chosen
[ { "from": "system", "value": "Fix PermsError.suppress() doing the exact opposite...\n" }, { "from": "human", "value": "class PermsError:\n val = False\n\n @classmethod\n def suppress(cls):\n cls.val = True\n\n def __bool__(self):\n return self.val\n" }, { "from"...
python
chosen
[ { "from": "system", "value": "Add docs to the ConfigCache.\n" }, { "from": "human", "value": "import json\nimport threading\nimport uuid\n\nfrom thoonk.consts import *\n\n\nclass ConfigCache(object):\n def __init__(self, pubsub):\n self._feeds = {}\n self.pubsub = pubsub\n ...
python
chosen
[ { "from": "system", "value": "Work around an error if ttag is installed at the same time as Django\n" }, { "from": "human", "value": "from ttag.args import Arg, BasicArg, BooleanArg, ConstantArg, DateArg, \\\n DateTimeArg, IntegerArg, IsInstanceArg, KeywordsArg, ModelInstanceArg, \\\n Stri...
python
chosen
[ { "from": "system", "value": "Make sure the demo project is in the pythonpath\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\nfrom pathlib import Path\n\nif __name__ == \"__main__\":\n # We add ourselves into the python path, so we can find\n # the package ...
python
chosen
[ { "from": "system", "value": "Make annotation tests work with non-evaluated annotations (GH-4050)\n\nBackported from 3dc2b9dfc23638fbef2558d619709b5235d5df08\r\nPartial fix for https://github.com/cython/cython/issues/3919\r\n" }, { "from": "human", "value": "# mode: run\n# tag: generators, pure3...
python
chosen
[ { "from": "system", "value": "Change text field to charfields, since those are indexable in mysql\n" }, { "from": "human", "value": "from django.db import models\nfrom binder.models import BinderModel\n\n\nclass City(BinderModel):\n country = models.ForeignKey('Country', null=False, blank=Fal...
python
chosen
[ { "from": "system", "value": "Clean up controlled vocab tests\n" }, { "from": "human", "value": "import unittest\n\nfrom cybox.common.vocabs import VocabString\nimport cybox.test\nfrom cybox.utils import normalize_to_xml\n\n\nclass TestVocabString(unittest.TestCase):\n\n def test_plain(self):...
python
chosen
[ { "from": "system", "value": "Bump version number to 4.0 to reflect major improvements.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom setuptools import setup\nfrom distutils.extension import Extension\nfrom Pyrex.Distutils import build_ext\n\nsetup(\n name=\"PyMoira\",\n ver...
python
chosen
[ { "from": "system", "value": "Add python_requires to help pip\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\n\nlong_description = 'Please see our GitHub README'\nif os.path.exists('README.txt'):\n long_description = open('README.txt').read()\n\n\nbase_url = 'htt...
python
chosen
[ { "from": "system", "value": "Remove unused util ref and add a space after , for Travis\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Patrick Kish\n# Copyright (c) 2014 Patrick Kish\n#\n# License: MIT...
python
chosen
[ { "from": "system", "value": "Add License classifier for pypa" }, { "from": "human", "value": "import io\nfrom os import path\n\nfrom setuptools import setup\n\nthis_directory = path.abspath(path.dirname(__file__))\nwith io.open(path.join(this_directory, \"README.md\"), encoding=\"utf-8\") as f:...
python
chosen
[ { "from": "system", "value": "Change algorithmia-api-client dependency from a version to a version range\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\nsetup(\n name='algorithmia',\n version='1.1.4',\n description='Algorithmia Python Client',\n long_d...
python
chosen
[ { "from": "system", "value": "Upgrade to prompt_toolkit 0.57. (Should give much better performance.)\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\n\nlong_description = open(\n os.path.join(\n os.path.dirname(__file__...
python
chosen
[ { "from": "system", "value": "Update version number to 0.20, because 0.2 < 0.15\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom distutils.core import setup\n\nsetup(\n name='enocean',\n version='0.2',\n description='EnOcean serial protocol implementation',\n author='Ki...
python
chosen