Skip to content

xqute.path

module

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
framework runs.

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.

Classes
  • MountedPath (xqute.path.mountedlocalpath | xqute.path.mountedcloudpath) A router class to instantiate the correct path based on the path typefor the mounted path. </>
  • MountedLocalPath A class to represent a mounted local path</>
  • MountedCloudPath(cloud_path, *args, **kwargs) (Union) A class to represent a mounted cloud path</>
  • MountedGSPath (Union) A class to represent a mounted Google Cloud Storage path</>
  • MountedAzureBlobPath (Union) A class to represent a mounted Azure Blob Storage path</>
  • MountedS3Path (Union) 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 A class to represent a spec local path</>
  • SpecCloudPath(cloud_path, *args, **kwargs) (Union) A class to represent a spec cloud path</>
  • SpecGSPath (Union) A class to represent a spec Google Cloud Storage path</>
  • SpecAzureBlobPath (Union) A class to represent a spec Azure Blob Storage path</>
  • SpecS3Path (Union) A class to represent a spec Amazon S3 path</>
class

xqute.path.MountedPath(path, spec=None, *args, **kwargs) → xqute.path.mountedlocalpath | xqute.path.mountedcloudpath

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.

Attributes
  • _spec The corresponding path in the local environment (SpecPath).
  • spec Get the corresponding spec path in the local environment.</>
Examples
>>> # 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'>
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __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.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • is_mounted() (bool) Check if this path is actually mounted (different from spec path).</>
staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Factory method to create the appropriate MountedPath subclass instance.

Parameters
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the mounted path location.
  • spec (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | 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.
Returns (An instance of the appropriate MountedPath subclass based on the path type)

ss s s

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

class

xqute.path.MountedLocalPath(path, spec=None, *args, **kwargs)

Bases
xqute.path.MountedPath abc.ABC pathlib.PosixPath pathlib.Path pathlib.PurePosixPath pathlib.PurePath

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.

Attributes
  • _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'] </>
Examples
>>> mounted_path = MountedLocalPath("/container/data/file.txt",...                               spec="/local/data/file.txt")
>>> str(mounted_path)
'/container/data/file.txt'
>>> str(mounted_path.spec)
'/local/data/file.txt'
>>> mounted_path.name
'file.txt'
Classes
  • ABCMeta Metaclass for defining Abstract Base Classes (ABCs).</>
Methods
  • __bytes__() Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>
  • __eq__(other) (bool) Check equality with another path object.</>
  • __new__(cls, path, spec, *args, **kwargs) Create a new MountedLocalPath instance.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • __str__() Return the string representation of the path, suitable forpassing to system calls. </>
  • __truediv__(key) (MountedPath) Implement the / operator for paths.</>
  • 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) </>
  • 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 to 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(top_down, on_error, follow_symlinks) Walk the directory tree from this directory, similar to os.walk().</>
  • with_name(name) (MountedPath) Return a new path with the name changed.</>
  • with_segments(*pathsegments) (MountedPath) Create a new path by replacing all segments with the given segments.</>
  • 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.</>
method

__str__()

Return the string representation of the path, suitable forpassing to system calls.

method

as_posix()

Return the string representation of the path with forward (/)slashes.

method

__bytes__()

Return the bytes representation of the path. This is onlyrecommended to use under Unix.

method

as_uri()

Return the path as a 'file' URI.

method

with_stem(stem)

Return a new path with the stem changed.

method

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.

method

is_relative_to(other, *_deprecated)

Return True if the path is relative to another path or False.

method

is_absolute()

True if the path is absolute (has both a root and, if applicable,a drive).

method

is_reserved()

Return True if the path contains one of the special names reservedby the system, if any.

method

match(path_pattern, case_sensitive=None)

Return True if this path matches the given pattern.

method

stat(follow_symlinks=True)

Return the result of the stat() system call on this path, likeos.stat() does.

method

lstat()

Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.

method

exists(follow_symlinks=True)

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.

method

is_dir()

Whether this path is a directory.

method

is_file()

Whether this path is a regular file (also True for symlinks pointingto regular files).

method

is_mount()

Check if this path is a mount point

method

is_junction()

Whether this path is a junction.

method

is_block_device()

Whether this path is a block device.

method

is_char_device()

Whether this path is a character device.

method

is_fifo()

Whether this path is a FIFO.

method

is_socket()

Whether this path is a socket.

