MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _get_attr

Function _get_attr

src/agent/fork_subagent.py:275–285  ·  view source on GitHub ↗

Read an attribute or mapping key from a heterogeneous object. Forked messages can arrive as dataclass instances, plain dicts, or Pydantic-style objects. This helper unifies the reads.

(obj: Any, name: str, default: Any)

Source from the content-addressed store, hash-verified

273
274
275def _get_attr(obj: Any, name: str, default: Any) -> Any:
276 """Read an attribute or mapping key from a heterogeneous object.
277
278 Forked messages can arrive as dataclass instances, plain dicts, or
279 Pydantic-style objects. This helper unifies the reads.
280 """
281 if obj is None:
282 return default
283 if isinstance(obj, dict):
284 return obj.get(name, default)
285 return getattr(obj, name, default)
286
287
288__all__ = [

Callers 3

is_in_fork_childFunction · 0.85
_collect_tool_use_blocksFunction · 0.85
build_forked_messagesFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected