Add ty to check for missing symbols and other simple errors

This commit is contained in:
Andrej730
2026-03-20 15:35:53 +05:00
parent 30551cb288
commit 26280d24fe
41 changed files with 350 additions and 70 deletions
@@ -67,9 +67,9 @@ class Patcher:
def patch(self) -> None:
import bonsai.tool as tool
import bpy # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import ifcopenshell.util.element
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports]
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
if len(bpy.data.objects) > 0:
bpy.data.batch_remove(bpy.data.objects)
@@ -26,7 +26,7 @@ import ifcopenshell
import ifcopenshell.util.shape_builder
if TYPE_CHECKING:
import bpy # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
class Patcher:
@@ -114,9 +114,9 @@ class Patcher:
self.should_create_edges = should_create_edges
def patch(self) -> None:
import bmesh # pyright: ignore[reportMissingImports]
import bmesh # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import bonsai.tool as tool
import bpy # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import ifcopenshell.util.schema
import ifcopenshell.util.unit
@@ -167,9 +167,9 @@ class Patcher:
self.file = tool.Ifc.get()
def create_edges(self, obj: bpy.types.Object) -> None:
import bmesh # pyright: ignore[reportMissingImports]
import bmesh # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import bonsai.tool as tool
import bpy # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.util.representation
@@ -235,7 +235,7 @@ class Patcher:
# No sharp faces
from math import degrees
import bmesh # pyright: ignore[reportMissingImports]
import bmesh # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import bonsai.tool as tool
import ifcopenshell.api.geometry
import ifcopenshell.api.root
@@ -282,13 +282,13 @@ class Patcher:
# This is crazy but we need a sharp face per island
from math import degrees, radians, sin
import bmesh # pyright: ignore[reportMissingImports]
import bmesh # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import bonsai.tool as tool
import ifcopenshell.api.geometry
import ifcopenshell.api.root
import ifcopenshell.util.representation
import ifcopenshell.util.shape_builder
from mathutils import Matrix # pyright: ignore[reportMissingImports]
from mathutils import Matrix # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
# Get the active object (assumed to have a mesh)
mesh = obj.data
@@ -80,9 +80,9 @@ class Patcher:
def patch(self) -> None:
from math import degrees
import bmesh # pyright: ignore[reportMissingImports]
import bmesh # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
import bonsai.tool as tool
import bpy # pyright: ignore[reportMissingImports]
import bpy # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
props = tool.Project.get_project_props()
props.should_use_native_meshes = True
@@ -97,5 +97,5 @@ class Patcher:
relating_type=relating_type,
related_objects=related_objects,
should_map_representations=False,
should_run_listeners=False,
should_run_listeners=False, # ty:ignore[unknown-argument]
)