asammdf icon indicating copy to clipboard operation
asammdf copied to clipboard

BufferedReader as input not currently working

Open CheMcKirgan opened this issue 1 year ago • 1 comments

Python version

3.11

asammdf version

7.4.2

Description

The type hinting for the init istates that MDF supports io.BufferedReader as an input type. https://github.com/danielhrisca/asammdf/blob/2d20ad23d3ef71ca7e307273ddd74ce08cce83b5/src/asammdf/types.py#L38

https://github.com/danielhrisca/asammdf/blob/c9d0e449000ed70f2ea1dd47df7c80f3e74471c5/src/asammdf/mdf.py#L236 This type checking block has broken that support in this commit. We've tested adding BufferedReader to this type check, if isinstance(name, (BytesIO, BufferedReader)):, and it seems that the type check is the only thing blocking this support.

CheMcKirgan avatar Mar 28 '24 11:03 CheMcKirgan

Further to documentation on the is file like check method. It would be very helpful to check that the input is a general 'BufferedIoBase', as BufferedIoBase meets your criteria for read and seek methods, after evaluating it is not any of the compressed file formats you support.

https://github.com/danielhrisca/asammdf/blob/c9d0e449000ed70f2ea1dd47df7c80f3e74471c5/src/asammdf/blocks/utils.py#L1079

CheMcKirgan avatar Mar 28 '24 11:03 CheMcKirgan

@CheMcKirgan please try the development branch code

danielhrisca avatar Jul 30 '24 07:07 danielhrisca