adaptix.struct_trail module#

class adaptix.struct_trail.TrailElementMarker#

Bases: object

class adaptix.struct_trail.Attr(name: str)#

Bases: TrailElementMarker

name: str#
class adaptix.struct_trail.ItemKey(key: Any)#

Bases: TrailElementMarker

key: Any#
adaptix.struct_trail.append_trail(
obj: T,
trail_element: str | int | Any | TrailElementMarker,
) T#

Append a trail element to object. Trail stores in special attribute, if an object does not allow adding 3rd-party attributes, do nothing. Element inserting to start of the path (it is built in reverse order)

adaptix.struct_trail.extend_trail(
obj: T,
sub_trail: Reversible[str | int | Any | TrailElementMarker],
) T#

Extend a trail with a sub trail. Trail stores in special attribute, if an object does not allow adding 3rd-party attributes, do nothing. Sub path inserting to start (it is built in reverse order)

adaptix.struct_trail.get_trail(
obj: object,
) Sequence[str | int | Any | TrailElementMarker]#

Retrieve trail from an object. Trail stores in special private attribute that never be accessed directly

adaptix.struct_trail.render_trail_as_note(
exc: BaseExcT,
) BaseExcT#