tensorbay.utility.file
mixin classes for local file and remote file.
- class tensorbay.utility.file.FileMixin(local_path)[source]
Bases:
tensorbay.utility.repr.ReprMixin
FileMixin is a mixin class to mixin file related methods for local file.
- Parameters
local_path (str) – The file local path.
- Return type
None
- path
The file local path.
- get_checksum()[source]
Get and cache the sha1 checksum of the local data.
- Returns
The sha1 checksum of the local data.
- Return type
str
- class tensorbay.utility.file.RemoteFileMixin(remote_path, *, _url_getter=None, _url_updater=None, cache_path='')[source]
Bases:
tensorbay.utility.repr.ReprMixin
RemoteFileMixin is a mixin class to mixin file related methods for remote file.
- Parameters
local_path – The file local path.
_url_getter (Optional[Callable[[str], str]]) – The url getter of the remote file.
cache_path (str) – The path to store the cache.
remote_path (str) –
_url_updater (Optional[Callable[[], None]]) –
- Return type
None
- path
The file local path.
- update_url()[source]
Update the url when the url is timed out.
- Raises
ValueError – When the _url_updater is missing.
- Return type
None