Skip to main content

IO buffer multiplexer

Project description

iomux

checks tests codecov

IO buffer multiplexer.

import sys

from contextlib import redirect_stdout, redirect_stderr

import iomux


capture = iomux.StringMux()

with redirect_stdout(capture.out), redirect_stderr(capture.err):
    print('aaa')
    print('bbb', file=sys.stderr)
    print('aaa')
    print('bbb', file=sys.stderr)

assert capture.getvalue() == 'aaa\nbbb\naaa\nbbb\n'
assert capture.getvalue('out') == 'aaa\naaa\n'
assert capture.getvalue('err') == 'bbb\nbbb\n'
assert list(capture.values()) == [
    ('out', 'aaa\n'),
    ('err', 'bbb\n'),
    ('out', 'aaa\n'),
    ('err', 'bbb\n'),
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iomux-0.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

iomux-0.2.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file iomux-0.2.0.tar.gz.

File metadata

  • Download URL: iomux-0.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for iomux-0.2.0.tar.gz
Algorithm Hash digest
SHA256 44b083465a050910688448811f4be2d766628f551ab32380627674e30bc61385
MD5 9833ebbc075d931396cab6f609f4f1bc
BLAKE2b-256 bbc3a1ebfde0267083c6bf5109b87b25a8404a58299077b28a3732c61682ac38

See more details on using hashes here.

Provenance

File details

Details for the file iomux-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: iomux-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for iomux-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d09463bff48049bbb27e660f07a5c78e8b954ca5011461bc6f4238ac2047d884
MD5 c3a17b2735da8696bcb6c9b7baa291b0
BLAKE2b-256 9d00cf93d0d36bde6fb71e2b2d4836e927e9bbd71810b8aa4617f4696750acad

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page