bpo-32248: Introduce the concept of Loader.get_resource_reader()#5108
Merged
brettcannon merged 5 commits intopython:masterfrom Jan 12, 2018
Merged
bpo-32248: Introduce the concept of Loader.get_resource_reader()#5108brettcannon merged 5 commits intopython:masterfrom
brettcannon merged 5 commits intopython:masterfrom
Conversation
warsaw
reviewed
Jan 5, 2018
| paths should be included in the *resource* argument. This is | ||
| because the location of the package that the loader is for acts | ||
| as the "directory". Hence the metaphor for directories and file | ||
| because the location of the package the reader is for acts as the |
Member
There was a problem hiding this comment.
Maybe add a comma between "is for, acts" so it parses a little easier?
| a specific package (instead of potentially representing multiple | ||
| packages or a module). | ||
|
|
||
| Loaders that wish to support resource reading are expected to |
Member
There was a problem hiding this comment.
What about:
"... which returns an object implementing this ABC's interface. If the module specified by fullname is not a package, this method should return :const:None" ...?
| and reading *resources* inside packages. Resources are roughly akin to files | ||
| inside of packages, but they needn't be actual files on the physical file | ||
| system. Module loaders can implement the | ||
| system. Module loaders can support the |
Member
There was a problem hiding this comment.
"support" used twice reads a little weird. Maybe the first one can be "provide"?
| """Abstract base class for loaders to provide resource reading support.""" | ||
| """Abstract base class to provide resource-reading support. | ||
|
|
||
| Loaders who support resource reading are expected to implement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For loaders that wish to provide resource reading, they should now implement
get_resource_reader(fullname)to return an object compatible withimportlib.abc.ResourceReader.importlib.abc.ResourceLoaderhas also been documented as deprecated asResourceReaderis more well-defined, full API for similar purposes.https://bugs.python.org/issue32248