Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(95)  |  Call(28)  |  Derive(21)  |  Import(46)
Stream every line in the given file.

:param encoding: A ``str`` indicating the charset/encoding to use.
:type encoding:  ``str`` or ``None``

:param filename: A ``str`` filename, A ``py._path.local.LocalPath`` instance or open ``file`` instnace.
:type filename:  ``str``, ``py._path.local.LocalPath`` or ``file``.

:param skipblank: Whehter to skip blank lines (sometimes undesirable)
:type skipblank: ``bool``(more...)

        def stream(filename, encoding="utf-8", skipblank=True, strip=True, stripchars="\r\n\t "):
    """Stream every line in the given file.

    :param encoding: A ``str`` indicating the charset/encoding to use.
    :type encoding:  ``str`` or ``None``

    :param filename: A ``str`` filename, A ``py._path.local.LocalPath`` instance or open ``file`` instnace.
    :type filename:  ``str``, ``py._path.local.LocalPath`` or ``file``.

    :param skipblank: Whehter to skip blank lines (sometimes undesirable)
    :type skipblank: ``bool``

    :param strip: Whehter to strip lines of surrounding whitespace (sometimes undesirable)
    :type strip: ``bool``

    :param stripchars: An iterable of characters to strip from the surrounding line. ``line.strip(...)`` is used.
    :type stripchars: ``list``, ``tuple`` or ``str``

    Each line in the file is read, stripped of surrounding whitespace and returned iteratively. Blank lines are ignored.
    If they keyword argument ``encoding`` is provided and is not ``None`` each line in the input strema will be decoded
    using the given encoding, if ``None`` will disable unicode decoding.
    """

    if isinstance(filename, LocalPath):
        fd = filename.open("rU")
    elif isinstance(filename, str):
        fd = open(filename, "rU")
    else:
        fd = filename

    for line in fd:
        line = line.strip(stripchars) if strip else line
        if line or not skipblank:
            if encoding is not None:
            	yield line.decode(encoding)
            else:
                yield line
        


src/s/t/streamio-0.0.9/streamio/__init__.py   streamio(Download)
from .stat import minmax  # noqa
from .sort import merge, mergesort  # noqa
from .stream import stream, csvstream, jsonstream, csvdictstream, compress  # noqa
 
__all__ = ("minmax", "merge", "mergesort", "stream", "csvstream", "jsonstream", "csvdictstream", "compress",)

src/y/o/youtube-cli-HEAD/youtube.py   youtube-cli(Download)
# http://gdata-python-client.googlecode.com/hg/pydocs/gdata.youtube.service.html#YouTubeVideoQuery
# https://developers.google.com/youtube/1.0/developers_guide_python
from stream import stream
from stream import download
# https://bitbucket.org/rg3/youtube-dl/wiki/Home