xqute.path
Provides the SpecPath and MountedPath classes.
It is used to represent paths of jobs and it is useful when a job is running in a remote system (a VM, a container, etc.), where we need to mount the paths into the remote system (MountedPath).
But in the system where this framework is running, we need to use the paths (specified directly) that are used in the framework, where we also need to carry the information of the mounted path (SpecPath).
The module provides two main abstract base classes:
- -
MountedPath: Represents a path as it appears in the remote execution environment. - -
SpecPath: Represents a path as it appears in the local environment where the
Both classes have implementations for local paths and various cloud storage paths, including:
- - Google Cloud Storage
- - Azure Blob Storage
- - Amazon S3
These classes maintain the relationship between the local and remote pathrepresentations, allowing transparent path operations while preserving both path contexts.
MountedPath(MountedPath) — A router class to instantiate the correct path based on the path typefor the mounted path. </>MountedLocalPath(MountedPath) — A class to represent a mounted local path</>MountedCloudPath(path,spec,*args,**kwargs)(MountedPath) — A class to represent a mounted cloud path</>MountedGSPath(MountedPath) — A class to represent a mounted Google Cloud Storage path</>MountedAzurePath(MountedPath) — A class to represent a mounted Azure Blob Storage path</>MountedS3Path(MountedPath) — A class to represent a mounted Amazon S3 path</>SpecPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A router class to instantiate the correct path based on the path typefor the spec path. </>SpecLocalPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec local path</>SpecCloudPath(path,*args,mounted,**kwargs)(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec cloud path</>SpecGSPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Google Cloud Storage path</>SpecAzurePath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Azure Blob Storage path</>SpecS3Path(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Amazon S3 path</>
xqute.path.MountedPath(path, spec=None, *args, **kwargs) → MountedPath
A router class to instantiate the correct path based on the path typefor the mounted path.
This abstract base class serves as a factory that creates appropriate mounted path instances based on the input path type. It represents a path as it exists in a remote execution environment (e.g., container, VM) while maintaining a reference to the corresponding path in the local environment.
_spec— The corresponding path in the local environment (SpecPath).anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> # Create a mounted path with corresponding spec path>>> mounted_path = MountedPath(
>>> "/container/data/file.txt", spec="/local/data/file.txt"
>>> )
>>> str(mounted_path)
'/container/data/file.txt'
>>> str(mounted_path.spec)
'/local/data/file.txt'
>>> # Create a GCS mounted path
>>> gs_path = MountedPath("gs://bucket/file.txt", spec="/local/file.txt")
>>> type(gs_path)
<class 'xqute.path.MountedGSPath'>
>>> # Serialize and deserialize a mounted path
>>> import pickle
>>> mounted_path = MountedPath("/container/data/file.txt",
... spec="/local/data/file.txt")
>>> serialized = pickle.dumps(mounted_path)
>>> restored = pickle.loads(serialized)
>>> str(restored) == str(mounted_path)
True
>>> str(restored.spec) == str(mounted_path.spec)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target)(PanPath) — Asynchronously copy this path to the target path.</>a_copytree(target,follow_symlinks)(PanPath) — Asynchronously copy the directory and all its contents recursively to the target path.</>a_exists()(bool) — Asynchronously check if the path exists.</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a glob pattern.</>a_is_dir()(bool) — Asynchronously check if the path is a directory.</>a_is_file()(bool) — Asynchronously check if the path is a file.</>a_is_symlink()(bool) — Asynchronously check if the path is a symbolic link.</>a_iterdir()(AsyncGenerator) — Asynchronously iterate over directory contents.</>a_mkdir(mode,parents,exist_ok)— Asynchronously create a directory at this path.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Asynchronously open the file and return an async file handle.</>a_read_bytes()(bytes) — Asynchronously read the file's bytes.</>a_read_text(encoding)(str) — Asynchronously read the file's text content.</>a_readlink()(PanPath) — Asynchronously read the target of the symbolic link.</>a_rename(target)(PanPath) — Asynchronously rename this path to the target path.</>a_replace(target)(PanPath) — Asynchronously replace this path with the target path.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a recursive glob pattern.</>a_rmdir()— Asynchronously remove the directory and its contents recursively.</>a_rmtree(ignore_errors,onerror)— Asynchronously remove the directory and all its contents recursively.</>a_stat(follow_symlinks)(stat_result) — Asynchronously get the file or directory's status information.</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to the target path.</>a_touch(mode,exist_ok)— Asynchronously create the file if it does not exist.</>a_unlink(missing_ok)— Asynchronously remove (delete) the file or empty directory.</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(Optional) — Asynchronously write bytes to the file.</>a_write_text(data,encoding)(int) — Asynchronously write text to the file.</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)— Rename this path to the target path.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove this directory. The directory must be empty.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk()— Walk the directory tree.</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
read_bytes()
Open the file in bytes mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_read_bytes()
Asynchronously read the file's bytes.
File content as bytes.
a_read_text(encoding='utf-8')
Asynchronously read the file's text content.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
File content as string.
a_write_bytes(data)
Asynchronously write bytes to the file.
data(bytes) — Bytes to write to the file.
Number of bytes written. For some cloud paths, may return None.
a_write_text(data, encoding='utf-8')
Asynchronously write text to the file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Number of characters written.
Asynchronously create a directory at this path.
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_is_symlink()
Asynchronously check if the path is a symbolic link.
For local path, this checks if the path is a symlink. For cloud paths, this will check if the object has a metdata flag indicating it's a symlink. Note that it is not a real symlink like in local filesystems. But for example, gcsfuse supports symlink-like behavior via metadata.
True if the path is a symlink, False otherwise.
a_readlink()
Asynchronously read the target of the symbolic link.
For local path, this reads the symlink target. For cloud paths, this reads the metadata flag indicating the symlink target.
The target PanPath of the symlink.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to the target path.
For local path, this creates a real symlink. For cloud paths, this sets a metadata flag indicating the symlink target.
target(Union) — The target PanPath the symlink points to.target_is_directory(bool, optional) — Whether the target is a directory (ignored for cloud paths).
a_copytree(target, follow_symlinks=True)
Asynchronously copy the directory and all its contents recursively to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
Asynchronously open the file and return an async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(str, optional) — Text encoding to use (default: 'utf-8').**kwargs(Any) — Additional arguments to pass to the underlying open method.
An async file handle.
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
xqute.path.MountedLocalPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted local path
This class represents a path in a local filesystem as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>a_exists()(bool) — Check if path exists (async).</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching the glob pattern.</>a_is_dir()(bool) — Check if path is a directory (async).</>a_is_file()(bool) — Check if path is a file (async).</>a_is_symlink()(bool) — Check if path is a symlink (async).</>a_iterdir()(AsyncGenerator) — List directory contents (async).</>a_mkdir(mode,parents,exist_ok)— Create directory (async).</>a_open(mode,buffering,encoding,errors,newline)(Any) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes (async).</>a_read_text(encoding)(str) — Read file as text (async).</>a_readlink()(LocalPath) — Asynchronously read the target of a symbolic link.</>a_rename(target)(PanPath) — Rename the file or directory to target.</>a_replace(target)(PanPath) — Rename the file or directory to target, overwriting if target exists.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively yield all existing files matching the given pattern.</>a_rmdir()— Remove empty directory (async).</>a_rmtree()— Recursively remove directory and its contents (async).</>a_stat(follow_symlinks)(stat_result) — Get file stats (async).</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to target.</>a_touch(mode,exist_ok)— Create the file if it does not exist or update the modification time (async).</>a_unlink(missing_ok)— Delete file (async).</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(int) — Write bytes to file (async).</>a_write_text(data,encoding)(int) — Write text to file (async).</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(PanPath) — Copy file to target.</>copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(PanPath) — Rename the file or directory to target.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove empty directory.</>rmtree()— Recursively remove directory and its contents.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk(*args,**kwargs)(Iterator) — Walk the directory tree.</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
read_bytes()
Open the file in bytes mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_readlink()
Asynchronously read the target of a symbolic link.
The path to which the symbolic link points.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to target.
target(Union) — The target path the symbolic link points to.target_is_directory(bool, optional) — Whether the target is a directory.
a_read_bytes() → bytes
Read file as bytes (async).
a_read_text(encoding='utf-8') → str
Read file as text (async).
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data) → int
Write bytes to file (async).
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file (async).
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_is_symlink() → bool
Check if path is a symlink (async).
Create directory (async).
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
Open file and return async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(Optional, optional) — Text encoding to use (default: 'utf-8').
Async file handle from aiofiles
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
xqute.path.MountedCloudPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted cloud path
This class represents a cloud storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
a_write_bytes(data)
Write bytes to file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedGSPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedAzurePath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedS3Path(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Amazon S3 path
This class represents an Amazon S3 path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A router class to instantiate the correct path based on the path typefor the spec path.
This abstract base class serves as a factory that creates appropriate spec path instances based on the input path type. It represents a path in the local environment where the framework runs, while maintaining a reference to the corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target)(PanPath) — Asynchronously copy this path to the target path.</>a_copytree(target,follow_symlinks)(PanPath) — Asynchronously copy the directory and all its contents recursively to the target path.</>a_exists()(bool) — Asynchronously check if the path exists.</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a glob pattern.</>a_is_dir()(bool) — Asynchronously check if the path is a directory.</>a_is_file()(bool) — Asynchronously check if the path is a file.</>a_is_symlink()(bool) — Asynchronously check if the path is a symbolic link.</>a_iterdir()(AsyncGenerator) — Asynchronously iterate over directory contents.</>a_mkdir(mode,parents,exist_ok)— Asynchronously create a directory at this path.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Asynchronously open the file and return an async file handle.</>a_read_bytes()(bytes) — Asynchronously read the file's bytes.</>a_read_text(encoding)(str) — Asynchronously read the file's text content.</>a_readlink()(PanPath) — Asynchronously read the target of the symbolic link.</>a_rename(target)(PanPath) — Asynchronously rename this path to the target path.</>a_replace(target)(PanPath) — Asynchronously replace this path with the target path.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a recursive glob pattern.</>a_rmdir()— Asynchronously remove the directory and its contents recursively.</>a_rmtree(ignore_errors,onerror)— Asynchronously remove the directory and all its contents recursively.</>a_stat(follow_symlinks)(stat_result) — Asynchronously get the file or directory's status information.</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to the target path.</>a_touch(mode,exist_ok)— Asynchronously create the file if it does not exist.</>a_unlink(missing_ok)— Asynchronously remove (delete) the file or empty directory.</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(Optional) — Asynchronously write bytes to the file.</>a_write_text(data,encoding)(int) — Asynchronously write text to the file.</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)— Rename this path to the target path.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove this directory. The directory must be empty.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk()— Walk the directory tree.</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
read_bytes()
Open the file in bytes mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_read_bytes()
Asynchronously read the file's bytes.
File content as bytes.
a_read_text(encoding='utf-8')
Asynchronously read the file's text content.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
File content as string.
a_write_bytes(data)
Asynchronously write bytes to the file.
data(bytes) — Bytes to write to the file.
Number of bytes written. For some cloud paths, may return None.
a_write_text(data, encoding='utf-8')
Asynchronously write text to the file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Number of characters written.
Asynchronously create a directory at this path.
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_is_symlink()
Asynchronously check if the path is a symbolic link.
For local path, this checks if the path is a symlink. For cloud paths, this will check if the object has a metdata flag indicating it's a symlink. Note that it is not a real symlink like in local filesystems. But for example, gcsfuse supports symlink-like behavior via metadata.
True if the path is a symlink, False otherwise.
a_readlink()
Asynchronously read the target of the symbolic link.
For local path, this reads the symlink target. For cloud paths, this reads the metadata flag indicating the symlink target.
The target PanPath of the symlink.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to the target path.
For local path, this creates a real symlink. For cloud paths, this sets a metadata flag indicating the symlink target.
target(Union) — The target PanPath the symlink points to.target_is_directory(bool, optional) — Whether the target is a directory (ignored for cloud paths).
a_copytree(target, follow_symlinks=True)
Asynchronously copy the directory and all its contents recursively to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
Asynchronously open the file and return an async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(str, optional) — Text encoding to use (default: 'utf-8').**kwargs(Any) — Additional arguments to pass to the underlying open method.
An async file handle.
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
xqute.path.SpecLocalPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec local path
This class represents a path in the local filesystem as it appears in the framework's environment, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>a_exists()(bool) — Check if path exists (async).</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching the glob pattern.</>a_is_dir()(bool) — Check if path is a directory (async).</>a_is_file()(bool) — Check if path is a file (async).</>a_is_symlink()(bool) — Check if path is a symlink (async).</>a_iterdir()(AsyncGenerator) — List directory contents (async).</>a_mkdir(mode,parents,exist_ok)— Create directory (async).</>a_open(mode,buffering,encoding,errors,newline)(Any) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes (async).</>a_read_text(encoding)(str) — Read file as text (async).</>a_readlink()(LocalPath) — Asynchronously read the target of a symbolic link.</>a_rename(target)(PanPath) — Rename the file or directory to target.</>a_replace(target)(PanPath) — Rename the file or directory to target, overwriting if target exists.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively yield all existing files matching the given pattern.</>a_rmdir()— Remove empty directory (async).</>a_rmtree()— Recursively remove directory and its contents (async).</>a_stat(follow_symlinks)(stat_result) — Get file stats (async).</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to target.</>a_touch(mode,exist_ok)— Create the file if it does not exist or update the modification time (async).</>a_unlink(missing_ok)— Delete file (async).</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(int) — Write bytes to file (async).</>a_write_text(data,encoding)(int) — Write text to file (async).</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(PanPath) — Copy file to target.</>copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(PanPath) — Rename the file or directory to target.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove empty directory.</>rmtree()— Recursively remove directory and its contents.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk(*args,**kwargs)(Iterator) — Walk the directory tree.</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
read_bytes()
Open the file in bytes mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_readlink()
Asynchronously read the target of a symbolic link.
The path to which the symbolic link points.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to target.
target(Union) — The target path the symbolic link points to.target_is_directory(bool, optional) — Whether the target is a directory.
a_read_bytes() → bytes
Read file as bytes (async).
a_read_text(encoding='utf-8') → str
Read file as text (async).
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data) → int
Write bytes to file (async).
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file (async).
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_is_symlink() → bool
Check if path is a symlink (async).
Create directory (async).
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
Open file and return async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(Optional, optional) — Text encoding to use (default: 'utf-8').
Async file handle from aiofiles
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
xqute.path.SpecCloudPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec cloud path
This class represents a cloud storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
a_write_bytes(data)
Write bytes to file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
path(str | pathlib.path) — The path string or object representing the spec path.*args(Any) — Additional positional arguments passed to the path constructor.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.**kwargs(Any) — Additional keyword arguments passed to the path constructor.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecGSPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecAzurePath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecS3Path(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Amazon S3 path
This class represents an Amazon S3 path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(asyncclient) — Get or create the async client for this path.</>client(syncclient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(cloudpath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(panpath) — Copy file to target.</>a_copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(asyncfilehandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(cloudpath) — Read symlink target from metadata.</>a_rename(target)(cloudpath) — Rename/move file to target.</>a_replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>a_resolve()(panpath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(cloudpath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(cloudpath) — Copy file to target.</>copytree(target,follow_symlinks)(cloudpath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()— Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(cloudpath) — Read symlink target from metadata.</>relative_to(other)(path) — Return relative path to other.</>rename(target)(cloudpath) — Rename/move file to target.</>replace(target)(cloudpath) — Replace file at target (overwriting if exists).</>resolve()(cloudpath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → cloudpath
Right join paths while preserving type and client.
read_bytes() → bytes
Read file as bytes.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
is_absolute() → bool
Cloud paths are always absolute.
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
relative_to(other)
Return relative path to other.
other(Union) — Path to which this path should be relative
Relative path as LocalPath
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.