mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 05:22:23 +08:00
importlib: stubtest fixes for py310 (#6443)
This commit is contained in:
@@ -85,8 +85,12 @@ if sys.version_info >= (3, 7):
|
||||
def open_resource(self, resource: StrOrBytesPath) -> IO[bytes]: ...
|
||||
@abstractmethod
|
||||
def resource_path(self, resource: StrOrBytesPath) -> str: ...
|
||||
@abstractmethod
|
||||
def is_resource(self, name: str) -> bool: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@abstractmethod
|
||||
def is_resource(self, path: str) -> bool: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def is_resource(self, name: str) -> bool: ...
|
||||
@abstractmethod
|
||||
def contents(self) -> Iterator[str]: ...
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import importlib.abc
|
||||
import sys
|
||||
import types
|
||||
from typing import Any, Callable, Sequence
|
||||
|
||||
@@ -41,10 +42,16 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
|
||||
# Loader
|
||||
@staticmethod
|
||||
def module_repr(module: types.ModuleType) -> str: ...
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
@classmethod
|
||||
def exec_module(cls, module: types.ModuleType) -> None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@staticmethod
|
||||
def create_module(spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
@staticmethod
|
||||
def exec_module(module: types.ModuleType) -> None: ...
|
||||
else:
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
@classmethod
|
||||
def exec_module(cls, module: types.ModuleType) -> None: ...
|
||||
|
||||
class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@@ -66,8 +73,12 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# Loader
|
||||
@staticmethod
|
||||
def module_repr(m: types.ModuleType) -> str: ...
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@staticmethod
|
||||
def create_module(spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
else:
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
@staticmethod
|
||||
def exec_module(module: types.ModuleType) -> None: ...
|
||||
|
||||
@@ -80,8 +91,12 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
|
||||
) -> ModuleSpec | None: ...
|
||||
|
||||
class PathFinder:
|
||||
@classmethod
|
||||
def invalidate_caches(cls) -> None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@staticmethod
|
||||
def invalidate_caches() -> None: ...
|
||||
else:
|
||||
@classmethod
|
||||
def invalidate_caches(cls) -> None: ...
|
||||
@classmethod
|
||||
def find_spec(
|
||||
cls, fullname: str, path: Sequence[bytes | str] | None = ..., target: types.ModuleType | None = ...
|
||||
|
||||
@@ -72,6 +72,9 @@ if sys.version_info >= (3, 8):
|
||||
class MetadataPathFinder(DistributionFinder):
|
||||
@classmethod
|
||||
def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
# Yes, this is an instance method that has argumend named "cls"
|
||||
def invalidate_caches(cls) -> None: ... # type: ignore
|
||||
class PathDistribution(Distribution):
|
||||
def __init__(self, path: Path) -> None: ...
|
||||
def read_text(self, filename: StrPath) -> str: ...
|
||||
|
||||
@@ -124,12 +124,6 @@ tkinter.EventType.__new__
|
||||
_markupbase.ParserBase.error
|
||||
asyncio.proactor_events._ProactorReadPipeTransport.__init__
|
||||
distutils.command.bdist_wininst
|
||||
importlib.abc.ResourceReader.is_resource
|
||||
importlib.machinery.BuiltinImporter.create_module
|
||||
importlib.machinery.BuiltinImporter.exec_module
|
||||
importlib.machinery.FrozenImporter.create_module
|
||||
importlib.machinery.PathFinder.invalidate_caches
|
||||
importlib.metadata.MetadataPathFinder.invalidate_caches
|
||||
logging.Formatter.__init__
|
||||
logging.LoggerAdapter.__init__
|
||||
logging.PercentStyle.__init__
|
||||
|
||||
Reference in New Issue
Block a user