@@ -4,22 +4,22 @@ from typing import Any
44# This is a >=3.7 module, so we conditionally include its source.
55if sys .version_info >= (3 , 7 ):
66 import os
7+ from contextlib import AbstractContextManager
78 from pathlib import Path
89 from types import ModuleType
9- from typing import BinaryIO , ContextManager , Iterator , TextIO , Union
10+ from typing import BinaryIO , Iterator , TextIO , Union
1011
1112 Package = Union [str , ModuleType ]
1213 Resource = Union [str , os .PathLike [Any ]]
1314 def open_binary (package : Package , resource : Resource ) -> BinaryIO : ...
1415 def open_text (package : Package , resource : Resource , encoding : str = ..., errors : str = ...) -> TextIO : ...
1516 def read_binary (package : Package , resource : Resource ) -> bytes : ...
1617 def read_text (package : Package , resource : Resource , encoding : str = ..., errors : str = ...) -> str : ...
17- def path (package : Package , resource : Resource ) -> ContextManager [Path ]: ...
18+ def path (package : Package , resource : Resource ) -> AbstractContextManager [Path ]: ...
1819 def is_resource (package : Package , name : str ) -> bool : ...
1920 def contents (package : Package ) -> Iterator [str ]: ...
2021
2122if sys .version_info >= (3 , 9 ):
22- from contextlib import AbstractContextManager
2323 from importlib .abc import Traversable
2424 def files (package : Package ) -> Traversable : ...
2525 def as_file (path : Traversable ) -> AbstractContextManager [Path ]: ...
0 commit comments