MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _describe_shape

Function _describe_shape

uncommon_route/composition.py:711–722  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

709
710
711def _describe_shape(text: str) -> str:
712 try:
713 parsed = json.loads(text)
714 except Exception:
715 parsed = None
716 if isinstance(parsed, dict):
717 keys = ", ".join(list(parsed.keys())[:8])
718 return f"shape=json object keys=[{keys}]"
719 if isinstance(parsed, list):
720 return f"shape=json array items={len(parsed)}"
721 lines = text.count("\n") + 1
722 return f"shape=text lines={lines}"
723
724
725def _truncate_excerpt(text: str, limit: int) -> str:

Callers 1

_build_artifact_stubFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected