class documentation

Path of an OpenSMI object, e.g. /M1/Components/Gripper/SkillSet/Pick.

A tuple of segments, never normalized: a segment is exactly what was put in. () is the root /. Equal only to other ObjectPath objects, never to a str; ordering follows the segments, which gives tree order.

Class Method of Return path as is, or parsed if it is a str.
Class Method parse Parse "/M1/Components/Gripper"; "/" is the root.
Static Method escape Return segment as a glob pattern that matches only itself.
Method __post_init__ Check the segments.
Method __str__ Return the path as text, e.g. "/M1/Components/Gripper".
Method __truediv__ Return this path extended by segment. The segment is checked, not sanitized.
Method is_relative_to Return whether this path is other or below it.
Method match Return whether the whole path matches the glob pattern, from the root to the last segment.
Class Variable segments Undocumented
Property name Last segment; "" for the root.
Property parent Path without the last segment.
@classmethod
def of(cls, path: ObjectPath | str) -> ObjectPath:

Return path as is, or parsed if it is a str.

@classmethod
def parse(cls, text: str) -> ObjectPath:

Parse "/M1/Components/Gripper"; "/" is the root.

Raises
ValueErrorIf text doesn't start with / or has an empty segment (//, trailing /).
@staticmethod
def escape(segment: str) -> str:

Return segment as a glob pattern that matches only itself.

* becomes [*], ? becomes [?] and [ becomes [[], as glob.escape() does.

def __post_init__(self):

Check the segments.

Raises
TypeErrorIf segments is no tuple of str.
ValueErrorIf a segment is empty or contains /.
def __str__(self) -> str:

Return the path as text, e.g. "/M1/Components/Gripper".

def __truediv__(self, segment: str) -> ObjectPath:

Return this path extended by segment. The segment is checked, not sanitized.

def is_relative_to(self, other: ObjectPath | str) -> bool:

Return whether this path is other or below it.

def match(self, pattern: str) -> bool:

Return whether the whole path matches the glob pattern, from the root to the last segment.

Per segment, *, ? and [...] work as in fnmatch (case-sensitive); a ** segment matches any number of segments, including none. Use escape() for segments taken literally.

Raises
ValueErrorIf pattern doesn't start with / or has an empty segment.
segments: tuple[str, ...] =

Undocumented

@property
name: str =

Last segment; "" for the root.

@property
parent: ObjectPath =

Path without the last segment.

Raises
ValueErrorFor the root, which has no parent.