method

samefile(other_path)

Return whether other_path is the same or not as this file(as returned by os.path.samefile()).

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)

Open the file pointed to by this path and return a file object, asthe built-in open() function does.

method

read_bytes()

Open the file in bytes mode, read it, and close the file.

method

read_text(encoding=None, errors=None)

Open the file in text mode, read it, and close the file.

method

write_bytes(data)

Open the file in bytes mode, write to it, and close the file.

method

write_text(data, encoding=None, errors=None, newline=None)

Open the file in text mode, write to it, and close the file.

generator

iterdir()

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.

generator

glob(pattern, case_sensitive=None)

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.

generator

rglob(pattern, case_sensitive=None)

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.

generator

walk(top_down=True, on_error=None, follow_symlinks=False)

Walk the directory tree from this directory, similar to os.walk().

classmethod

cwd()

Return a new path pointing to the current working directory.

classmethod

home()

Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).

method

absolute()

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file.

method

resolve(strict=False)

Make the path absolute, resolving all symlinks on the way and alsonormalizing it.

method

owner()

Return the login name of the file owner.

method

group()

Return the group name of the file gid.

method

touch(mode=438, exist_ok=True)

Create this file with the given access mode, if it doesn't exist.

method

mkdir(mode=511, parents=False, exist_ok=False)

Create a new directory at this given path.

method

chmod(mode, follow_symlinks=True)

Change the permissions of the path, like os.chmod().

method

lchmod(mode)

Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.

method

rmdir()

Remove this directory. The directory must be empty.

method

rename(target)

Rename this path to the target path.

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.

method

replace(target)

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.

method

expanduser()

Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)

class

