fileloc¶
-
tollan.utils.
fileloc
(loc, local_parent_path=None, remote_parent_path=None)[source]¶ Return a
FileLoc
object.- Parameters
- locstr,
Path
, tuple,FileLoc
The location of the file, composed of the hostname and the path. It can take the form of the follows:
str
. In this case,loc
is interpreted as a local path, or a remote path similar to sftp syntax:<hostname>:<abspath>
. A remote relative path is not supported.Path
. It is a local path.Tuple of
(<hostname>, <abspath>)
. It is a remote path, unlesshostname
is “localhost”. A remote relative path is not supported.FileLoc
. It is returned unaltered.
- local_parent_pathstr,
Path
, None If not None, this is used as the parent of local relative path. Otherwise, the current path (
pwd
) is used. Ignored ifloc
isFileLoc
.- remote_parent_pathstr,
Path
, None If not None and is absolute, this is used as the parent of remote relative path. Otherwise,
ValueError
will be raised if a remote relative path is given. Ignored ifloc
isFileLoc
.
- locstr,