gfal#

GFAL file interface for remote target access.

Class GFALFileInterface#

class GFALFileInterface(*, atomic_contexts: bool = False, gfal_options: dict[str, Any] | None = None, transfer_config: dict[str, Any] | None = None, **kwargs)[source]#

Bases: RemoteFileInterface

exists(path: str | Path, *, stat: bool = False, base: str | Sequence[str] | None = None, **kwargs) bool | stat_result | None[source]#

Returns True when the path exists and False otherwise. When stat is True, returns the stat object or None.

stat(path: str | Path, *, base: str | Sequence[str] | None = None, **kwargs) stat_result[source]#

Returns a stat object or raises an exception when path does not exist.

isdir(path: str | Path, *, stat: stat_result | None = None, base: str | Sequence[str] | None = None, **kwargs) bool[source]#

Returns True when path refers to an existing directory, optionally using a precomputed stat object instead, and False otherwise.

isfile(path: str | Path, *, stat: stat_result | None = None, base: str | Sequence[str] | None = None, **kwargs) bool[source]#

Returns True when path refers to a existing file, optionally using a precomputed stat object instead, and False otherwise.

chmod(path: str | Path, perm: int, *, base: str | Sequence[str] | None = None, silent: bool = False, **kwargs) bool[source]#

Changes the permission of a path to perm. Raises an exception when path does not exist or returns False when silent is True, and returns True on success.

Removes a file at path. Raises an exception when path does not exist or returns False when silent is True, and returns True on success.

rmdir(path: str | Path, *, base: str | Sequence[str] | None = None, silent: bool = True, **kwargs) bool[source]#

Removes a directory at path. Raises an exception when path does not exist or returns False when silent is True, and returns True on success.

remove(path: str | Path, *, base: str | Sequence[str] | None = None, silent: bool = True, **kwargs) bool[source]#

Recursive removal is potentially expensive in terms of remote file operations, so this method is designed to reduce them as much as possible.

mkdir(path: str | Path, perm: int, *, base: str | Sequence[str] | None = None, silent: bool = True, **kwargs) bool[source]#

Creates a directory at path with permissions perm. Raises an exception when path already exists or returns False when silent is True, and returns True on success.

mkdir_rec(path: str | Path, perm: int, *, base: str | Sequence[str] | None = None, silent: bool = True, **kwargs) bool[source]#

Recursively creates a directory and intermediate missing directories at path with permissions perm. Raises an exception when path already exists or returns False when silent is True, and returns True on success.

listdir(path: str | Path, *, base: str | Sequence[str] | None = None, **kwargs) list[str][source]#

Returns a list of elements in and relative to path.

filecopy(src: str | Path, dst: str | Path, base: str | Sequence[str] | None = None, **kwargs) tuple[str, str][source]#

Copies a file from src to dst. Returns the full, schemed src and dst URIs used for copying in a 2-tuple.