abc.ABCMeta(name, bases, namespace, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Create a new MountedLocalPath instance.

Parameters
  • *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 local path.
  • 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.
Returns

A new MountedLocalPath instance.

method

with_segments(*pathsegments)

Create a new path by replacing all segments with the given segments.

Parameters
  • *pathsegments The path segments to use in the new path.
Returns (MountedPath)

A new mounted path with the specified segments.

Raises
  • NotImplementedError If Python version is lower than 3.10.
method

with_name(name)

Return a new path with the name changed.

Parameters
  • name The new name for the path.
Returns (MountedPath)

A new mounted path with the name changed in both the mounted path and spec path.

method

with_suffix(suffix)

Return a new path with the suffix changed.

Parameters
  • suffix The new suffix for the path.
Returns (MountedPath)

A new mounted path with the suffix changed in both the mounted path and spec path.

method

joinpath(*pathsegments)

Join path components to this path.

Parameters
  • *pathsegments The path segments to append to this path.
Returns (MountedPath)

A new mounted path with the segments appended to both the mounted path and spec path.

method

__truediv__(key)

Implement the / operator for paths.

Parameters
  • key The path segment to append to this path.
Returns (MountedPath)

A new mounted path with the segment appended.

abstract class

xqute.path.MountedCloudPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.MountedPath abc.ABC cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _spec The corresponding path in the local environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • spec Get the corresponding spec path in the local environment.</>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> mounted_path = MountedPath("gs://bucket/file.txt",...                          spec="gs://local-bucket/file.txt")
>>> str(mounted_path)
'gs://bucket/file.txt'
>>> str(mounted_path.spec)
'gs://local-bucket/file.txt'
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, spec, *args, **kwargs) Create a new MountedCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • __truediv__(other) (MountedPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_mounted() (bool) Check if this path is actually mounted (different from spec path).</>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat(follow_symlinks) (stat_result) Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

abstract method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

abstract method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

stat(follow_symlinks=True) → stat_result

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Create a new MountedCloudPath instance.

Parameters
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the mounted cloud path.
  • spec (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | 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.
Returns

A new MountedCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (MountedPath)

A new mounted cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.MountedGSPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.MountedCloudPath xqute.path.MountedPath abc.ABC yunpath.patch.GSPath cloudpathlib.gs.gspath.GSPath cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _spec The corresponding path in the local environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • spec Get the corresponding spec path in the local environment.</>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> mounted_path = MountedPath("gs://bucket/file.txt",...                          spec="gs://local-bucket/file.txt")
>>> isinstance(mounted_path, MountedGSPath)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, spec, *args, **kwargs) Create a new MountedCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • __truediv__(other) (MountedPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_mounted() (bool) Check if this path is actually mounted (different from spec path).</>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

generator

iterdir()

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Create a new MountedCloudPath instance.

Parameters
  • *args (Any) Additional positional arguments passed to the path constructor.
  • **kwargs (Any) Additional keyword arguments passed to the path constructor.
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the mounted cloud path.
  • spec (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | 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.
Returns

A new MountedCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (MountedPath)

A new mounted cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.MountedAzureBlobPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.MountedCloudPath xqute.path.MountedPath abc.ABC cloudpathlib.azure.azblobpath.AzureBlobPath cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _spec The corresponding path in the local environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • spec Get the corresponding spec path in the local environment.</>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> mounted_path = MountedPath("az://container/blob",...                          spec="az://local-container/blob")
>>> isinstance(mounted_path, MountedAzureBlobPath)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, spec, *args, **kwargs) Create a new MountedCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • __truediv__(other) (MountedPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_mounted() (bool) Check if this path is actually mounted (different from spec path).</>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (AzureBlobPath) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

replace(target) → AzureBlobPath

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. (Docstring copied from pathlib.Path)

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Create a new MountedCloudPath instance.

Parameters
  • *args (Any) Additional positional arguments passed to the path constructor.
  • **kwargs (Any) Additional keyword arguments passed to the path constructor.
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the mounted cloud path.
  • spec (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | 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.
Returns

A new MountedCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (MountedPath)

A new mounted cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.MountedS3Path(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.MountedCloudPath xqute.path.MountedPath abc.ABC cloudpathlib.s3.s3path.S3Path cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _spec The corresponding path in the local environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • spec Get the corresponding spec path in the local environment.</>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> mounted_path = MountedPath("s3://bucket/key",...                          spec="s3://local-bucket/key")
>>> isinstance(mounted_path, MountedS3Path)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, spec, *args, **kwargs) Create a new MountedCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the MountedPath.</>
  • __truediv__(other) (MountedPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_mounted() (bool) Check if this path is actually mounted (different from spec path).</>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

is_mounted()

Check if this path is actually mounted (different from spec path).

Returns (bool)

True if the mounted path is different from the spec path, Falseotherwise.

method

__repr__()

Generate a string representation of the MountedPath.

Returns (str)

A string showing the class name, path, and spec path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, spec=None, *args, **kwargs)

Create a new MountedCloudPath instance.

Parameters
  • *args (Any) Additional positional arguments passed to the path constructor.
  • **kwargs (Any) Additional keyword arguments passed to the path constructor.
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the mounted cloud path.
  • spec (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | 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.
Returns

A new MountedCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (MountedPath)

A new mounted cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.SpecPath(path, mounted=None, *args, **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.

Attributes
  • _mounted The corresponding path in the remote execution environment.
  • mounted Get the corresponding mounted path in the remote environment.</>
Examples
>>> # Create a spec path with corresponding mounted path>>> spec_path = SpecPath(
>>>   "/local/data/file.txt", mounted="/container/data/file.txt"
>>> )
>>> str(spec_path)
'/local/data/file.txt'
>>> str(spec_path.mounted)
'/container/data/file.txt'
>>> # Create a GCS spec path
>>> gs_path = SpecPath(
>>>   "gs://bucket/file.txt", mounted="gs://container-bucket/file.txt"
>>> )
>>> type(gs_path)
<class 'xqute.path.SpecGSPath'>
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __new__(cls, path, mounted, *args, **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.</>
staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Factory method to create the appropriate SpecPath subclass instance.

Parameters
  • path (str | pathlib.path | cloudpathlib.cloudpath.cloudpath) The path string or object representing the spec path.
  • mounted (str | pathlib.path | cloudpathlib.cloudpath.cloudpath | none, optional) The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
  • *args (Any) Additional positional arguments passed to the path constructor.
  • **kwargs (Any) Additional keyword arguments passed to the path constructor.
Returns (An instance of the appropriate SpecPath subclass based on the path type)

ss s s

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

class

xqute.path.SpecLocalPath(path, mounted=None, *args, **kwargs)

Bases
xqute.path.SpecPath abc.ABC pathlib.PosixPath pathlib.Path pathlib.PurePosixPath pathlib.PurePath

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.

Attributes
  • _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'] </>
Examples
>>> spec_path = SpecLocalPath("/local/data/file.txt",...                         mounted="/container/data/file.txt")
>>> str(spec_path)
'/local/data/file.txt'
>>> str(spec_path.mounted)
'/container/data/file.txt'
>>> spec_path.name
'file.txt'
Classes
  • ABCMeta Metaclass for defining Abstract Base Classes (ABCs).</>
Methods
  • __bytes__() Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>
  • __eq__(other) (bool) Check equality with another path object.</>
  • __new__(cls, path, mounted, *args, **kwargs) Create a new SpecLocalPath 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.</>
  • 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) </>
  • 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 to 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(top_down, on_error, follow_symlinks) Walk the directory tree from this directory, similar to os.walk().</>
  • with_name(name) (SpecPath) Return a new path with the name changed.</>
  • with_segments(*pathsegments) (SpecPath) Create a new path by replacing all segments with the given segments.</>
  • 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.</>
method

__str__()

Return the string representation of the path, suitable forpassing to system calls.

method

as_posix()

Return the string representation of the path with forward (/)slashes.

method

__bytes__()

Return the bytes representation of the path. This is onlyrecommended to use under Unix.

method

as_uri()

Return the path as a 'file' URI.

method

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.

method

is_relative_to(other, *_deprecated)

Return True if the path is relative to another path or False.

method

is_absolute()

True if the path is absolute (has both a root and, if applicable,a drive).

method

is_reserved()

Return True if the path contains one of the special names reservedby the system, if any.

method

match(path_pattern, case_sensitive=None)

Return True if this path matches the given pattern.

method

stat(follow_symlinks=True)

Return the result of the stat() system call on this path, likeos.stat() does.

method

lstat()

Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.

method

exists(follow_symlinks=True)

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.

method

is_dir()

Whether this path is a directory.

method

is_file()

Whether this path is a regular file (also True for symlinks pointingto regular files).

method

is_mount()

Check if this path is a mount point

method

is_junction()

Whether this path is a junction.

method

is_block_device()

Whether this path is a block device.

method

is_char_device()

Whether this path is a character device.

method

is_fifo()

Whether this path is a FIFO.

method

is_socket()

Whether this path is a socket.

method

samefile(other_path)

Return whether other_path is the same or not as this file(as returned by os.path.samefile()).

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)

Open the file pointed to by this path and return a file object, asthe built-in open() function does.

method

read_bytes()

Open the file in bytes mode, read it, and close the file.

method

read_text(encoding=None, errors=None)

Open the file in text mode, read it, and close the file.

method

write_bytes(data)

Open the file in bytes mode, write to it, and close the file.

method

write_text(data, encoding=None, errors=None, newline=None)

Open the file in text mode, write to it, and close the file.

generator

iterdir()

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.

generator

glob(pattern, case_sensitive=None)

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.

generator

rglob(pattern, case_sensitive=None)

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.

generator

walk(top_down=True, on_error=None, follow_symlinks=False)

Walk the directory tree from this directory, similar to os.walk().

classmethod

cwd()

Return a new path pointing to the current working directory.

classmethod

home()

Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).

method

absolute()

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file.

method

resolve(strict=False)

Make the path absolute, resolving all symlinks on the way and alsonormalizing it.

method

owner()

Return the login name of the file owner.

method

group()

Return the group name of the file gid.

method

touch(mode=438, exist_ok=True)

Create this file with the given access mode, if it doesn't exist.

method

mkdir(mode=511, parents=False, exist_ok=False)

Create a new directory at this given path.

method

chmod(mode, follow_symlinks=True)

Change the permissions of the path, like os.chmod().

method

lchmod(mode)

Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.

method

rmdir()

Remove this directory. The directory must be empty.

method

rename(target)

Rename this path to the target path.

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.

method

replace(target)

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.

method

expanduser()

Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)

class

abc.ABCMeta(name, bases, namespace, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Create a new SpecLocalPath instance.

Parameters
  • *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 local 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.
Returns

A new SpecLocalPath instance.

method

with_segments(*pathsegments)

Create a new path by replacing all segments with the given segments.

Parameters
  • *pathsegments The path segments to use in the new path.
Returns (SpecPath)

A new spec path with the specified segments.

method

with_name(name)

Return a new path with the name changed.

Parameters
  • name The new name for the path.
Returns (SpecPath)

A new spec path with the name changed in both the spec path and mounted path.

method

with_suffix(suffix)

Return a new path with the suffix changed.

Parameters
  • suffix The new suffix for the path.
Returns (SpecPath)

A new spec path with the suffix changed in both the spec path and mounted path.

method

with_stem(stem)

Return a new path with the stem changed.

The stem is the filename without the suffix.

Parameters
  • stem The new stem for the path.
Returns (SpecPath)

A new spec path with the stem changed in both the spec path and mounted path.

method

joinpath(*pathsegments)

Join path components to this path.

Parameters
  • *pathsegments The path segments to append to this path.
Returns (SpecPath)

A new spec path with the segments appended to both the spec path and mounted path.

method

__truediv__(key)

Implement the / operator for paths.

Parameters
  • key The path segment to append to this path.
Returns (SpecPath)

A new spec path with the segment appended.

abstract class

xqute.path.SpecCloudPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.SpecPath abc.ABC cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _mounted The corresponding path in the remote execution environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • mounted Get the corresponding mounted path in the remote environment.</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> spec_path = SpecPath("gs://bucket/file.txt",...                    mounted="gs://container-bucket/file.txt")
>>> str(spec_path)
'gs://bucket/file.txt'
>>> str(spec_path.mounted)
'gs://container-bucket/file.txt'
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, mounted, *args, **kwargs) Create a new SpecCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the SpecPath.</>
  • __truediv__(other) (SpecPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat(follow_symlinks) (stat_result) Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

abstract method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

abstract method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

stat(follow_symlinks=True) → stat_result

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Create a new SpecCloudPath instance.

Parameters
  • path (str | pathlib.path) The path string or object representing the spec cloud 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.
  • *args (Any) Additional positional arguments passed to the path constructor.
  • **kwargs (Any) Additional keyword arguments passed to the path constructor.
Returns

A new SpecCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (SpecPath)

A new spec cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.SpecGSPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.SpecCloudPath xqute.path.SpecPath abc.ABC yunpath.patch.GSPath cloudpathlib.gs.gspath.GSPath cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _mounted The corresponding path in the remote execution environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • mounted Get the corresponding mounted path in the remote environment.</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> spec_path = SpecPath("gs://bucket/file.txt",...                    mounted="gs://container-bucket/file.txt")
>>> isinstance(spec_path, SpecGSPath)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, mounted, *args, **kwargs) Create a new SpecCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the SpecPath.</>
  • __truediv__(other) (SpecPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

generator

iterdir()

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Create a new SpecCloudPath instance.

Parameters
  • *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 cloud 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.
Returns

A new SpecCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (SpecPath)

A new spec cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.SpecAzureBlobPath(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.SpecCloudPath xqute.path.SpecPath abc.ABC cloudpathlib.azure.azblobpath.AzureBlobPath cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _mounted The corresponding path in the remote execution environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • mounted Get the corresponding mounted path in the remote environment.</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> spec_path = SpecPath("az://container/blob",...                    mounted="az://remote-container/blob")
>>> isinstance(spec_path, SpecAzureBlobPath)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, mounted, *args, **kwargs) Create a new SpecCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the SpecPath.</>
  • __truediv__(other) (SpecPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (AzureBlobPath) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

replace(target) → AzureBlobPath

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. (Docstring copied from pathlib.Path)

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Create a new SpecCloudPath instance.

Parameters
  • *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 cloud 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.
Returns

A new SpecCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (SpecPath)

A new spec cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)

class

xqute.path.SpecS3Path(cloud_path, *args, **kwargs) → Union

Bases
xqute.path.SpecCloudPath xqute.path.SpecPath abc.ABC cloudpathlib.s3.s3path.S3Path cloudpathlib.cloudpath.CloudPath

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.

Attributes
  • _mounted The corresponding path in the remote execution environment.
  • anchor (str) The concatenation of the drive and root, or ''. (Docstring copied from pathlib.Path)</>
  • drive (str) The drive prefix (letter or UNC path), if any. (Docstring copied from pathlib.Path)</>
  • mounted Get the corresponding mounted path in the remote environment.</>
  • name (str) The final path component, if any. (Docstring copied from pathlib.Path)</>
  • parent The logical parent of the path. (Docstring copied from pathlib.Path)</>
  • parents (Sequence) A sequence of this path's logical parents. (Docstring copied from pathlib.Path)</>
  • parts (Tuple) An object providing sequence-like access to thecomponents in the filesystem path. (Docstring copied from pathlib.Path) </>
  • stem (str) The final path component, minus its last suffix. (Docstring copied from pathlib.Path)</>
  • suffix (str) The final component's last suffix, if any.
    This includes the leading period. For example: '.txt' (Docstring copied from pathlib.Path) </>
  • suffixes (List) A list of the final component's suffixes, if any.
    These include the leading periods. For example: ['.tar', '.gz'] (Docstring copied from pathlib.Path) </>
Examples
>>> spec_path = SpecPath("s3://bucket/key",...                    mounted="s3://remote-bucket/key")
>>> isinstance(spec_path, SpecS3Path)
True
Classes
Methods
  • __eq__(other) (bool) Check equality with another path object.</>
  • __get_pydantic_core_schema__(_source_type, _handler) Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • __get_validators__() (Generator) Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types </>
  • __new__(cls, path, mounted, *args, **kwargs) Create a new SpecCloudPath instance.</>
  • __repr__() (str) Generate a string representation of the SpecPath.</>
  • __truediv__(other) (SpecPath) Implement the / operator for cloud paths.</>
  • absolute() (Self) Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>
  • as_uri() (str) Return the path as a 'file' URI. (Docstring copied from pathlib.Path)</>
  • clear_cache() Removes cache if it exists</>
  • copy(destination, force_overwrite_to_cloud) Copy self to destination folder of file, if self is a file.</>
  • copytree(destination, force_overwrite_to_cloud, ignore) Copy self to a directory, if self is a directory.</>
  • exists() (bool) Whether this path exists.</>
  • glob(pattern, case_sensitive) (Generator) Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path) </>
  • is_absolute() (bool) True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path) </>
  • is_dir(follow_symlinks) (bool) Whether this path is a directory. (Docstring copied from pathlib.Path) </>
  • is_file(follow_symlinks) (bool) Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path) </>
  • is_junction() Whether this path is a junction. (Docstring copied from pathlib.Path) </>
  • is_relative_to(other) (bool) Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path) </>
  • iterdir() (Generator) Yield path objects of the directory contents.</>
  • joinpath(*pathsegments) Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path) </>
  • match(path_pattern, case_sensitive) (bool) Return True if this path matches the given pattern. (Docstring copied from pathlib.Path) </>
  • mkdir(parents, exist_ok) Create a new directory at this given path. (Docstring copied from pathlib.Path) </>
  • open(mode, buffering, encoding, errors, newline, force_overwrite_from_cloud, force_overwrite_to_cloud) (IO) Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path) </>
  • read_bytes() (bytes) Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • read_text(encoding, errors, newline) (str) Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path) </>
  • relative_to(other, walk_up) (PurePosixPath) 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) (Self) Rename this path to the target path.</>
  • replace(target) (Self) Rename this path to the target path, overwriting if that path exists.</>
  • resolve(strict) (Self) Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path) </>
  • rglob(pattern, case_sensitive) (Generator) Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path) </>
  • rmdir() Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path) </>
  • rmtree() Recursively delete a directory tree. (Docstring copied from pathlib.Path)</>
  • samefile(other_path) (bool) Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path) </>
  • stat() Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path) </>
  • touch(exist_ok) Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path) </>
  • unlink(missing_ok) Remove this file or link.If the path is a directory, use rmdir() instead. (Docstring copied from pathlib.Path) </>
  • upload_from(source, force_overwrite_to_cloud) (Self) Upload a file or directory to the cloud path.</>
  • validate(v) (Self) Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/ </>
  • walk(top_down, on_error, follow_symlinks) (Generator) Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)</>
  • with_name(name) Return a new path with the file name changed. (Docstring copied from pathlib.Path)</>
  • 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(). (Docstring copied from pathlib.Path) </>
  • with_stem(stem) Return a new path with the stem changed. (Docstring copied from pathlib.Path)</>
  • with_suffix(suffix) Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path) </>
  • write_bytes(data) (int) Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
  • write_text(data, encoding, errors, newline) (int) Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path) </>
