bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108)

This commit is contained in:
Brett Cannon 2018-01-12 15:08:59 -08:00 committed by GitHub
parent 5b76bdba07
commit bca42186b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 13 deletions

View file

@ -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):