diff --git a/src/bonsai/bonsai/tool/debug.py b/src/bonsai/bonsai/tool/debug.py index 58cd1b464f..59fff9575c 100644 --- a/src/bonsai/bonsai/tool/debug.py +++ b/src/bonsai/bonsai/tool/debug.py @@ -152,7 +152,7 @@ class Debug(bonsai.core.tool.Debug): return name def get_hash(element: ifcopenshell.entity_instance) -> int: - data = element.get_info_2(include_identifier=False, recursive=True) + data = element.get_info(include_identifier=False, recursive=True) if object_type == "APPLICATION": # To avoid disruption let user merge organizations separately. data["ApplicationDeveloper"] = element.ApplicationDeveloper.id() diff --git a/src/ifcdiff/ifcdiff.py b/src/ifcdiff/ifcdiff.py index c7d6bb5d03..3032dd23ce 100755 --- a/src/ifcdiff/ifcdiff.py +++ b/src/ifcdiff/ifcdiff.py @@ -354,7 +354,7 @@ class IfcDiff: new_projections = sorted([o.RelatedFeatureElement.GlobalId for o in getattr(new, "HasProjections", []) or []]) if old_projections != new_projections: return True - # Option 3: check completely using Python with get_info_2 (extremely slow, not worth it) + # Option 3: check completely using Python with get_info (extremely slow, not worth it) # old_rep_id = self.get_representation_id(old) # new_rep_id = self.get_representation_id(new) # rep_result = self.representation_ids.get(new_rep_id, None) @@ -387,8 +387,8 @@ class IfcDiff: return True try: diff = DeepDiff( - old_item.get_info_2(recursive=True), - new_item.get_info_2(recursive=True), + old_item.get_info(recursive=True), + new_item.get_info(recursive=True), custom_operators=[DiffTerminator()] if self.is_shallow else [], math_epsilon=self.precision, exclude_regex_paths=[r".*id']$"], diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 92e1daafa4..4483f332d3 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -387,15 +387,15 @@ class entity_instance_mixin: return_type: type[dict] = dict, ignore: Sequence[str] = (), ) -> dict[str, Any]: - """More perfomant version of `.get_info()`.\n - Method has exactly the same signature as `.get_info()`, but the fast C++ + """More perfomant version of `.get_info_py()`.\n + Method has exactly the same signature as `.get_info_py()`, but the fast C++ path only implements ``recursive=True``, ``return_type=dict`` and ``ignore=()``. Any other combination falls back to the pure Python - `.get_info()`, where no meaningful performance gain is possible anyway + `.get_info_py()`, where no meaningful performance gain is possible anyway as the cost is dominated by the recursive traversal. """ if recursive and return_type is dict and not ignore: - return ifcopenshell_wrapper.get_info_cpp(self.wrapped_data, include_identifier) + return ifcopenshell_wrapper.get_info_cpp(self, recursive, include_identifier) return self.get_info_py( include_identifier=include_identifier, recursive=recursive, return_type=return_type, ignore=ignore ) diff --git a/src/ifcopenshell-python/test/test_entity_instance.py b/src/ifcopenshell-python/test/test_entity_instance.py index dd19696823..afbf300791 100644 --- a/src/ifcopenshell-python/test/test_entity_instance.py +++ b/src/ifcopenshell-python/test/test_entity_instance.py @@ -25,7 +25,7 @@ class TestGetInfo2(test.bootstrap.IFC4): brep = self.file.create_entity("IfcFacetedBrep") shell = self.file.create_entity("IfcClosedShell") brep.Outer = shell - assert brep.get_info_2(recursive=True) == { + assert brep.get_info(recursive=True) == { "Outer": {"CfsFaces": None, "id": 2, "type": "IfcClosedShell"}, "id": 1, "type": "IfcFacetedBrep", @@ -35,7 +35,7 @@ class TestGetInfo2(test.bootstrap.IFC4): shell = self.file.create_entity("IfcClosedShell") faces = [self.file.create_entity("IfcFace") for i in range(3)] shell.CfsFaces = faces - assert shell.get_info_2(recursive=True)["CfsFaces"] == ( + assert shell.get_info(recursive=True)["CfsFaces"] == ( {"Bounds": None, "id": 2, "type": "IfcFace"}, {"Bounds": None, "id": 3, "type": "IfcFace"}, {"Bounds": None, "id": 4, "type": "IfcFace"}, @@ -45,7 +45,7 @@ class TestGetInfo2(test.bootstrap.IFC4): surface = self.file.create_entity("IfcBSplineSurfaceWithKnots") pp = [self.file.create_entity("IfcCartesianPoint", [float(i)]) for i in range(4)] surface.ControlPointsList = [pp[:2], pp[2:]] - assert surface.get_info_2(recursive=True)["ControlPointsList"] == ( + assert surface.get_info(recursive=True)["ControlPointsList"] == ( ( {"Coordinates": (0.0,), "id": 2, "type": "IfcCartesianPoint"}, {"Coordinates": (1.0,), "id": 3, "type": "IfcCartesianPoint"}, @@ -60,7 +60,7 @@ class TestGetInfo2(test.bootstrap.IFC4): brep = self.file.create_entity("IfcFacetedBrep") shell = self.file.create_entity("IfcClosedShell") brep.Outer = shell - assert brep.get_info_2(recursive=True, include_identifier=False) == { + assert brep.get_info(recursive=True, include_identifier=False) == { "Outer": {"CfsFaces": None, "type": "IfcClosedShell"}, "type": "IfcFacetedBrep", } diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index 64567a698c..dbe3258562 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -406,7 +406,7 @@ static bool express_Base_equals(const express::Base* self, const express::Base* return false; } else if ((self->file() != other->file()) || (self->declaration().as_entity() == nullptr)) { // PyGILState_STATE gil = PyGILState_Ensure(); - // @todo get_info_2 is actually implemented in C++, so we try to call it directly + // @todo get_info is actually implemented in C++, so we try to call it directly bool result = false; PyObject *py_self = SWIG_NewPointerObj(SWIG_as_voidptr(self), SWIGTYPE_p_express__Base, 0); @@ -419,8 +419,8 @@ static bool express_Base_equals(const express::Base* self, const express::Base* PyDict_SetItemString(kwargs, "recursive", Py_True); PyDict_SetItemString(kwargs, "include_identifier", Py_False); - PyObject *m1 = PyObject_GetAttrString(py_self, "get_info_2"); - PyObject *m2 = PyObject_GetAttrString(py_other, "get_info_2"); + PyObject *m1 = PyObject_GetAttrString(py_self, "get_info"); + PyObject *m2 = PyObject_GetAttrString(py_other, "get_info"); PyObject *i1 = (m1 ? PyObject_Call(m1, args, kwargs) : nullptr); PyObject *i2 = (m2 ? PyObject_Call(m2, args, kwargs) : nullptr); @@ -429,7 +429,7 @@ static bool express_Base_equals(const express::Base* self, const express::Base* int eq = PyObject_RichCompareBool(i1, i2, Py_EQ); result = (eq == 1); } else { - // get_info_2 missing or threw; treat as not equal (and clear Python error). + // get_info missing or threw; treat as not equal (and clear Python error). PyErr_Clear(); }