diff options
author | Brett Cannon <brettcannon@users.noreply.github.com> | 2018-01-12 23:08:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-12 23:08:59 (GMT) |
commit | bca42186b69e2e615d29d0d4fdb493c9fe71c48b (patch) | |
tree | fffc97d389a1f85f43312a11b31e83cb1c5c3b39 /Lib/importlib | |
parent | 5b76bdba071e7bbd9fda0b9b100d1506d95c04bd (diff) | |
download | cpython-bca42186b69e2e615d29d0d4fdb493c9fe71c48b.zip cpython-bca42186b69e2e615d29d0d4fdb493c9fe71c48b.tar.gz cpython-bca42186b69e2e615d29d0d4fdb493c9fe71c48b.tar.bz2 |
bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108)
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/abc.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py index b772db3..bbff7af 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -342,9 +342,14 @@ class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLo _register(SourceLoader, machinery.SourceFileLoader) -class ResourceReader(Loader): +class ResourceReader: - """Abstract base class for loaders to provide resource reading support.""" + """Abstract base class to provide resource-reading support. + + Loaders that support resource reading are expected to implement + the ``get_resource_reader(fullname)`` method and have it either return None + or an object compatible with this ABC. + """ @abc.abstractmethod def open_resource(self, resource): |