MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _parse_jsonish_list

Function _parse_jsonish_list

agents/reading-agent/main.py:593–609  ·  view source on GitHub ↗
(value: Any)

Source from the content-addressed store, hash-verified

591
592def _parse_jsonish_list(value: Any) -> List[str]:
593 if isinstance(value, list):
594 return [str(item).strip() for item in value if str(item).strip()]
595 if not value:
596 return []
597 if isinstance(value, str):
598 text = value.strip()
599 if not text:
600 return []
601 try:
602 parsed = json.loads(text)
603 except json.JSONDecodeError:
604 return [text]
605 if isinstance(parsed, list):
606 return [str(item).strip() for item in parsed if str(item).strip()]
607 return [str(parsed).strip()] if parsed else []
608 return [str(value).strip()]
609
610
611def _clean_text(text: Any) -> str:
612 normalized = str(text or "")

Calls

no outgoing calls

Tested by

no test coverage detected