mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Fix ty type-check errors: missing imports and unresolved names
- gizmos.py: TYPE_CHECKING-guard `import bmesh` for the string-literal
annotation in build_schematic_mesh; suppress the still-unresolved
gizmo_textures import in TexturedQuadGizmoMixin (WIP dependency, not dead
code).
- model/__init__.py: register the `decorator` submodule, which unregister()
already calls (would have raised NameError on addon disable).
- mep.py / tool/model.py: add explicit imports for bonsai.core.geometry and
bonsai.core.model, previously only reachable by accident of import order.
- Test files: add explicit ifcopenshell.api.pset / ifcopenshell.util.element
submodule imports used but not imported.
(cherry picked from commit 4fb8af2278)
This commit is contained in:
committed by
Dion Moult
parent
a674dc5641
commit
a941c664e1
@@ -82,7 +82,15 @@ import math
|
|||||||
from collections.abc import Callable, Iterator
|
from collections.abc import Callable, Iterator
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, ClassVar, Literal, Optional, Protocol, runtime_checkable
|
from typing import (
|
||||||
|
TYPE_CHECKING,
|
||||||
|
Any,
|
||||||
|
ClassVar,
|
||||||
|
Literal,
|
||||||
|
Optional,
|
||||||
|
Protocol,
|
||||||
|
runtime_checkable,
|
||||||
|
)
|
||||||
|
|
||||||
import blf
|
import blf
|
||||||
import bpy
|
import bpy
|
||||||
@@ -105,6 +113,9 @@ from mathutils.kdtree import KDTree
|
|||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
from bonsai.bim.module.drawing.shaders import ExtrusionGuidesShader
|
from bonsai.bim.module.drawing.shaders import ExtrusionGuidesShader
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import bmesh
|
||||||
|
|
||||||
SNAP_POINT_SIZE = 10.0
|
SNAP_POINT_SIZE = 10.0
|
||||||
SNAP_POINT_COLOR = (1.0, 0.5, 0.0, 1.0)
|
SNAP_POINT_COLOR = (1.0, 0.5, 0.0, 1.0)
|
||||||
SNAP_MAX_RADIUS = 50.0
|
SNAP_MAX_RADIUS = 50.0
|
||||||
@@ -2035,7 +2046,9 @@ class TexturedQuadGizmoMixin(StaticTrisGizmoMixin):
|
|||||||
|
|
||||||
def setup(self) -> None:
|
def setup(self) -> None:
|
||||||
super().setup()
|
super().setup()
|
||||||
from bonsai.bim.module.drawing import gizmo_textures
|
from bonsai.bim.module.drawing import (
|
||||||
|
gizmo_textures, # ty: ignore[unresolved-import]
|
||||||
|
)
|
||||||
|
|
||||||
self._quad_batch = batch_for_shader(
|
self._quad_batch = batch_for_shader(
|
||||||
gizmo_textures.get_shader(),
|
gizmo_textures.get_shader(),
|
||||||
@@ -2044,7 +2057,9 @@ class TexturedQuadGizmoMixin(StaticTrisGizmoMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context: bpy.types.Context) -> None:
|
def draw(self, context: bpy.types.Context) -> None:
|
||||||
from bonsai.bim.module.drawing import gizmo_textures
|
from bonsai.bim.module.drawing import (
|
||||||
|
gizmo_textures, # ty: ignore[unresolved-import]
|
||||||
|
)
|
||||||
|
|
||||||
texture = gizmo_textures.get_icon_texture(self.icon_name)
|
texture = gizmo_textures.get_icon_texture(self.icon_name)
|
||||||
if texture is None:
|
if texture is None:
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import bonsai.tool as tool
|
|||||||
from . import (
|
from . import (
|
||||||
array,
|
array,
|
||||||
covering,
|
covering,
|
||||||
|
decorator,
|
||||||
door,
|
door,
|
||||||
external,
|
external,
|
||||||
grid,
|
grid,
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import numpy as np
|
|||||||
from ifcopenshell.util.shape_builder import ShapeBuilder
|
from ifcopenshell.util.shape_builder import ShapeBuilder
|
||||||
from mathutils import Matrix, Vector
|
from mathutils import Matrix, Vector
|
||||||
|
|
||||||
|
import bonsai.core.geometry
|
||||||
import bonsai.core.root
|
import bonsai.core.root
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
from bonsai.bim.module.drawing import gizmos as gizmo
|
from bonsai.bim.module.drawing import gizmos as gizmo
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ from ifcopenshell.util.shape_builder import ShapeBuilder, np_to_3d
|
|||||||
from mathutils import Matrix, Vector
|
from mathutils import Matrix, Vector
|
||||||
|
|
||||||
import bonsai.core.geometry
|
import bonsai.core.geometry
|
||||||
|
import bonsai.core.model
|
||||||
import bonsai.core.tool
|
import bonsai.core.tool
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
from bonsai.bim import import_ifc
|
from bonsai.bim import import_ifc
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ from unittest.mock import Mock, patch
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.api.pset
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.api.pset
|
||||||
|
import ifcopenshell.util.element
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import time
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.util.element
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from bonsai import tool as tool
|
from bonsai import tool as tool
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import bpy
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.api.geometry
|
import ifcopenshell.api.geometry
|
||||||
import ifcopenshell.api.material
|
import ifcopenshell.api.material
|
||||||
|
import ifcopenshell.api.pset
|
||||||
import ifcopenshell.api.root
|
import ifcopenshell.api.root
|
||||||
import ifcopenshell.api.style
|
import ifcopenshell.api.style
|
||||||
import ifcopenshell.api.type
|
import ifcopenshell.api.type
|
||||||
|
|||||||
Reference in New Issue
Block a user