Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Find a stream to use as input for filters.

:param stdin: Standard in - used if no files are named in argv.
:param argv: Command line arguments after option parsing. If one file
    is named, that is opened in read only binary mode and returned.
    A missing file will raise an exception, as will multiple file names.

        def find_stream(stdin, argv):
    """Find a stream to use as input for filters.

    :param stdin: Standard in - used if no files are named in argv.
    :param argv: Command line arguments after option parsing. If one file
        is named, that is opened in read only binary mode and returned.
        A missing file will raise an exception, as will multiple file names.
    """
    assert len(argv) < 2, "Too many filenames."
    if argv:
        return open(argv[0], 'rb')
    else:
        return stdin
        


src/p/y/python-subunit-0.0.18/python/subunit/tests/test_filters.py   python-subunit(Download)
from testtools import TestCase
 
from subunit.filters import find_stream
 
 
    def test_opens_file(self):
        f = NamedTemporaryFile()
        f.write(b'foo')
        f.flush()
        stream = find_stream('bar', [f.name])