mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 20:45:49 +08:00
fb0940e6c1
* [stdlib] Deprecate many functions * Fix typo * Imporove message for asyncio/trsock * Apply suggestions from code review Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> * Add Python before version * [pre-commit.ci] auto fixes from pre-commit.com hooks * Wrap comment lines * fix the rest --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
60 lines
2.6 KiB
Python
60 lines
2.6 KiB
Python
import sys
|
|
from _typeshed import StrOrBytesPath
|
|
from importlib.machinery import ModuleSpec
|
|
from types import CodeType, ModuleType
|
|
from typing_extensions import deprecated
|
|
|
|
if sys.version_info >= (3, 10):
|
|
from importlib.readers import ZipReader
|
|
else:
|
|
from importlib.abc import ResourceReader
|
|
|
|
if sys.version_info >= (3, 10):
|
|
from _frozen_importlib_external import _LoaderBasics
|
|
else:
|
|
_LoaderBasics = object
|
|
|
|
__all__ = ["ZipImportError", "zipimporter"]
|
|
|
|
class ZipImportError(ImportError): ...
|
|
|
|
class zipimporter(_LoaderBasics):
|
|
archive: str
|
|
prefix: str
|
|
if sys.version_info >= (3, 11):
|
|
def __init__(self, path: str) -> None: ...
|
|
else:
|
|
def __init__(self, path: StrOrBytesPath) -> None: ...
|
|
|
|
if sys.version_info < (3, 12):
|
|
if sys.version_info >= (3, 10):
|
|
@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `find_spec()` instead.")
|
|
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ...
|
|
@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `find_spec()` instead.")
|
|
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
|
|
else:
|
|
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ...
|
|
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
|
|
|
|
def get_code(self, fullname: str) -> CodeType: ...
|
|
def get_data(self, pathname: str) -> bytes: ...
|
|
def get_filename(self, fullname: str) -> str: ...
|
|
if sys.version_info >= (3, 14):
|
|
def get_resource_reader(self, fullname: str) -> ZipReader: ... # undocumented
|
|
elif sys.version_info >= (3, 10):
|
|
def get_resource_reader(self, fullname: str) -> ZipReader | None: ... # undocumented
|
|
else:
|
|
def get_resource_reader(self, fullname: str) -> ResourceReader | None: ... # undocumented
|
|
|
|
def get_source(self, fullname: str) -> str | None: ...
|
|
def is_package(self, fullname: str) -> bool: ...
|
|
if sys.version_info >= (3, 10):
|
|
@deprecated("Deprecated since Python 3.10; removed in Python 3.15. Use `exec_module()` instead.")
|
|
def load_module(self, fullname: str) -> ModuleType: ...
|
|
def exec_module(self, module: ModuleType) -> None: ...
|
|
def create_module(self, spec: ModuleSpec) -> None: ...
|
|
def find_spec(self, fullname: str, target: ModuleType | None = None) -> ModuleSpec | None: ...
|
|
def invalidate_caches(self) -> None: ...
|
|
else:
|
|
def load_module(self, fullname: str) -> ModuleType: ...
|