xqute.path
Provides the SpecPath and MountedPath classes.
It is used to represent paths of jobs and it is useful when a job is running in a remote system (a VM, a container, etc.), where we need to mount the paths into the remote system (MountedPath).
But in the system where this framework is running, we need to use the paths (specified directly) that are used in the framework, where we also need to carry the information of the mounted path (SpecPath).
The module provides two main abstract base classes:
- -
MountedPath
: Represents a path as it appears in the remote execution environment. - -
SpecPath
: Represents a path as it appears in the local environment where the
Both classes have implementations for local paths and various cloud storage paths, including:
- - Google Cloud Storage
- - Azure Blob Storage
- - Amazon S3
These classes maintain the relationship between the local and remote pathrepresentations, allowing transparent path operations while preserving both path contexts.
MountedPath
(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</>
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.
_spec
— The corresponding path in the local environment (SpecPath).spec
— Get the corresponding spec path in the local environment.</>
>>> # 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'>
__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).</>
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Factory method to create the appropriate MountedPath subclass instance.
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.
ss s s
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
xqute.path.
MountedLocalPath
(
path
, spec=None
, *args
, **kwargs
)
A class to represent a mounted local path
This class represents a path in a local filesystem as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec
— The corresponding path in the local environment.anchor
— The concatenation of the drive and root, or ''.</>drive
— The drive prefix (letter or UNC path), if any.</>name
— The final path component, if any.</>parent
— Get the parent directory of this path.</>parents
— A sequence of this path's logical parents.</>parts
— An object providing sequence-like access to thecomponents in the filesystem path. </>root
— The root of the path, if any.</>spec
— Get the corresponding spec path in the local environment.</>stem
— The final path component, minus its last suffix.</>suffix
— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes
— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> 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'
__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.</>
__str__
(
)
Return the string representation of the path, suitable forpassing to system calls.
as_posix
(
)
Return the string representation of the path with forward (/)slashes.
__bytes__
(
)
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri
(
)
Return the path as a 'file' URI.
with_stem
(
stem
)
Return a new path with the stem changed.
relative_to
(
other
, *_deprecated
, walk_up=False
)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether ..
may be used to resolve
the path.
is_relative_to
(
other
, *_deprecated
)
Return True if the path is relative to another path or False.
is_absolute
(
)
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved
(
)
Return True if the path contains one of the special names reservedby the system, if any.
match
(
path_pattern
, case_sensitive=None
)
Return True if this path matches the given pattern.
stat
(
follow_symlinks=True
)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat
(
)
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
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.
is_dir
(
)
Whether this path is a directory.
is_file
(
)
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount
(
)
Check if this path is a mount point
is_symlink
(
)
Whether this path is a symbolic link.
is_junction
(
)
Whether this path is a junction.
is_block_device
(
)
Whether this path is a block device.
is_char_device
(
)
Whether this path is a character device.
is_fifo
(
)
Whether this path is a FIFO.
is_socket
(
)
Whether this path is a socket.
samefile
(
other_path
)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
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.
read_bytes
(
)
Open the file in bytes mode, read it, and close the file.
read_text
(
encoding=None
, errors=None
)
Open the file in text mode, read it, and close the file.
write_bytes
(
data
)
Open the file in bytes mode, write to it, and close the file.
write_text
(
data
, encoding=None
, errors=None
, newline=None
)
Open the file in text mode, write to it, and close the file.
iterdir
(
)
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob
(
pattern
, case_sensitive=None
)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob
(
pattern
, case_sensitive=None
)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
walk
(
top_down=True
, on_error=None
, follow_symlinks=False
)
Walk the directory tree from this directory, similar to os.walk().
cwd
(
)
Return a new path pointing to the current working directory.
home
(
)
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
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.
resolve
(
strict=False
)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner
(
)
Return the login name of the file owner.
group
(
)
Return the group name of the file gid.
readlink
(
)
Return the path to which the symbolic link points.
touch
(
mode=438
, exist_ok=True
)
Create this file with the given access mode, if it doesn't exist.
mkdir
(
mode=511
, parents=False
, exist_ok=False
)
Create a new directory at this given path.
chmod
(
mode
, follow_symlinks=True
)
Change the permissions of the path, like os.chmod().
lchmod
(
mode
)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink
(
missing_ok=False
)
Remove this file or link.If the path is a directory, use rmdir() instead.
rmdir
(
)
Remove this directory. The directory must be empty.
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.
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.
symlink_to
(
target
, target_is_directory=False
)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to
(
target
)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser
(
)
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
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()).
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Create a new MountedLocalPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path) — The path string or object representing the mounted 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.
A new MountedLocalPath instance.
with_segments
(
*pathsegments
)
Create a new path by replacing all segments with the given segments.
*pathsegments
— The path segments to use in the new path.
A new mounted path with the specified segments.
NotImplementedError
— If Python version is lower than 3.10.
with_name
(
name
)
Return a new path with the name changed.
name
— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix
(
suffix
)
Return a new path with the suffix changed.
suffix
— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath
(
*pathsegments
)
Join path components to this path.
*pathsegments
— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__
(
key
)
Implement the / operator for paths.
key
— The path segment to append to this path.
A new mounted path with the segment appended.
xqute.path.
MountedCloudPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a mounted cloud path
This class represents a cloud storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec
— The corresponding path in the local environment.anchor
(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) </>
>>> 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'
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
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)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Create a new MountedCloudPath instance.
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.
A new MountedCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new mounted cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
MountedGSPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a mounted Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec
— The corresponding path in the local environment.anchor
(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) </>
>>> mounted_path = MountedPath("gs://bucket/file.txt",... spec="gs://local-bucket/file.txt")
>>> isinstance(mounted_path, MountedGSPath)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
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)
stat
(
)
Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Create a new MountedCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path | 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.
A new MountedCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new mounted cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
MountedAzureBlobPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a mounted Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec
— The corresponding path in the local environment.anchor
(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) </>
>>> mounted_path = MountedPath("az://container/blob",... spec="az://local-container/blob")
>>> isinstance(mounted_path, MountedAzureBlobPath)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (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)
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)
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Create a new MountedCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path | 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.
A new MountedCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new mounted cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
MountedS3Path
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a mounted Amazon S3 path
This class represents an Amazon S3 path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec
— The corresponding path in the local environment.anchor
(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) </>
>>> mounted_path = MountedPath("s3://bucket/key",... spec="s3://local-bucket/key")
>>> isinstance(mounted_path, MountedS3Path)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (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)
is_mounted
(
)
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__
(
)
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__
(
other
)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, spec=None
, *args
, **kwargs
)
Create a new MountedCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path | 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.
A new MountedCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new mounted cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
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.
_mounted
— The corresponding path in the remote execution environment.mounted
— Get the corresponding mounted path in the remote environment.</>
>>> # 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'>
__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.</>
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Factory method to create the appropriate SpecPath subclass instance.
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.
ss s s
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
xqute.path.
SpecLocalPath
(
path
, mounted=None
, *args
, **kwargs
)
A class to represent a spec local path
This class represents a path in the local filesystem as it appears in the framework's environment, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted
— The corresponding path in the remote execution environment.anchor
— The concatenation of the drive and root, or ''.</>drive
— The drive prefix (letter or UNC path), if any.</>mounted
— Get the corresponding mounted path in the remote environment.</>name
— The final path component, if any.</>parent
— Get the parent directory of this path.</>parents
— A sequence of this path's logical parents.</>parts
— An object providing sequence-like access to thecomponents in the filesystem path. </>root
— The root of the path, if any.</>stem
— The final path component, minus its last suffix.</>suffix
— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes
— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> 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'
__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.</>
__str__
(
)
Return the string representation of the path, suitable forpassing to system calls.
as_posix
(
)
Return the string representation of the path with forward (/)slashes.
__bytes__
(
)
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri
(
)
Return the path as a 'file' URI.
relative_to
(
other
, *_deprecated
, walk_up=False
)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether ..
may be used to resolve
the path.
is_relative_to
(
other
, *_deprecated
)
Return True if the path is relative to another path or False.
is_absolute
(
)
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved
(
)
Return True if the path contains one of the special names reservedby the system, if any.
match
(
path_pattern
, case_sensitive=None
)
Return True if this path matches the given pattern.
stat
(
follow_symlinks=True
)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat
(
)
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
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.
is_dir
(
)
Whether this path is a directory.
is_file
(
)
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount
(
)
Check if this path is a mount point
is_symlink
(
)
Whether this path is a symbolic link.
is_junction
(
)
Whether this path is a junction.
is_block_device
(
)
Whether this path is a block device.
is_char_device
(
)
Whether this path is a character device.
is_fifo
(
)
Whether this path is a FIFO.
is_socket
(
)
Whether this path is a socket.
samefile
(
other_path
)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
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.
read_bytes
(
)
Open the file in bytes mode, read it, and close the file.
read_text
(
encoding=None
, errors=None
)
Open the file in text mode, read it, and close the file.
write_bytes
(
data
)
Open the file in bytes mode, write to it, and close the file.
write_text
(
data
, encoding=None
, errors=None
, newline=None
)
Open the file in text mode, write to it, and close the file.
iterdir
(
)
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob
(
pattern
, case_sensitive=None
)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob
(
pattern
, case_sensitive=None
)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
walk
(
top_down=True
, on_error=None
, follow_symlinks=False
)
Walk the directory tree from this directory, similar to os.walk().
cwd
(
)
Return a new path pointing to the current working directory.
home
(
)
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
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.
resolve
(
strict=False
)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner
(
)
Return the login name of the file owner.
group
(
)
Return the group name of the file gid.
readlink
(
)
Return the path to which the symbolic link points.
touch
(
mode=438
, exist_ok=True
)
Create this file with the given access mode, if it doesn't exist.
mkdir
(
mode=511
, parents=False
, exist_ok=False
)
Create a new directory at this given path.
chmod
(
mode
, follow_symlinks=True
)
Change the permissions of the path, like os.chmod().
lchmod
(
mode
)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink
(
missing_ok=False
)
Remove this file or link.If the path is a directory, use rmdir() instead.
rmdir
(
)
Remove this directory. The directory must be empty.
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.
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.
symlink_to
(
target
, target_is_directory=False
)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to
(
target
)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser
(
)
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
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()).
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Create a new SpecLocalPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path) — The path string or object representing the spec 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.
A new SpecLocalPath instance.
with_segments
(
*pathsegments
)
Create a new path by replacing all segments with the given segments.
*pathsegments
— The path segments to use in the new path.
A new spec path with the specified segments.
with_name
(
name
)
Return a new path with the name changed.
name
— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix
(
suffix
)
Return a new path with the suffix changed.
suffix
— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem
(
stem
)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem
— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath
(
*pathsegments
)
Join path components to this path.
*pathsegments
— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__
(
key
)
Implement the / operator for paths.
key
— The path segment to append to this path.
A new spec path with the segment appended.
xqute.path.
SpecCloudPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a spec cloud path
This class represents a cloud storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted
— The corresponding path in the remote execution environment.anchor
(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) </>
>>> 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'
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
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)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Create a new SpecCloudPath instance.
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.
A new SpecCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new spec cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
SpecGSPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a spec Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted
— The corresponding path in the remote execution environment.anchor
(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) </>
>>> spec_path = SpecPath("gs://bucket/file.txt",... mounted="gs://container-bucket/file.txt")
>>> isinstance(spec_path, SpecGSPath)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (Docstring copied from pathlib.Path)
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
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)
stat
(
)
Return the result of the stat() system call on this path, likeos.stat() does. (Docstring copied from pathlib.Path)
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Create a new SpecCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path) — The path string or object representing the spec 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.
A new SpecCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new spec cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
SpecAzureBlobPath
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a spec Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted
— The corresponding path in the remote execution environment.anchor
(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) </>
>>> spec_path = SpecPath("az://container/blob",... mounted="az://remote-container/blob")
>>> isinstance(spec_path, SpecAzureBlobPath)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (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)
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)
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Create a new SpecCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path) — The path string or object representing the spec 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.
A new SpecCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new spec cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)
xqute.path.
SpecS3Path
(
cloud_path
, *args
, **kwargs
)
→ Union
A class to represent a spec Amazon S3 path
This class represents an Amazon S3 path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted
— The corresponding path in the remote execution environment.anchor
(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) </>
>>> spec_path = SpecPath("s3://bucket/key",... mounted="s3://remote-bucket/key")
>>> isinstance(spec_path, SpecS3Path)
True
CloudPathMeta
— Metaclass for defining Abstract Base Classes (ABCs).</>
__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 likeiterdir()
. (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) </>
cloudpathlib.cloudpath.
CloudPathMeta
(
name
, bases
, dic
)
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()).
as_uri
(
)
→ str
Return the path as a 'file' URI. (Docstring copied from pathlib.Path)
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)
is_dir
(
follow_symlinks=True
)
→ bool
Whether this path is a directory. (Docstring copied from pathlib.Path)
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)
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)
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)
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)
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)
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)
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)
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)
rmdir
(
)
Remove this directory. The directory must be empty. (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)
unlink
(
missing_ok=True
)
Remove this file or link.If the path is a directory, use rmdir() instead. (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=None
, errors=None
, newline=None
)
→ int
Open the file in text mode, write to it, and close the file. (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=None
, errors=None
, newline=None
)
→ str
Open the file in text mode, read it, and close the file. (Docstring copied from pathlib.Path)
is_junction
(
)
Whether this path is a junction. (Docstring copied from pathlib.Path)
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)
is_absolute
(
)
→ bool
True if the path is absolute (has both a root and, if applicable,a drive). (Docstring copied from pathlib.Path)
resolve
(
strict=False
)
→ Self
Make the path absolute, resolving all symlinks on the way and alsonormalizing it. (Docstring copied from pathlib.Path)
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)
is_relative_to
(
other
)
→ bool
Return True if the path is relative to another path or False.(Docstring copied from pathlib.Path)
match
(
path_pattern
, case_sensitive=None
)
→ bool
Return True if this path matches the given pattern. (Docstring copied from pathlib.Path)
rmtree
(
)
Recursively delete a directory tree. (Docstring copied from pathlib.Path)
upload_from
(
source
, force_overwrite_to_cloud=None
)
→ Self
Upload a file or directory to the cloud path.
copy
(
destination
, force_overwrite_to_cloud=None
)
Copy self to destination folder of file, if self is a file.
copytree
(
destination
, force_overwrite_to_cloud=None
, ignore=None
)
Copy self to a directory, if self is a directory.
clear_cache
(
)
Removes cache if it exists
__get_pydantic_core_schema__
(
_source_type
, _handler
)
Pydantic special method. Seehttps://docs.pydantic.dev/2.0/usage/types/custom/
validate
(
v
)
→ Self
Used as a Pydantic validator. 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
mkdir
(
parents=False
, exist_ok=False
)
Create a new directory at this given path. (Docstring copied from pathlib.Path)
touch
(
exist_ok=True
)
Create this file with the given access mode, if it doesn't exist. (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)
__repr__
(
)
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__
(
other
)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other
(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__new__
(
cls
, path
, mounted=None
, *args
, **kwargs
)
Create a new SpecCloudPath instance.
*args
(Any) — Additional positional arguments passed to the path constructor.**kwargs
(Any) — Additional keyword arguments passed to the path constructor.path
(str | pathlib.path) — The path string or object representing the spec 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.
A new SpecCloudPath instance.
__truediv__
(
other
)
Implement the / operator for cloud paths.
other
— The path segment to append to this path.
A new spec cloud path with the segment appended.
with_name
(
name
)
Return a new path with the file name 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)
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)
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)