-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
All Python Readers, Writers, and CodedInputStream/CodedOutputStreams should accept os.PathLike in addition to the current types.
For example:
yardl/tooling/internal/python/static_files/_binary.py
Lines 180 to 189 in 58c14fe
| 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)).
Metadata
Metadata
Assignees
Labels
No labels