2 # This is a >=3.7 module, so we conditionally include its source.
\r
3 if sys.version_info >= (3, 7):
\r
6 from pathlib import Path
\r
7 from types import ModuleType
\r
8 from typing import ContextManager, Iterator, Union, BinaryIO, TextIO
\r
10 Package = Union[str, ModuleType]
\r
11 Resource = Union[str, os.PathLike]
\r
13 def open_binary(package: Package, resource: Resource) -> BinaryIO: ...
\r
14 def open_text(package: Package,
\r
16 encoding: str = ...,
\r
17 errors: str = ...) -> TextIO: ...
\r
18 def read_binary(package: Package, resource: Resource) -> bytes: ...
\r
19 def read_text(package: Package,
\r
21 encoding: str = ...,
\r
22 errors: str = ...) -> str: ...
\r
23 def path(package: Package, resource: Resource) -> ContextManager[Path]: ...
\r
24 def is_resource(package: Package, name: str) -> bool: ...
\r
25 def contents(package: Package) -> Iterator[str]: ...
\r