law.target.local#

Local target implementations.

Class LocalFileSystem#

class LocalFileSystem(section=None, base=None, **kwargs)[source]#

Bases: FileSystem, LocalFileSystem

exists(path, stat=False, **kwargs)[source]#

Return True if file or directory at path exist, False otherwise

Parameters:

path (str) – a path within the FileSystem to check for existence.

isdir(path, **kwargs)[source]#

Return True if the location at path is a directory. If not, return False.

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, recursive=True, silent=True, **kwargs)[source]#

Remove file or directory at location path

Parameters:
  • path (str) – a path within the FileSystem to remove.

  • recursive (bool) – if the path is a directory, recursively remove the directory and all of its descendants. Defaults to True.

mkdir(path, perm=None, recursive=True, silent=True, **kwargs)[source]#

Create directory at location path

Creates the directory at path and 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, pattern=None, type=None, **kwargs)[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.

copy(src, dst, perm=None, dir_perm=None, **kwargs)[source]#

Copy a file or a directory with contents. Currently, LocalFileSystem and MockFileSystem support only single file copying but S3Client copies either a file or a directory as required.

move(src, dst, perm=None, dir_perm=None, **kwargs)[source]#

Move a file, as one would expect.

Class LocalTarget#

class LocalTarget(path=None, fs=LocalFileSystem(name=local_fs, 0x7fe157c88eb0), is_tmp=False, tmp_dir=None, **kwargs)[source]#

Bases: FileSystemTarget, LocalTarget

fs = LocalFileSystem(name=local_fs, 0x7fe157c88eb0)#
directory_class#

alias of LocalDirectoryTarget

file_class#

alias of LocalFileTarget

Class LocalFileTarget#

class LocalFileTarget(path=None, fs=LocalFileSystem(name=local_fs, 0x7fe157c88eb0), is_tmp=False, tmp_dir=None, **kwargs)[source]#

Bases: FileSystemFileTarget, LocalTarget

Class LocalDirectoryTarget#

class LocalDirectoryTarget(path=None, fs=LocalFileSystem(name=local_fs, 0x7fe157c88eb0), is_tmp=False, tmp_dir=None, **kwargs)[source]#

Bases: FileSystemDirectoryTarget, LocalTarget