scitacean.RemotePath#
- class scitacean.RemotePath(*path_segments)[source]#
- A path on the remote filesystem. - Remote paths do not need to correspond to a regular filesystem path like - pathlib.PosixPathor- pathlib.WindowsPath. Instead, they can be any sequence of segments that are joined by forward slashes, e.g. a URL.- RemotePath is strict about input types in order to prompt the user to think about correct, cross-platform handling of paths. In particular, there is only limited interoperability with local paths as the two should almost never be mixed. - Constructors - __init__(*path_segments)- Initialize from given path segments. - Methods - from_local(path)- Create a RemotePath from a local, OS-specific path. - Return True if the path is absolute. - is_relative_to(other)- Check whether this path is relative to another. - resolve()- Resolve any parent segments in a path. - to_local()- Return self as a local, OS-specific path. - truncated([max_length])- Return a new remote path with all path segments truncated. - validate(value)- Pydantic validator for RemotePath fields. - Attributes - The name of the file with all directories removed. - The logical parent of the path. - Return the path for use on a POSIX filesystem, i.e. with forward slashes. - The file extension including a leading period. - classmethod from_local(path)[source]#
- Create a RemotePath from a local, OS-specific path. - On Windows, the drive is preserved which is likely not what you want. So it is recommended to use this function only with relative paths. - Return type:
 
 - property parent: RemotePath#
- The logical parent of the path. 
 - resolve()[source]#
- Resolve any parent segments in a path. - This does not resolve symlinks or the current working directory like - pathlib.Path.resolve().- Returns:
- RemotePath– A new remote path with resolved parent segments.
 
 - to_local()[source]#
- Return self as a local, OS-specific path. - This returns only the file name, discarding all parent path segments. - Return type:
 
 - truncated(max_length=255)[source]#
- Return a new remote path with all path segments truncated. - Parameters:
- max_length ( - int, default:- 255) – Maximum length of each segment. The default value is the typical maximum length on Linux.
- Returns:
- RemotePath– A new remote path with truncated segments.