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

Function _format_text

src/ifcquery/ifcquery/__main__.py:84–103  ·  view source on GitHub ↗
(data, indent: int = 0)

Source from the content-addressed store, hash-verified

82
83
84def _format_text(data, indent: int = 0) -> str:
85 prefix = " " * indent
86 lines = []
87 if isinstance(data, dict):
88 for key, value in data.items():
89 if isinstance(value, (dict, list)):
90 lines.append(f"{prefix}{key}:")
91 lines.append(_format_text(value, indent + 1))
92 else:
93 lines.append(f"{prefix}{key}: {value}")
94 elif isinstance(data, list):
95 for item in data:
96 if isinstance(item, dict):
97 lines.append(_format_text(item, indent))
98 lines.append("")
99 else:
100 lines.append(f"{prefix}- {item}")
101 else:
102 lines.append(f"{prefix}{data}")
103 return "\n".join(lines)
104
105
106def main():

Callers 1

format_outputFunction · 0.70

Calls 3

itemsMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected