From a3bcea008af0ef36c1428abb14171fcef828b130 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 14 Jan 2026 18:02:04 +0500 Subject: [PATCH] util.shape - move typing stuff to `TYPE_CHECKING` block --- .../ifcopenshell/util/shape.py | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape.py b/src/ifcopenshell-python/ifcopenshell/util/shape.py index 4c41eff9f9..7732412861 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape.py @@ -16,28 +16,36 @@ # You should have received a copy of the GNU Lesser General Public License # along with IfcOpenShell. If not, see . +from __future__ import annotations + from math import cos, radians -from typing import Literal, Optional, Union +from typing import TYPE_CHECKING, Literal, Optional, Union import numpy as np import numpy.typing as npt import shapely import shapely.ops -import ifcopenshell.ifcopenshell_wrapper as W import ifcopenshell.util.element import ifcopenshell.util.placement import ifcopenshell.util.representation -from ifcopenshell.geom import ShapeElementType -from ifcopenshell.util.shape_builder import VectorType -tol = 1e-6 -AXIS_LITERAL = Literal["X", "Y", "Z"] -VECTOR_3D = tuple[float, float, float] +if TYPE_CHECKING: + import ifcopenshell.ifcopenshell_wrapper as W + from ifcopenshell.geom import ShapeElementType + from ifcopenshell.util.shape_builder import VectorType + + AXIS_LITERAL = Literal["X", "Y", "Z"] + + VECTOR_3D = tuple[float, float, float] + +# Used only for typing, but reused by `shape.py` users. MatrixType = npt.NDArray[np.float64] """`npt.NDArray[np.float64]`""" +tol = 1e-6 + # NOTE: See IfcGeomRepresentation.h for W.Triangulation buffer types. # NOTE: For functions that return a single scalar ensure to use .item() to