INNER CODE UNIT · Python
_decode_stable
kevinpbuckley/VibeUE · Content/Python/vibeue.py:178
def _decode_stable(value):
"""json.loads until the value stops being a JSON string (issue #548)."""
for _ in range(4):
if not isinstance(value, str):
return value
stripped = value.strip()
if not stripped or stripped[0] not in "[{\"" :
return value
try:
value = json.loads(stripped)
except ValueError:
return value
return value
def exec_tool(toolset_name, tool_name, args=None, unwrap=True):
"""Execute a ToolsetRegistry tool with schema-aware arg filling and normalized decoding.