class

cloudpathlib.cloudpath.CloudPathMeta(name, bases, dic)

Bases
abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

method

as_uri() → str

Return the path as a 'file' URI. (Docstring copied from pathlib.Path)

method

exists() → bool

Whether this path exists.

This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. (Docstring copied from pathlib.Path)

method

is_dir(follow_symlinks=True) → bool

Whether this path is a directory. (Docstring copied from pathlib.Path)

method

is_file(follow_symlinks=True) → bool

Whether this path is a regular file (also True for symlinks pointingto regular files). (Docstring copied from pathlib.Path)

generator

glob(pattern, case_sensitive=None) → Generator

Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. (Docstring copied from pathlib.Path)

generator

rglob(pattern, case_sensitive=None) → Generator

Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. (Docstring copied from pathlib.Path)

generator

iterdir() → Generator

Yield path objects of the directory contents.

The children are yielded in arbitrary order, and the special entries '.' and '..' are not included. (Docstring copied from pathlib.Path)

generator

walk(top_down=True, on_error=None, follow_symlinks=False) → Generator

Walk the directory tree from this directory, similar to os.walk(). (Docstring copied from pathlib.Path)

method

open(mode='r', buffering=-1, encoding=None, errors=None, newline=None, force_overwrite_from_cloud=None, force_overwrite_to_cloud=None) → IO

