plantsimpath documentation
Add your content using reStructuredText syntax. See the
reStructuredText
documentation for details.
- class plantsimpath.path.PlantsimPath(*entries)
Bases:
objectPlantSim path object for handling and concatenating hierarchical object paths.
- Parameters:
entries (
Union[str,PlantsimPath]) – Entries to be concatenated into a path.- Variables:
_path (str) – Internal string representation of the path.
- append(entry)
Append a path entry to the current path.
- Parameters:
entry (
str) – Path entry to append.- Return type:
None
- property depth: int
Number of segments in the path.
- Returns:
Path depth.
- Return type:
int
- classmethod from_path(path)
Create a PlantsimPath from a pathlib.Path or string.
- Parameters:
path (
Union[Path,str]) – Path object or string.- Return type:
- Returns:
PlantsimPath instance.
- is_child_of(other)
Check if self is a child of other.
- Parameters:
other (
PlantsimPath) – Parent path.- Return type:
bool- Returns:
True if self is a child of other.
- is_empty()
Check if the path is empty.
- Return type:
bool- Returns:
True if path is empty, else False.
- is_root()
Check if path has exactly one segment.
- Return type:
bool- Returns:
True if path has one segment, False otherwise.
- property name: str
Represents the last part of the path.
- Returns:
Last path segment or empty string if path is empty.
- Return type:
str
- parent()
Get the parent path.
- Return type:
- Returns:
Parent PlantsimPath.
- parts()
Split the path into its segments.
- Return type:
List[str]- Returns:
List of path parts.
- relative_to(other)
Return the relative path from ‘other’ to self.
- Parameters:
other (
PlantsimPath) – Base path.- Return type:
- Returns:
Relative PlantsimPath.
- Raises:
ValueError – If self is not a child of other.
- property root: str
First segment of the path.
- Returns:
Root path segment or empty string if path is empty.
- Return type:
str
- to_folder_path()
Convert the PlantsimPath to a pathlib Path object referring to the meta data of a folder or frame.
- Return type:
Path- Returns:
pathlib.Path object.
- to_object_path()
Convert the PlantsimPath to a pathlib Path object referring to the meta data of an object.
- Return type:
Path- Returns:
pathlib.Path object.
- to_path()
Convert the PlantsimPath to a pathlib Path object.
- Return type:
Path- Returns:
pathlib.Path object.
- to_str()
Return the path as a string.
- Returns:
Path as string.
- Return type:
str
- with_name(new_name)
Return a new PlantsimPath with the last segment replaced.
- Parameters:
new_name (
str) – New last segment.- Return type:
- Returns:
New PlantsimPath instance.