MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _split_list

Function _split_list

src/ifcedit/ifcedit/coerce.py:170–180  ·  view source on GitHub ↗

Split a comma-separated string, handling JSON arrays too.

(value_str: str)

Source from the content-addressed store, hash-verified

168
169
170def _split_list(value_str: str) -> list[str]:
171 """Split a comma-separated string, handling JSON arrays too."""
172 value_str = value_str.strip()
173 if value_str.startswith("["):
174 try:
175 parsed = json.loads(value_str)
176 if isinstance(parsed, list):
177 return [json.dumps(item) if isinstance(item, (dict, list)) else str(item) for item in parsed]
178 except json.JSONDecodeError:
179 pass
180 return [item.strip() for item in value_str.split(",") if item.strip()]

Callers 2

coerce_valueFunction · 0.85
_coerce_entity_listFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected