All Python Readers, Writers, and CodedInputStream/CodedOutputStreams should accept os.PathLike in addition to the current types.
For example:
|
class CodedInputStream: |
|
def __init__( |
|
self, |
|
stream: Union[BufferedReader, BytesIO, BinaryIO, str], |
|
*, |
|
buffer_size: int = 65536, |
|
) -> None: |
|
if isinstance(stream, str): |
|
self._stream = open(stream, "rb") |
|
self._owns_stream = True |
The CodedInputStream will only open the stream if it is of type str, but it should accept any "path-like object".
So the type signature should also include os.PathLike, and the isinstance(stream, str) should be isinstance(stream, (str, os.PathLIke)).
All Python Readers, Writers, and CodedInputStream/CodedOutputStreams should accept
os.PathLikein addition to the current types.For example:
yardl/tooling/internal/python/static_files/_binary.py
Lines 180 to 189 in 58c14fe
The CodedInputStream will only open the stream if it is of type
str, but it should accept any "path-like object".So the type signature should also include
os.PathLike, and theisinstance(stream, str)should beisinstance(stream, (str, os.PathLIke)).