Skip to content

Volume only accepts io.RawIOBase or io.BufferedIOBase streams #15

@voelkle-unige

Description

@voelkle-unige

Trying to read ext4 snapshots stored in S3 with s3fs, Volume refuses to work with s3fs.core.S3File instances which extend fsspec.spec.AbstractBufferedFile which extend io.IOBase. Now maybe AbstractBufferedFile should extend io.BufferedIOBase instead, but the check in Volume is not very pythonic, it could be a simple type hint.

Furthermore, the way the stream is used does not seem to handle the cases when io.RawIOBase.read returns fewer bytes than expected. Should only io.BufferedIOBase instances be accepted?

In short: would it make sense to remove the type assertion in Volume.__init__ and replace it with a type hint stream: io.BufferedIOBase ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions