mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
unblock voxel schema loading, add test for express
This commit is contained in:
committed by
Thomas Krijnen
parent
53c2ddbb47
commit
ab73550059
@@ -420,7 +420,13 @@ class SchemaClass(codegen.Base):
|
||||
|
||||
if isinstance(type, nodes.AggregationType):
|
||||
aggr_type = type.aggregate_type
|
||||
make_bound = lambda b: -1 if b == "?" else int(b)
|
||||
def make_bound(b):
|
||||
# `?` and non-literal bounds (attribute references, arithmetic expressions) collapse to -1.
|
||||
#
|
||||
try:
|
||||
return int(b)
|
||||
except (TypeError, ValueError):
|
||||
return -1
|
||||
bound1, bound2 = map(make_bound, (type.bounds.lower, type.bounds.upper))
|
||||
decl_type = get_declared_type(type.type, emitted_names)
|
||||
return x.aggregation_type(aggr_type, bound1, bound2, decl_type)
|
||||
@@ -547,7 +553,14 @@ class SchemaClass(codegen.Base):
|
||||
inv_attrs = []
|
||||
for attr in type.inverse:
|
||||
if attr.bounds:
|
||||
make_bound = lambda b: -1 if b == "?" else int(b)
|
||||
def make_bound(b):
|
||||
# `?` and non-literal bounds (attribute references, arithmetic
|
||||
# expressions) collapse to -1 (unbounded) — the C++ runtime has
|
||||
# no third state for "dynamic cardinality".
|
||||
try:
|
||||
return int(b)
|
||||
except (TypeError, ValueError):
|
||||
return -1
|
||||
bound1, bound2 = map(make_bound, (attr.bounds.lower, attr.bounds.upper))
|
||||
else:
|
||||
bound1, bound2 = -1, -1
|
||||
|
||||
Reference in New Issue
Block a user