mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108)
This commit is contained in:
parent
5b76bdba07
commit
bca42186b6
4 changed files with 57 additions and 13 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue