law.target.local#
Local target implementations.
Class LocalFileSystem#
- class LocalFileSystem(section: str | None = None, *, base: str | None = None, **kwargs)[source]#
Bases:
FileSystem,LocalFileSystem- exists(path: str | Path, *, stat: bool = False, **kwargs) bool | stat_result | None[source]#
Return
Trueif file or directory atpathexist,Falseotherwise- Parameters:
path (str) – a path within the FileSystem to check for existence.
- isdir(path: str | Path, **kwargs) bool[source]#
Return
Trueif the location atpathis a directory. If not, returnFalse.- Parameters:
path (str) – a path within the FileSystem to check as a directory.
Note: This method is optional, not all FileSystem subclasses implements it.
- remove(path: str | Path, *, recursive: bool = True, silent: bool = True, **kwargs) bool[source]#
Remove file or directory at location
path
- mkdir(path: str | Path, *, perm: int | None = None, recursive: bool = True, silent: bool = True, **kwargs) bool[source]#
Create directory at location
pathCreates the directory at
pathand implicitly create parent directories if they do not already exist.- Parameters:
path (str) – a path within the FileSystem to create as a directory.
parents (bool) – Create parent directories when necessary. When parents=False and the parent directory doesn’t exist, raise luigi.target.MissingParentDirectory
raise_if_exists (bool) – raise luigi.target.FileAlreadyExists if the folder already exists.
- listdir(path: str | Path, *, pattern: str | None = None, type: Literal['f', 'd'] | None = None, **kwargs) list[str][source]#
Return a list of files rooted in path.
This returns an iterable of the files rooted at
path. This is intended to be a recursive listing.- Parameters:
path (str) – a path within the FileSystem to list.
Note: This method is optional, not all FileSystem subclasses implements it.
Class LocalTarget#
- class LocalTarget(path: str | ~pathlib.Path | None = None, fs: ~law.target.local.LocalFileSystem = LocalFileSystem(name=local_fs, 0x79e402f0fa90), *, is_tmp: bool | str = False, tmp_dir: str | ~pathlib.Path | ~law.target.local.LocalDirectoryTarget | None = None, **kwargs)[source]#
Bases:
FileSystemTarget,LocalTarget- fs: FileSystem = LocalFileSystem(name=local_fs, 0x79e402f0fa90)#
- directory_class#
alias of
LocalDirectoryTarget
- file_class#
alias of
LocalFileTarget
Class LocalFileTarget#
- class LocalFileTarget(path: str | ~pathlib.Path | None = None, fs: ~law.target.local.LocalFileSystem = LocalFileSystem(name=local_fs, 0x79e402f0fa90), *, is_tmp: bool | str = False, tmp_dir: str | ~pathlib.Path | ~law.target.local.LocalDirectoryTarget | None = None, **kwargs)[source]#
Bases:
FileSystemFileTarget,LocalTarget
Class LocalDirectoryTarget#
- class LocalDirectoryTarget(path: str | ~pathlib.Path | None = None, fs: ~law.target.local.LocalFileSystem = LocalFileSystem(name=local_fs, 0x79e402f0fa90), *, is_tmp: bool | str = False, tmp_dir: str | ~pathlib.Path | ~law.target.local.LocalDirectoryTarget | None = None, **kwargs)[source]#
Bases:
FileSystemDirectoryTarget,LocalTarget