tensorbay.utility.file
mixin classes for local file and remote file.
- class tensorbay.utility.file.URL(url, updater)[source]
Bases:
object
URL is a class used to get and update the url.
- Parameters
url (str) – The url.
updater (Callable[[], Optional[str]]) – A function used to update the url.
- Return type
None
- classmethod from_getter(getter, updater)[source]
Create a URL instance from the given getter and updater.
- Parameters
getter (Callable[[...], str]) – The url getter of the file.
updater (Callable[[], Optional[str]]) – The updater of the url.
- Returns
The URL instance which stores the url and the updater.
- Return type
- 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=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 (Optional[tensorbay.utility.file.URL]) – The URL instance used to get and update url.
cache_path (str) – The path to store the cache.
remote_path (str) –
- Return type
None
- path
The file local path.