From 4a71ab9631d3728450e12b406a1262d8c2fc1520 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 11 Jan 2023 12:47:13 +0100 Subject: [PATCH] #2685 Don't raise issues on WR evaluating to indeterminate --- src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py | 3 ++- src/ifcopenshell-python/ifcopenshell/express/rule_executor.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py b/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py index 990608d792..bbc66674fd 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py @@ -8,6 +8,7 @@ import functools import itertools import ifcopenshell.express +import ifcopenshell.express.express_parser import networkx as nx @@ -331,7 +332,7 @@ def calc_{class_name}_{str(derived_attr.attribute_decl.redeclared_attribute.qual def process_domain_rule(context): return f""" -assert {context.expression} +assert ({context.expression}) is not False """ def process_expression(context): diff --git a/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py b/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py index 8b0f282608..5579d3cf41 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py @@ -7,7 +7,7 @@ from codegen import indent def reverse_compile(s): - return s.strip().replace("len(", "SIZEOF(").replace("assert ", "") + return s.strip().replace("len(", "SIZEOF(").replace("assert ", "").replace(" is not False", "") @dataclass