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: str | Path, _is_file: bool, remote_target: RemoteTarget | None = None, remote_target_cls: Type[RemoteTarget] | None = None, remote_fs: RemoteFileSystem | str | None = None, remote_kwargs: dict[str, Any] | None = None, local_target: LocalTarget | None = None, local_fs: LocalFileSystem | str | None = None, local_kwargs: dict[str, Any] | None = None, local_read_only: bool = True, local_sync: bool | None = None, **kwargs)[source]#
Bases:
FileSystemTarget- property fs: LocalFileSystem | RemoteFileSystem#
The
FileSystemassociated with this FileSystemTarget.
- exists(*args, **kwargs) bool | stat_result | None[source]#
Returns
Trueif the path for this FileSystemTarget exists;Falseotherwise.This method is implemented by using
fs.
- remove(*args, local_sync: bool | None = None, **kwargs) bool[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: str | Path, **kwargs)[source]#
Bases:
FileSystemFileTarget,MirroredTarget- open(mode: str, *, local_sync: bool | None = None, **kwargs) Iterator[IO][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.