entity_instance.__getattr__ - small optimization for inverse attrs

Stop iterating early and don't build a list to make it a bit more optimized.

Though I'm unsure if anyone is really using `unpack_non_aggregate_inverses`
This commit is contained in:
Andrej
2025-06-11 12:49:47 +05:00
parent cd952d7e54
commit 3499c50d7d
@@ -206,7 +206,7 @@ class entity_instance:
schema_name = self.wrapped_data.is_a(True).split(".")[0]
ent: ifcopenshell_wrapper.entity
ent = ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(self.is_a())
inv = [i for i in ent.all_inverse_attributes() if i.name() == name][0]
inv = next(i for i in ent.all_inverse_attributes() if i.name() == name)
if (inv.bound1(), inv.bound2()) == (-1, -1):
if vs:
vs = vs[0]