Skip to content

Class tigrbl.runtime.labels.Label

tigrbl.runtime.labels.Label dataclass

Label(kind, subject, domain=None, anchor=None, field=None)

kind instance-attribute

kind

subject instance-attribute

subject

domain class-attribute instance-attribute

domain = None

anchor class-attribute instance-attribute

anchor = None

field class-attribute instance-attribute

field = None

is_secdep property

is_secdep

is_dep property

is_dep

is_sys property

is_sys

is_atom property

is_atom

is_hook property

is_hook

render

render(*, pretty=True)

Pretty = human-facing (short secdep/dep). False = always canonicalized shape when possible.

Source code in tigrbl/runtime/labels.py
60
61
62
63
64
65
66
67
68
69
70
def render(self, *, pretty: bool = True) -> str:
    """
    Pretty = human-facing (short secdep/dep). False = always canonicalized shape when possible.
    """
    if self.kind in ("secdep", "dep"):
        return f"{self.kind}:{self.subject}"
    if self.kind == "sys":
        return f"sys:{self.subject}@{self.anchor}"
    # atom / hook
    base = f"{self.kind}:{self.domain}:{self.subject}@{self.anchor}"
    return f"{base}#{self.field}" if self.field else base

with_field

with_field(field)
Source code in tigrbl/runtime/labels.py
75
76
77
def with_field(self, field: Optional[str]) -> "Label":
    _validate_field(field)
    return replace(self, field=field)

clear_field

clear_field()
Source code in tigrbl/runtime/labels.py
79
80
def clear_field(self) -> "Label":
    return replace(self, field=None)