Add stub for PathFinder and remove whitelist (#3885)

This commit is contained in:
Debjyoti Biswas
2020-03-29 01:59:49 +05:30
committed by GitHub
parent 68238e0c9e
commit 132aebd2d8
2 changed files with 13 additions and 6 deletions

View File

@@ -1,10 +1,10 @@
import importlib.abc
import types
from typing import Any, Callable, List, Optional, Sequence, Tuple
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
# ModuleSpec is exported from this module, but for circular import
# reasons exists in its own stub file (with Loader and ModuleType).
from _importlib_modulespec import ModuleSpec as ModuleSpec # Exported
from _importlib_modulespec import ModuleSpec as ModuleSpec, Loader # Exported
class BuiltinImporter(importlib.abc.MetaPathFinder,
importlib.abc.InspectLoader):
@@ -81,7 +81,17 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]:
...
class PathFinder(importlib.abc.MetaPathFinder): ...
class PathFinder:
@classmethod
def invalidate_caches(cls) -> None: ...
@classmethod
def find_spec(cls, fullname: str,
path: Optional[Sequence[Union[bytes, str]]] = ...,
target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: ...
@classmethod
def find_module(cls, fullname: str,
path: Optional[Sequence[Union[bytes, str]]] = ...) -> Optional[Loader]: ...
SOURCE_SUFFIXES: List[str]
DEBUG_BYTECODE_SUFFIXES: List[str]

View File

@@ -287,9 +287,6 @@ importlib.machinery.ExtensionFileLoader.get_filename
importlib.machinery.FrozenImporter.find_module
importlib.machinery.FrozenImporter.find_spec
importlib.machinery.FrozenImporter.module_repr
importlib.machinery.PathFinder.find_module
importlib.machinery.PathFinder.find_spec
importlib.machinery.PathFinder.invalidate_caches
importlib.machinery.SourceFileLoader.set_data
importlib.machinery.WindowsRegistryFinder.find_module
importlib.machinery.WindowsRegistryFinder.find_spec