diff --git a/src/bonsai/bonsai/bim/module/structural/load_decoration_data.py b/src/bonsai/bonsai/bim/module/structural/load_decoration_data.py
index ea0626d8c3..c02f0b643e 100644
--- a/src/bonsai/bonsai/bim/module/structural/load_decoration_data.py
+++ b/src/bonsai/bonsai/bim/module/structural/load_decoration_data.py
@@ -22,9 +22,9 @@ import numpy as np
from math import sin
from mathutils import Vector
import ifcopenshell
-import ifcopenshell.api
-import ifcopenshell.util.attribute
import ifcopenshell.util.placement
+import ifcopenshell.util.representation
+import ifcopenshell.util.unit
import ifcopenshell.util.unit as ifcunit
import bonsai.tool as tool
from bonsai.bim.module.structural.shader import DecorationShader
diff --git a/src/bonsai/bonsai/tool/feature.py b/src/bonsai/bonsai/tool/feature.py
index 0990aef008..84a12591c0 100644
--- a/src/bonsai/bonsai/tool/feature.py
+++ b/src/bonsai/bonsai/tool/feature.py
@@ -21,7 +21,9 @@ import bpy
import bonsai.core.tool
import bonsai.tool as tool
import bonsai.bim.helper
+import bonsai.core.geometry
import ifcopenshell
+import ifcopenshell.util.representation
from typing import Iterable, TYPE_CHECKING
if TYPE_CHECKING:
diff --git a/src/ifc4d/ifc4d/csv4d2ifc.py b/src/ifc4d/ifc4d/csv4d2ifc.py
index 19554614d2..36cf7d787e 100644
--- a/src/ifc4d/ifc4d/csv4d2ifc.py
+++ b/src/ifc4d/ifc4d/csv4d2ifc.py
@@ -20,6 +20,7 @@
import csv
import ifcopenshell
import ifcopenshell.api
+import ifcopenshell.util.date
import locale
import re
diff --git a/src/ifc4d/ifc4d/ifc2msp.py b/src/ifc4d/ifc4d/ifc2msp.py
index 9577e2eb00..e7d540dd3a 100644
--- a/src/ifc4d/ifc4d/ifc2msp.py
+++ b/src/ifc4d/ifc4d/ifc2msp.py
@@ -20,6 +20,7 @@ import uuid
import datetime
import ifcopenshell
import ifcopenshell.util.date
+import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET
diff --git a/src/ifc4d/ifc4d/ifc2p6.py b/src/ifc4d/ifc4d/ifc2p6.py
index f0569d7873..1d4bfea195 100644
--- a/src/ifc4d/ifc4d/ifc2p6.py
+++ b/src/ifc4d/ifc4d/ifc2p6.py
@@ -20,6 +20,7 @@ import uuid
import datetime
import ifcopenshell
import ifcopenshell.util.date
+import ifcopenshell.util.sequence
import xml.etree.ElementTree as ET
from .common import ScheduleIfcGenerator
diff --git a/src/ifc5d/ifc5d/ifc5Dspreadsheet.py b/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
index a548c0a00a..42580e66ed 100644
--- a/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
+++ b/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
@@ -29,7 +29,7 @@ import ifcopenshell.util.cost
import ifcopenshell.util.date
import ifcopenshell.util.unit
from collections import Counter
-from typing import Union, Optional, Any, TypedDict, NotRequired
+from typing import Union, Optional, Any, TypedDict
class CostItem(TypedDict):
diff --git a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py
index 7200ec9d7e..d24aadf9ff 100644
--- a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py
+++ b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py
@@ -258,6 +258,7 @@ class Cityjson2ifc:
# TODO but maybe there is a better method.
file = self.properties["file_destination"] + lod + self.properties["file_extension"]
self.IFC_model.write(file)
+ IFC_copied_model: ifcopenshell.file
IFC_copied_model = ifcopenshell.open(file)
IFC_copied_model_sub_contexts = IFC_copied_model.by_type("IfcGeometricRepresentationSubContext")
for sub_context in IFC_copied_model_sub_contexts:
diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py
index 672e55c24c..0942269ceb 100644
--- a/src/ifcopenshell-python/ifcopenshell/__init__.py
+++ b/src/ifcopenshell-python/ifcopenshell/__init__.py
@@ -65,7 +65,7 @@ if TYPE_CHECKING:
import ifcopenshell.express.schema_class
-if hasattr(os, "uname"):
+if sys.platform != "win32":
platform_system = os.uname()[0].lower()
else:
platform_system = "windows"
diff --git a/src/ifcopenshell-python/ifcopenshell/api/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/__init__.py
index 7f798d06da..d6e0066af9 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/__init__.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/__init__.py
@@ -43,9 +43,11 @@ import numpy
import inspect
import importlib
import ifcopenshell
-from typing import Callable, Any, Optional
+from typing import Callable, Any, Optional, TYPE_CHECKING
from functools import partial
+if TYPE_CHECKING:
+ import ifcopenshell.api
pre_listeners: dict[str, dict] = {}
post_listeners: dict[str, dict] = {}
@@ -185,7 +187,7 @@ def extract_docs(module: str, usecase: str) -> dict[str, Any]:
type_hints = typing.get_type_hints(function_init)
for name, socket_data in inputs.items():
type_hint = type_hints[name]
- if isinstance(type_hint, typing._UnionGenericAlias):
+ if isinstance(type_hint, typing._UnionGenericAlias): # pyright: ignore[reportAttributeAccessIssue]
inputs[name]["type"] = [t.__name__ for t in typing.get_args(type_hint)]
else:
inputs[name]["type"] = type_hint.__name__
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_to_alignment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_to_alignment.py
index 48e43ec91e..a5f8da650c 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_to_alignment.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_to_alignment.py
@@ -19,6 +19,8 @@
import ifcopenshell
import ifcopenshell.api.alignment
import ifcopenshell.api.nest
+import ifcopenshell.api.pset
+import ifcopenshell.util.stationing
import ifcopenshell.guid
from ifcopenshell import entity_instance
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_vertical_alignment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_vertical_alignment.py
index d2f7d228a8..c8a8fd29e1 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_vertical_alignment.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_vertical_alignment.py
@@ -21,6 +21,7 @@ import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment
import ifcopenshell.api.geometry
import ifcopenshell.api.nest
+import ifcopenshell.api.root
import ifcopenshell.guid
import ifcopenshell.util.element
import ifcopenshell.util.representation
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_alignment_by_pi_method.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_alignment_by_pi_method.py
index 47dc64ef60..dab4dae4fd 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_alignment_by_pi_method.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_alignment_by_pi_method.py
@@ -17,7 +17,9 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment
+import ifcopenshell.api.nest
from ifcopenshell import entity_instance
from typing import Sequence
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_segment_representations.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_segment_representations.py
index a5dc42cfc3..9ea02f0a43 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/create_segment_representations.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/create_segment_representations.py
@@ -17,11 +17,10 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.util.element
+import ifcopenshell.util.representation
import ifcopenshell.api.alignment
from ifcopenshell import entity_instance
-from ifcopenshell import ifcopenshell_wrapper
-import math
-from typing import Sequence
def create_segment_representations(
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/distance_along_from_station.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/distance_along_from_station.py
index 8bfbb8f03c..7c7c505964 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/distance_along_from_station.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/distance_along_from_station.py
@@ -17,9 +17,7 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
-import ifcopenshell.api.alignment
-import ifcopenshell.api.nest
-import ifcopenshell.guid
+import ifcopenshell.util.element
from ifcopenshell import entity_instance
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/map_alignment_segments.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/map_alignment_segments.py
index f4946751c1..f668fc5010 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/map_alignment_segments.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/map_alignment_segments.py
@@ -49,8 +49,6 @@ def map_alignment_segments(
elif alignment.is_a("IfcAlignmentCant") and not composite_curve.is_a("IfcSegmentedReferenceCurve"):
raise TypeError(f"Expected to see IfcSegmentedReferenceCurve, instead received '{composite_curve.is_a()}'.")
- settings = ifcopenshell.geom.settings()
-
composite_curve.SelfIntersect = False
for rel_nests in alignment.IsNestedBy:
@@ -64,6 +62,8 @@ def map_alignment_segments(
mapped_segments = ifcopenshell.api.alignment.map_alignment_cant_segment(
file, layout, alignment.RailHeadDistance
)
+ else:
+ assert False
for mapped_segment in mapped_segments:
if mapped_segment:
ifcopenshell.api.alignment.add_segment_to_curve(file, mapped_segment, composite_curve)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_window_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_window_representation.py
index 4477694ca5..d1ef540ab0 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_window_representation.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_window_representation.py
@@ -19,6 +19,7 @@
from __future__ import annotations
import numpy as np
import dataclasses
+import ifcopenshell.api.geometry
import ifcopenshell.util.unit
from itertools import chain
from ifcopenshell.util.shape_builder import ShapeBuilder, V
diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/connect_wall.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/connect_wall.py
index a84d70fff8..8666a38693 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/geometry/connect_wall.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/connect_wall.py
@@ -18,11 +18,10 @@
import numpy as np
import ifcopenshell
-import ifcopenshell.api.owner
-import ifcopenshell.guid
-import ifcopenshell.util.element
+import ifcopenshell.api.geometry
import ifcopenshell.util.placement
import ifcopenshell.util.representation
+import ifcopenshell.util.shape_builder
from typing import Optional
diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py
index ae2a885d36..b5164c2001 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py
@@ -19,11 +19,13 @@
import json
import numpy as np
import ifcopenshell
+import ifcopenshell.api.context
import ifcopenshell.api.geometry
-import ifcopenshell.util.unit
import ifcopenshell.util.element
import ifcopenshell.util.placement
+import ifcopenshell.util.representation
import ifcopenshell.util.shape_builder
+import ifcopenshell.util.unit
from collections import namedtuple
from math import sin, cos
from typing import Optional
diff --git a/src/ifcopenshell-python/ifcopenshell/api/georeference/edit_wcs.py b/src/ifcopenshell-python/ifcopenshell/api/georeference/edit_wcs.py
index 4ab04d7347..f453d2e94a 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/georeference/edit_wcs.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/georeference/edit_wcs.py
@@ -19,6 +19,7 @@
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
+import ifcopenshell.util.unit
import numpy as np
from math import sin, cos, radians
diff --git a/src/ifcopenshell-python/ifcopenshell/util/brick.py b/src/ifcopenshell-python/ifcopenshell/util/brick.py
index a50caeaa05..8c11dacdfe 100644
--- a/src/ifcopenshell-python/ifcopenshell/util/brick.py
+++ b/src/ifcopenshell-python/ifcopenshell/util/brick.py
@@ -19,8 +19,9 @@
import os
import json
import ifcopenshell
-import ifcopenshell.util.element
import ifcopenshell.util.classification
+import ifcopenshell.util.element
+import ifcopenshell.util.system
from typing import Union
diff --git a/src/ifcopenshell-python/ifcopenshell/util/representation.py b/src/ifcopenshell-python/ifcopenshell/util/representation.py
index 7f71fc869b..3d6e7a9da2 100644
--- a/src/ifcopenshell-python/ifcopenshell/util/representation.py
+++ b/src/ifcopenshell-python/ifcopenshell/util/representation.py
@@ -19,8 +19,9 @@
import numpy as np
import numpy.typing as npt
import ifcopenshell
-import ifcopenshell.util.shape
+import ifcopenshell.util.representation
import ifcopenshell.util.placement
+import ifcopenshell.util.shape
from typing import Optional, Union, TypedDict, Literal, Generator, Sequence
diff --git a/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py b/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
index f6f375ea23..e18b4eed39 100644
--- a/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
+++ b/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
@@ -18,6 +18,9 @@
import ifcopenshell
+import ifcopenshell.util.schema
+import ifcopenshell.util.shape_builder
+import ifcopenshell.util.unit
import logging
from typing import Optional
diff --git a/src/ifcpatch/ifcpatch/recipes/MergeStyles.py b/src/ifcpatch/ifcpatch/recipes/MergeStyles.py
index 5af2807c8f..cb490e77c7 100644
--- a/src/ifcpatch/ifcpatch/recipes/MergeStyles.py
+++ b/src/ifcpatch/ifcpatch/recipes/MergeStyles.py
@@ -18,6 +18,7 @@
import ifcopenshell
import ifcopenshell.guid
+import ifcopenshell.util.element
class Patcher:
diff --git a/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py b/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py
index fb688556b7..d0e6f26c9e 100644
--- a/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py
+++ b/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py
@@ -18,6 +18,7 @@
import ifcopenshell
import ifcopenshell.api.georeference
+import ifcopenshell.util.geolocation
from ifcpatch.recipes import OffsetObjectPlacements, SetWorldCoordinateSystem
import typing
diff --git a/src/ifctester/ifctester/reporter.py b/src/ifctester/ifctester/reporter.py
index c6b9c0225c..c1bbbb177f 100644
--- a/src/ifctester/ifctester/reporter.py
+++ b/src/ifctester/ifctester/reporter.py
@@ -23,8 +23,9 @@ import sys
import math
import datetime
import ifcopenshell
-import ifcopenshell.util.unit
import ifcopenshell.util.element
+import ifcopenshell.util.placement
+import ifcopenshell.util.unit
from .ids import Specification, Ids
from .facet import Facet, FacetFailure
from typing import TypedDict, Union, Literal, Optional
@@ -766,7 +767,6 @@ class Bcf(Json):
def to_file(self, filepath: str) -> None:
import numpy as np
- import ifcopenshell.util.placement
from bcf.v2.bcfxml import BcfXml
unit_scale = None