Functor that can load a file in binary mode ('rb').
| 20 | |
| 21 | @mod.export(funcify=True) |
| 22 | class BytesFromPath(BaseLoader): |
| 23 | """ |
| 24 | Functor that can load a file in binary mode ('rb'). |
| 25 | """ |
| 26 | |
| 27 | def __init__(self, path): |
| 28 | """ |
| 29 | Loads a file in binary mode ('rb'). |
| 30 | |
| 31 | Args: |
| 32 | path (str): The file path. |
| 33 | """ |
| 34 | self._path = path |
| 35 | |
| 36 | @util.check_called_by("__call__") |
| 37 | def call_impl(self): |
| 38 | """ |
| 39 | Returns: |
| 40 | bytes: The contents of the file. |
| 41 | """ |
| 42 | return util.load_file(self._path, description="bytes") |
| 43 | |
| 44 | |
| 45 | @mod.export(funcify=True) |
no outgoing calls