mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Enable pyi-stubs for _importlib_modulespec (PY-26025)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# ModuleSpec, ModuleType, Loader are part of a dependency cycle.
|
||||
# They are officially defined/exported in other places:
|
||||
#
|
||||
# - ModuleType in types
|
||||
# - Loader in importlib.abc
|
||||
# - ModuleSpec in importlib.machinery (3.4 and later only)
|
||||
|
||||
from abc import ABCMeta
|
||||
import sys
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
class ModuleSpec:
|
||||
def __init__(self, name: str, loader: Optional[Loader], *,
|
||||
origin: Optional[str] = ..., loader_state: Any = ...,
|
||||
is_package: Optional[bool] = ...) -> None: ...
|
||||
name = ... # type: str
|
||||
loader = ... # type: Optional[Loader]
|
||||
origin = ... # type: Optional[str]
|
||||
submodule_search_locations = ... # type: Optional[List[str]]
|
||||
loader_state = ... # type: Any
|
||||
cached = ... # type: Optional[str]
|
||||
parent = ... # type: Optional[str]
|
||||
has_location = ... # type: bool
|
||||
|
||||
class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__loader__ = ... # type: Optional[Loader]
|
||||
__package__ = ... # type: Optional[str]
|
||||
__spec__ = ... # type: Optional[ModuleSpec]
|
||||
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
|
||||
|
||||
class Loader(metaclass=ABCMeta):
|
||||
def load_module(self, fullname: str) -> ModuleType: ...
|
||||
def module_repr(self, module: ModuleType) -> str: ...
|
||||
def create_module(self, spec: ModuleSpec) -> Optional[ModuleType]: ...
|
||||
# Not defined on the actual class for backwards-compatibility reasons,
|
||||
# but expected in new code.
|
||||
def exec_module(self, module: ModuleType) -> None: ...
|
||||
@@ -22,7 +22,7 @@ sync(repo, bundled)
|
||||
|
||||
val whiteList = setOf("typing", "six", "__builtin__", "builtins", "exceptions", "types", "datetime", "functools", "shutil", "re", "time",
|
||||
"argparse", "uuid", "threading", "signal", "collections", "subprocess", "math", "queue", "socket", "sqlite3", "attr",
|
||||
"pathlib", "io", "_io", "itertools", "ssl", "multiprocessing", "asyncio", "mock", "unittest")
|
||||
"pathlib", "io", "_io", "itertools", "ssl", "multiprocessing", "asyncio", "mock", "unittest", "_importlib_modulespec")
|
||||
|
||||
clean(topLevelPackages(bundled), whiteList)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user