Open the file pointed to by this path and return a file object, asthe built-in open() function does. (Docstring copied from pathlib.Path)

method

replace(target) → Self

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. (Docstring copied from pathlib.Path)

method

rename(target) → Self

Rename this path to the target path.

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. (Docstring copied from pathlib.Path)

method

rmdir()

Remove this directory. The directory must be empty. (Docstring copied from pathlib.Path)

method

samefile(other_path) → bool

Return whether other_path is the same or not as this file(as returned by os.path.samefile()). (Docstring copied from pathlib.Path)

method

write_bytes(data) → int

Open the file in bytes mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

write_text(data, encoding=None, errors=None, newline=None) → int

Open the file in text mode, write to it, and close the file. (Docstring copied from pathlib.Path)

method

read_bytes() → bytes

Open the file in bytes mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

read_text(encoding=None, errors=None, newline=None) → str

Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)

method

is_junction()

Whether this path is a junction. (Docstring copied from pathlib.Path)

method

absolute() → Self

Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.

Use resolve() to get the canonical path to a file. (Docstring copied from pathlib.Path)

method

is_absolute() → bool

True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)

method

resolve(strict=False) → Self

Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)

method

relative_to(other, walk_up=False) → PurePosixPath

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. (Docstring copied from pathlib.Path)

method

