From 0446fca56ad133582a05934e2e317714f267df70 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 10 Oct 2022 14:25:45 +0200 Subject: [PATCH] --json --spf option in validate.py --- src/ifcopenshell-python/ifcopenshell/validate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/validate.py b/src/ifcopenshell-python/ifcopenshell/validate.py index e2bf3ed7ad..81feccd1e9 100644 --- a/src/ifcopenshell-python/ifcopenshell/validate.py +++ b/src/ifcopenshell-python/ifcopenshell/validate.py @@ -399,4 +399,7 @@ if __name__ == "__main__": validate(fn, logger) if "--json" in flags: - print("\n".join(json.dumps(x, default=str) for x in logger.statements)) + conv = str + if "--spf" in flags: + conv = lambda x: x.to_string() if isinstance(x, ifcopenshell.entity_instance) else str(x) + print("\n".join(json.dumps(x, default=conv) for x in logger.statements))