Skip to content

Commit 4875bc5

Browse files
committed
Add type annotations for _candidate_paths
1 parent d84ca37 commit 4875bc5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

importlib_resources/readers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
from __future__ import annotations
2+
13
import collections
24
import contextlib
35
import itertools
46
import pathlib
57
import operator
68
import re
79
import warnings
10+
from collections.abc import Iterator
811

912
from . import abc
1013

@@ -150,12 +153,12 @@ def _resolve(cls, path_str) -> abc.Traversable:
150153
return dir
151154

152155
@classmethod
153-
def _candidate_paths(cls, path_str):
156+
def _candidate_paths(cls, path_str: str) -> Iterator[abc.Traversable]:
154157
yield pathlib.Path(path_str)
155158
yield from cls._resolve_zip_path(path_str)
156159

157160
@staticmethod
158-
def _resolve_zip_path(path_str):
161+
def _resolve_zip_path(path_str: str):
159162
for match in reversed(list(re.finditer(r'[\\/]', path_str))):
160163
with contextlib.suppress(
161164
FileNotFoundError,

0 commit comments

Comments
 (0)