diff options
author | shadchin <[email protected]> | 2025-06-13 00:05:26 +0300 |
---|---|---|
committer | shadchin <[email protected]> | 2025-06-13 00:35:30 +0300 |
commit | 796b9088366b10b4cd42885101fc20c0b5709b07 (patch) | |
tree | f287eacb0b95ffd7cabf95b16cafb4788645dc38 /contrib/tools/python3/Lib/importlib | |
parent | c72bca862651e507d2ff4980ef7f4ff7267a7227 (diff) |
Update Python 3 to 3.12.10
commit_hash:dd2398e159fe1d72ea6b12da52fccc933a41a785
Diffstat (limited to 'contrib/tools/python3/Lib/importlib')
-rw-r--r-- | contrib/tools/python3/Lib/importlib/_bootstrap.py | 2 | ||||
-rw-r--r-- | contrib/tools/python3/Lib/importlib/resources/__init__.py | 2 | ||||
-rw-r--r-- | contrib/tools/python3/Lib/importlib/resources/_legacy.py | 22 |
3 files changed, 3 insertions, 23 deletions
diff --git a/contrib/tools/python3/Lib/importlib/_bootstrap.py b/contrib/tools/python3/Lib/importlib/_bootstrap.py index d942045f3de..464114d171a 100644 --- a/contrib/tools/python3/Lib/importlib/_bootstrap.py +++ b/contrib/tools/python3/Lib/importlib/_bootstrap.py @@ -526,7 +526,7 @@ def _load_module_shim(self, fullname): """ msg = ("the load_module() method is deprecated and slated for removal in " - "Python 3.12; use exec_module() instead") + "Python 3.15; use exec_module() instead") _warnings.warn(msg, DeprecationWarning) spec = spec_from_loader(fullname, self) if fullname in sys.modules: diff --git a/contrib/tools/python3/Lib/importlib/resources/__init__.py b/contrib/tools/python3/Lib/importlib/resources/__init__.py index 34e3a9950cc..a7a9ccb368f 100644 --- a/contrib/tools/python3/Lib/importlib/resources/__init__.py +++ b/contrib/tools/python3/Lib/importlib/resources/__init__.py @@ -4,6 +4,7 @@ from ._common import ( as_file, files, Package, + Anchor, ) from ._legacy import ( @@ -22,6 +23,7 @@ from .abc import ResourceReader __all__ = [ 'Package', + 'Anchor', 'Resource', 'ResourceReader', 'as_file', diff --git a/contrib/tools/python3/Lib/importlib/resources/_legacy.py b/contrib/tools/python3/Lib/importlib/resources/_legacy.py index b1ea8105dad..a3ee4a6287c 100644 --- a/contrib/tools/python3/Lib/importlib/resources/_legacy.py +++ b/contrib/tools/python3/Lib/importlib/resources/_legacy.py @@ -12,21 +12,6 @@ Package = Union[types.ModuleType, str] Resource = str -def deprecated(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - warnings.warn( - f"{func.__name__} is deprecated. Use files() instead. " - "Refer to https://importlib-resources.readthedocs.io" - "/en/latest/using.html#migrating-from-legacy for migration advice.", - DeprecationWarning, - stacklevel=2, - ) - return func(*args, **kwargs) - - return wrapper - - def normalize_path(path: Any) -> str: """Normalize a path by ensuring it is a string. @@ -39,19 +24,16 @@ def normalize_path(path: Any) -> str: return file_name -@deprecated def open_binary(package: Package, resource: Resource) -> BinaryIO: """Return a file-like object opened for binary reading of the resource.""" return (_common.files(package) / normalize_path(resource)).open('rb') -@deprecated def read_binary(package: Package, resource: Resource) -> bytes: """Return the binary contents of the resource.""" return (_common.files(package) / normalize_path(resource)).read_bytes() -@deprecated def open_text( package: Package, resource: Resource, @@ -64,7 +46,6 @@ def open_text( ) -@deprecated def read_text( package: Package, resource: Resource, @@ -80,7 +61,6 @@ def read_text( return fp.read() -@deprecated def contents(package: Package) -> Iterable[str]: """Return an iterable of entries in `package`. @@ -91,7 +71,6 @@ def contents(package: Package) -> Iterable[str]: return [path.name for path in _common.files(package).iterdir()] -@deprecated def is_resource(package: Package, name: str) -> bool: """True if `name` is a resource inside `package`. @@ -104,7 +83,6 @@ def is_resource(package: Package, name: str) -> bool: ) -@deprecated def path( package: Package, resource: Resource, |