Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 344fb6a

Browse files
committed
Fix type indication on _py3.path now that context manager is in a subroutine.
1 parent 5fe5e85 commit 344fb6a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

importlib_resources/_py3.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pathlib import Path
1111
from types import ModuleType
1212
from typing import Iterable, Iterator, Optional, Set, Union # noqa: F401
13+
from typing import ContextManager
1314
from typing import cast
1415
from typing.io import BinaryIO, TextIO
1516

@@ -138,7 +139,9 @@ def get(package: Package, resource: Resource) -> trees.Traversable:
138139
return trees.from_package(package) / resource
139140

140141

141-
def path(package: Package, resource: Resource) -> Iterator[Path]:
142+
def path(
143+
package: Package, resource: Resource,
144+
) -> ContextManager[Path]:
142145
"""A context manager providing a file path object to the resource.
143146
144147
If the resource does not already exist on its own on the file system,

0 commit comments

Comments
 (0)