MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / SelectionTarget

Class SelectionTarget

masfactory/utils/selector.py:8–23  ·  view source on GitHub ↗

A small, uniform view of "something selectable". This lets us share the same selector semantics across: - runtime hook registration (we have an object instance) - NodeTemplate materialization (we only have name + class)

Source from the content-addressed store, hash-verified

6
7@dataclass(frozen=True)
8class SelectionTarget:
9 """
10 A small, uniform view of "something selectable".
11
12 This lets us share the same selector semantics across:
13 - runtime hook registration (we have an object instance)
14 - NodeTemplate materialization (we only have name + class)
15 """
16
17 name: str | None
18 cls: type | None
19 obj: object | None = None
20
21 @classmethod
22 def from_obj(cls, obj: object) -> "SelectionTarget":
23 return cls(name=getattr(obj, "name", None), cls=type(obj), obj=obj)
24
25
26class Selector:

Callers 1

match_declarationMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected