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

Function _normalize_list

agents/wiki-agent/ingest/from_reading_report.py:48–68  ·  view source on GitHub ↗
(value: Any)

Source from the content-addressed store, hash-verified

46
47
48def _normalize_list(value: Any) -> List[str]:
49 if value is None:
50 return []
51 if isinstance(value, str):
52 text = value.strip()
53 if not text:
54 return []
55 if text.startswith("["):
56 try:
57 parsed = json.loads(text)
58 except json.JSONDecodeError:
59 parsed = None
60 if isinstance(parsed, list):
61 return [str(item).strip() for item in parsed if str(item).strip()]
62 return [text]
63 if isinstance(value, dict):
64 return [str(item).strip() for item in value.values() if str(item).strip()]
65 if isinstance(value, Iterable):
66 return [str(item).strip() for item in value if str(item).strip()]
67 text = str(value).strip()
68 return [text] if text else []
69
70
71def _body_text(value: Any) -> str:

Callers 4

_body_textFunction · 0.70
_bullet_listFunction · 0.70
_keywordsFunction · 0.70
_paper_metadataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected