41
41
42
42
import itertools
43
43
import os
44
+ from collections .abc import Iterator
44
45
from fnmatch import fnmatchcase
45
46
from glob import glob
46
47
from pathlib import Path
47
- from typing import TYPE_CHECKING , Iterable , Iterator , Mapping
48
+ from typing import TYPE_CHECKING , Iterable , Mapping
48
49
49
50
import _distutils_hack .override # noqa: F401
50
51
54
55
from distutils .util import convert_path
55
56
56
57
if TYPE_CHECKING :
57
- from typing_extensions import TypeAlias
58
-
59
58
from setuptools import Distribution
60
59
61
- StrIter : TypeAlias = Iterator [str ]
62
60
chain_iter = itertools .chain .from_iterable
63
61
64
62
@@ -125,7 +123,9 @@ def find(
125
123
)
126
124
127
125
@classmethod
128
- def _find_iter (cls , where : StrPath , exclude : _Filter , include : _Filter ) -> StrIter :
126
+ def _find_iter (
127
+ cls , where : StrPath , exclude : _Filter , include : _Filter
128
+ ) -> Iterator [str ]:
129
129
raise NotImplementedError
130
130
131
131
@@ -137,7 +137,9 @@ class PackageFinder(_Finder):
137
137
ALWAYS_EXCLUDE = ("ez_setup" , "*__pycache__" )
138
138
139
139
@classmethod
140
- def _find_iter (cls , where : StrPath , exclude : _Filter , include : _Filter ) -> StrIter :
140
+ def _find_iter (
141
+ cls , where : StrPath , exclude : _Filter , include : _Filter
142
+ ) -> Iterator [str ]:
141
143
"""
142
144
All the packages found in 'where' that pass the 'include' filter, but
143
145
not the 'exclude' filter.
@@ -186,7 +188,9 @@ class ModuleFinder(_Finder):
186
188
"""
187
189
188
190
@classmethod
189
- def _find_iter (cls , where : StrPath , exclude : _Filter , include : _Filter ) -> StrIter :
191
+ def _find_iter (
192
+ cls , where : StrPath , exclude : _Filter , include : _Filter
193
+ ) -> Iterator [str ]:
190
194
for file in glob (os .path .join (where , "*.py" )):
191
195
module , _ext = os .path .splitext (os .path .basename (file ))
192
196
0 commit comments