fileloc#
- tollan.utils.fileloc.fileloc(loc: str | Path | tuple[str, str] | dict | FileLoc, remote_parent_path: None | str | Path = None, local_parent_path: None | str | Path = None, *, revalidate: bool = False) FileLoc[source]#
Return a validated
FileLocobject.- Parameters:
loc (str,
Path, tuple, dict,FileLoc) –The file location, either remote or local. It can take the form of the follows:
URL format string. This is parsed as URL.
Non-URL format string. In this case,
locis interpreted as a local path, or a remote path similar to sftp syntax:<hostname>:<abspath>. A remote relative path is not valid.Path. It is a local path.Tuple of
(<hostname>, <path>). It is a remote path, unlesshostnameis “localhost”. A remote relative path is not valid.FileLoc. It is used as-is ifrevalidateis false, and re-validated with thedataattribute otherwise.
local_parent_path (str,
Path, None) – If not None, this is used as the parent of local relative path. Otherwise, the current path (pwd) is used. Ignored iflocisFileLoc.remote_parent_path (str,
Path, None) – If not None and is absolute, this is used as the parent of remote relative path. Otherwise,ValueErrorwill be raised if a remote relative path is given. Ignored iflocisFileLoc.revalidate (bool) – If True and
locisFileLocobject, the data gets re-validated with new context.