@@ -74,6 +74,10 @@ class PathFinder(importlib.abc.MetaPathFinder):
7474 @deprecated ("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead." )
7575 def find_module (cls , fullname : str , path : Sequence [str ] | None = None ) -> importlib .abc .Loader | None : ...
7676
77+ if sys .version_info >= (3 , 15 ):
78+ @classmethod
79+ def discover (cls , parent : ModuleSpec | None = None ) -> Iterator [ModuleSpec ]: ...
80+
7781SOURCE_SUFFIXES : Final [list [str ]]
7882DEBUG_BYTECODE_SUFFIXES : Final = [".pyc" ]
7983OPTIMIZED_BYTECODE_SUFFIXES : Final = [".pyc" ]
@@ -88,6 +92,9 @@ class FileFinder(importlib.abc.PathEntryFinder):
8892 cls , * loader_details : tuple [type [importlib .abc .Loader ], list [str ]]
8993 ) -> Callable [[str ], importlib .abc .PathEntryFinder ]: ...
9094
95+ if sys .version_info >= (3 , 15 ):
96+ def discover (self , parent : ModuleSpec | None = None ) -> Iterator [ModuleSpec ]: ...
97+
9198class _LoaderBasics :
9299 def is_package (self , fullname : str ) -> bool : ...
93100 def create_module (self , spec : ModuleSpec ) -> types .ModuleType | None : ...
@@ -153,7 +160,7 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoad
153160if sys .version_info >= (3 , 15 ):
154161 class NamespacePath :
155162 def __init__ (
156- self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec ]
163+ self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec | None ]
157164 ) -> None : ...
158165 def __iter__ (self ) -> Iterator [str ]: ...
159166 def __getitem__ (self , index : int ) -> str : ...
@@ -162,10 +169,12 @@ if sys.version_info >= (3, 15):
162169 def __contains__ (self , item : str ) -> bool : ...
163170 def append (self , item : str ) -> None : ...
164171
172+ _NamespacePath = NamespacePath
173+
165174if sys .version_info >= (3 , 11 ):
166175 class NamespaceLoader (importlib .abc .InspectLoader ):
167176 def __init__ (
168- self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec ]
177+ self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec | None ]
169178 ) -> None : ...
170179 def is_package (self , fullname : str ) -> Literal [True ]: ...
171180 def get_source (self , fullname : str ) -> Literal ["" ]: ...
@@ -188,7 +197,7 @@ if sys.version_info >= (3, 11):
188197else :
189198 class _NamespaceLoader :
190199 def __init__ (
191- self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec ]
200+ self , name : str , path : MutableSequence [str ], path_finder : Callable [[str , tuple [str , ...]], ModuleSpec | None ]
192201 ) -> None : ...
193202 def is_package (self , fullname : str ) -> Literal [True ]: ...
194203 def get_source (self , fullname : str ) -> Literal ["" ]: ...
0 commit comments