| 1 |
import types |
| 2 |
from _imp import ( |
| 3 |
acquire_lock as acquire_lock, |
| 4 |
create_dynamic as create_dynamic, |
| 5 |
get_frozen_object as get_frozen_object, |
| 6 |
init_frozen as init_frozen, |
| 7 |
is_builtin as is_builtin, |
| 8 |
is_frozen as is_frozen, |
| 9 |
is_frozen_package as is_frozen_package, |
| 10 |
lock_held as lock_held, |
| 11 |
release_lock as release_lock, |
| 12 |
) |
| 13 |
from _typeshed import StrPath |
| 14 |
from os import PathLike |
| 15 |
from types import TracebackType |
| 16 |
from typing import IO, Any, Final, Protocol, type_check_only |
| 17 |
|
| 18 |
SEARCH_ERROR: Final = 0 |
| 19 |
PY_SOURCE: Final = 1 |
| 20 |
PY_COMPILED: Final = 2 |
| 21 |
C_EXTENSION: Final = 3 |
| 22 |
PY_RESOURCE: Final = 4 |
| 23 |
PKG_DIRECTORY: Final = 5 |
| 24 |
C_BUILTIN: Final = 6 |
| 25 |
PY_FROZEN: Final = 7 |
| 26 |
PY_CODERESOURCE: Final = 8 |
| 27 |
IMP_HOOK: Final = 9 |
| 28 |
|
| 29 |
def new_module(name: str) -> types.ModuleType: ... |
| 30 |
def get_magic() -> bytes: ... |
| 31 |
def get_tag() -> str: ... |
| 32 |
def cache_from_source(path: StrPath, debug_override: bool | None = None) -> str: ... |
| 33 |
def source_from_cache(path: StrPath) -> str: ... |
| 34 |
def get_suffixes() -> list[tuple[str, str, int]]: ... |
| 35 |
|
| 36 |
class NullImporter: |
| 37 |
def __init__(self, path: StrPath) -> None: ... |
| 38 |
def find_module(self, fullname: Any) -> None: ... |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
@type_check_only |
| 43 |
class _FileLike(Protocol): |
| 44 |
closed: bool |
| 45 |
mode: str |
| 46 |
def read(self) -> str | bytes: ... |
| 47 |
def close(self) -> Any: ... |
| 48 |
def __enter__(self) -> Any: ... |
| 49 |
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, /) -> Any: ... |
| 50 |
|
| 51 |
|
| 52 |
def load_source(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ... |
| 53 |
def load_compiled(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ... |
| 54 |
def load_package(name: str, path: StrPath) -> types.ModuleType: ... |
| 55 |
def load_module(name: str, file: _FileLike | None, filename: str, details: tuple[str, str, int]) -> types.ModuleType: ... |
| 56 |
|
| 57 |
|
| 58 |
def find_module( |
| 59 |
name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = None |
| 60 |
) -> tuple[IO[Any], str, tuple[str, str, int]]: ... |
| 61 |
def reload(module: types.ModuleType) -> types.ModuleType: ... |
| 62 |
def init_builtin(name: str) -> types.ModuleType | None: ... |
| 63 |
def load_dynamic(name: str, path: str, file: Any = None) -> types.ModuleType: ... |