Skip to content

Commit

Permalink
List possible types for FileLike docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aatle committed Aug 31, 2024
1 parent 7af301d commit e9aeb03
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/reST/ref/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e9aeb03

Please sign in to comment.