diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-12-19 12:53:43 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-12-19 12:53:43 -0500 |
commit | a1ea254dfa2ce9e130e71e9d0baa4c89b2214ce6 (patch) | |
tree | 2c8990ad5c04dcf651d9d7b666c649061b91fbc9 | |
parent | 0287005432684546e84550302c7d1827400dc0de (diff) | |
download | cpython-git-bpo-46118/resources-package.tar.gz |
Expand compatibility shims with documentation and explicit imports.bpo-46118/resources-package
-rw-r--r-- | Lib/importlib/abc.py | 10 | ||||
-rw-r--r-- | Lib/importlib/readers.py | 13 | ||||
-rw-r--r-- | Lib/importlib/simple.py | 15 |
3 files changed, 33 insertions, 5 deletions
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py index 2a4841a16a..3fa151f390 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -12,16 +12,20 @@ try: except ImportError: _frozen_importlib_external = _bootstrap_external from ._abc import Loader -from .resources.abc import ResourceReader, Traversable, TraversableResources import abc import warnings +# for compatibility with Python 3.10 +from .resources.abc import ResourceReader, Traversable, TraversableResources + __all__ = [ 'Loader', 'Finder', 'MetaPathFinder', 'PathEntryFinder', 'ResourceLoader', 'InspectLoader', 'ExecutionLoader', - 'FileLoader', 'SourceLoader', 'ResourceReader', 'Traversable', - 'TraversableResources', + 'FileLoader', 'SourceLoader', + + # for compatibility with Python 3.10 + 'ResourceReader', 'Traversable', 'TraversableResources', ] diff --git a/Lib/importlib/readers.py b/Lib/importlib/readers.py index 276157400e..df7fb92e5c 100644 --- a/Lib/importlib/readers.py +++ b/Lib/importlib/readers.py @@ -1 +1,12 @@ -from .resources.readers import * +""" +Compatibility shim for .resources.readers as found on Python 3.10. + +Consumers that can rely on Python 3.11 should use the other +module directly. +""" + +from .resources.readers import ( + FileReader, ZipReader, MultiplexedPath, NamespaceReader, +) + +__all__ = ['FileReader', 'ZipReader', 'MultiplexedPath', 'NamespaceReader'] diff --git a/Lib/importlib/simple.py b/Lib/importlib/simple.py index 44ac2c0664..845bb90364 100644 --- a/Lib/importlib/simple.py +++ b/Lib/importlib/simple.py @@ -1 +1,14 @@ -from .resources.simple import * +""" +Compatibility shim for .resources.simple as found on Python 3.10. + +Consumers that can rely on Python 3.11 should use the other +module directly. +""" + +from .resources.simple import ( + SimpleReader, ResourceHandle, ResourceContainer, TraversableReader, +) + +__all__ = [ + 'SimpleReader', 'ResourceHandle', 'ResourceContainer', 'TraversableReader', +] |