(filename, *args, _open=open, **kwargs)
return filename
Return seamlessly decompressed open file handle for `filename`
Return seamlessly decompressed open file handle for `filename`
Return seamlessly decompressed open file handle for filename
def open_compressed(filename, *args, _open=open, **kwargs):
    """Return seamlessly decompressed open file handle for `filename`"""
    if isinstance(filename, str):
        if filename.endswith(Compression.GZIP):
            from gzip import open as _open
        elif filename.endswith(Compression.BZIP2):
            from bz2 import open as _open
        elif filename.endswith(Compression.XZ):
            from lzma import open as _open
        return _open(filename, *args, **kwargs)
    # Else already a file, just pass it through
    return filename
def open_compressed ( filename , * args , _open = open , * * kwargs ) : if isinstance ( filename , str ) : if filename . endswith ( Compression . GZIP ) : from gzip import open as _open elif filename . endswith ( Compression . BZIP2 ) : from bz2 import open as _open elif filename . endswith ( Compression . XZ ) : from lzma import open as _open return _open ( filename , * args , * * kwargs ) # Else already a file, just pass it through return filename