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

Method __call__

src/ifctester/ifctester/facet.py:230–257  ·  view source on GitHub ↗
(self, inst: ifcopenshell.entity_instance, logger: Optional[Logger] = None)

Source from the content-addressed store, hash-verified

228 return results
229
230 def __call__(self, inst: ifcopenshell.entity_instance, logger: Optional[Logger] = None) -> EntityResult:
231 is_pass = inst.is_a().upper() == self.name
232 reason = None
233
234 if (
235 not is_pass
236 and inst.file.schema == "IFC2X3"
237 and not self.name.endswith("TYPE")
238 and (element_type := ifcopenshell.util.element.get_type(inst))
239 ):
240 is_pass = element_type.is_a().upper() == f"{self.name}TYPE"
241 reason = {"type": "NAME", "actual": element_type.is_a().upper()[:-4]}
242 elif not is_pass:
243 reason = {"type": "NAME", "actual": inst.is_a().upper()}
244
245 if is_pass and self.predefinedType:
246 if self.predefinedType == "USERDEFINED":
247 is_pass = ifcopenshell.util.element.is_userdefined_type(inst)
248 if not is_pass:
249 predefined_type = ifcopenshell.util.element.get_predefined_type(inst)
250 else:
251 predefined_type = ifcopenshell.util.element.get_predefined_type(inst)
252 is_pass = predefined_type == self.predefinedType
253
254 if not is_pass:
255 reason = {"type": "PREDEFINEDTYPE", "actual": predefined_type}
256
257 return EntityResult(is_pass, reason)
258
259
260class Attribute(Facet):

Callers

nothing calls this directly

Calls 5

EntityResultClass · 0.85
upperMethod · 0.80
get_predefined_typeMethod · 0.80
is_aMethod · 0.45
get_typeMethod · 0.45

Tested by

no test coverage detected