-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.file binary | ||
*.zip binary |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import abc | ||
from typing.io import BinaryIO | ||
|
||
|
||
class ResourceReader(abc.ABC): | ||
|
||
"""Abstract base class for loaders to provide resource reading support.""" | ||
|
||
@abc.abstractmethod | ||
def open_resource(self, path: str) -> BinaryIO: | ||
"""Return an opened, file-like object for binary reading of the resource. | ||
The 'path' argument is expected to represent only a file name. | ||
If the resource cannot be found, FileNotFoundError is raised. | ||
""" | ||
raise FileNotFoundError | ||
|
||
def resource_path(self, path: str) -> str: | ||
"""Return the file system path to the specified resource. | ||
The 'path' argument is expected to represent only a file name. | ||
If the resource does not exist on the file system, raise | ||
FileNotFoundError. | ||
""" | ||
raise FileNotFoundError |
This file contains 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