is_relative_to(other) → bool

Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)

method

match(path_pattern, case_sensitive=None) → bool

Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)

method

rmtree()

Recursively delete a directory tree. (Docstring copied from pathlib.Path)

method

upload_from(source, force_overwrite_to_cloud=None) → Self

Upload a file or directory to the cloud path.

method

copy(destination, force_overwrite_to_cloud=None)

Copy self to destination folder of file, if self is a file.

method

copytree(destination, force_overwrite_to_cloud=None, ignore=None)

Copy self to a directory, if self is a directory.

method

clear_cache()

Removes cache if it exists

classmethod

__get_pydantic_core_schema__(_source_type, _handler)

Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

validate(v) → Self

Used as a Pydantic validator. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/

classmethod

__get_validators__() → Generator

Pydantic special method. Seehttps://pydantic-docs.helpmanual.io/usage/types/#custom-data-types

method

mkdir(parents=False, exist_ok=False)

Create a new directory at this given path. (Docstring copied from pathlib.Path)

method

touch(exist_ok=True)

Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)

method

stat()

Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)

method

__repr__()

Generate a string representation of the SpecPath.

Returns (str)

A string showing the class name, path, and mounted path (if different).

method

__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.

Parameters
  • other (Any) Another object to compare with.
Returns (bool)

True if the paths are equal, False otherwise.

staticmethod

__new__(cls, path, mounted=None, *args, **kwargs)

Create a new SpecCloudPath instance.

Parameters
  • *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 cloud 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.
Returns

A new SpecCloudPath instance.

method

__truediv__(other)

Implement the / operator for cloud paths.

Parameters
  • other The path segment to append to this path.
Returns (SpecPath)

A new spec cloud path with the segment appended.

method

with_name(name)

Return a new path with the file name changed. (Docstring copied from pathlib.Path)

method

with_suffix(suffix)

Return a new path with the file suffix changed. If the pathhas no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. (Docstring copied from pathlib.Path)

method

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(). (Docstring copied from pathlib.Path)

method

with_stem(stem)

Return a new path with the stem changed. (Docstring copied from pathlib.Path)

method

joinpath(*pathsegments)

Combine this path with one or several arguments, and return anew path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). (Docstring copied from pathlib.Path)