law.target.mirrored#
Target classes that represent remote files and directories and have a local, optionally read-only mirror (e.g. through a local mount of the remote file system).
Class MirroredTarget#
- class MirroredTarget(path, _is_file, remote_target=None, remote_target_cls=None, remote_fs=None, remote_kwargs=None, local_target=None, local_fs=None, local_kwargs=None, local_read_only=True, local_sync=None, **kwargs)[source]#
Bases:
FileSystemTarget- property fs#
The
FileSystemassociated with this FileSystemTarget.
- exists(*args, **kwargs)[source]#
Returns
Trueif the path for this FileSystemTarget exists;Falseotherwise.This method is implemented by using
fs.
- remove(*args, local_sync=None, **kwargs)[source]#
Remove the resource at the path specified by this FileSystemTarget.
This method is implemented by using
fs.
- directory_class#
alias of
MirroredDirectoryTarget
- file_class#
alias of
MirroredFileTarget
Class MirroredFileTarget#
- class MirroredFileTarget(path, **kwargs)[source]#
Bases:
FileSystemFileTarget,MirroredTarget- open(mode, local_sync=None, **kwargs)[source]#
Open the FileSystem target.
This method returns a file-like object which can either be read from or written to depending on the specified mode.
- Parameters:
mode (str) – the mode r opens the FileSystemTarget in read-only mode, whereas w will open the FileSystemTarget in write mode. Subclasses can implement additional options. Using b is not supported; initialize with format=Nop instead.