From e9aeb03cdee398fddb3cfa82e6308cd964bd962f Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:51:39 -0700 Subject: [PATCH] List possible types for FileLike docs --- docs/reST/ref/typing.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/reST/ref/typing.rst b/docs/reST/ref/typing.rst index 4e4380a74f..7c71f6e18b 100644 --- a/docs/reST/ref/typing.rst +++ b/docs/reST/ref/typing.rst @@ -16,9 +16,15 @@ type aliases for proper typehint annotations. .. data:: FileLike - An object representing a file. This includes any path-like objects such as - ``str`` or ``pathlib.Path()`` and file buffers (``IO`` of strings or bytes) - such as the return value of ``open()``. + An object representing a file. This includes both path-like + objects and file-like objects, i.e.: + + * ``"my/string/path.txt"`` + * ``open("my/file/path.txt")`` + * ``pathlib.Path("my/pathlib/path.txt")`` + * ``io.BytesIO(b"my data: \x00\x01")`` + * ``b"my/bytes/path.txt"`` + * Any object implementing the path protocol or file protocol. .. data:: SequenceLike