Mark some importlib interfaces as deprecated (#13866)

This commit is contained in:
Semyon Moroz
2025-04-24 15:10:38 +04:00
committed by GitHub
parent 8728d93565
commit e3f0de782d
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -36,7 +36,10 @@ def spec_from_file_location(
loader: LoaderProtocol | None = None,
submodule_search_locations: list[str] | None = ...,
) -> importlib.machinery.ModuleSpec | None: ...
@deprecated(
"Deprecated as of Python 3.6: Use site configuration instead. "
"Future versions of Python may not enable this finder by default."
)
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
if sys.version_info < (3, 12):
@classmethod
+3
View File
@@ -8,6 +8,7 @@ from importlib import _bootstrap_external
from importlib.machinery import ModuleSpec
from io import BufferedReader
from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
from typing_extensions import deprecated
if sys.version_info >= (3, 11):
__all__ = [
@@ -38,6 +39,7 @@ else:
if sys.version_info < (3, 12):
class Finder(metaclass=ABCMeta): ...
@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.")
class ResourceLoader(Loader):
@abstractmethod
def get_data(self, path: str) -> bytes: ...
@@ -58,6 +60,7 @@ class ExecutionLoader(InspectLoader):
def get_filename(self, fullname: str) -> str: ...
class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLoader, metaclass=ABCMeta): # type: ignore[misc] # incompatible definitions of source_to_code in the base classes
@deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.")
def path_mtime(self, path: str) -> float: ...
def set_data(self, path: str, data: bytes) -> None: ...
def get_source(self, fullname: str) -> str | None: ...