Fix all remaining ty type-check failures on ci-lint

The ci-lint workflow's ty steps fail on every branch because base
v0.8.0 has four diagnostics.

ty check (bonsai):

- root/operator.py: bpy.data.objects.get() can return None, so
  UnlinkObject._execute could put None in its objects list and crash
  on the first attribute access when an unknown object name is passed.
  Handle the miss explicitly, which also satisfies the declared
  list[bpy.types.Object] type.
- tool/sequence.py: ty does not narrow Literal types through
  membership tests on list literals, so the assert_never() exhaustive
  check was flagged. Use tuple literals, which ty narrows, keeping the
  exhaustiveness check intact.

ty check (ios):

- draw.py: arrange_polygons was called through conditional argument
  splats that let the same call site work against pre-April-2026
  wrappers lacking arrange_polygon_settings and the logger parameter.
  No runtime bug for current builds, but the dynamic splats cannot be
  typed against the fixed 3-parameter signature. Drop the old-build
  workaround and call the current signature directly, following the
  precedent of 3d8115ebc5 which dropped similar old-build workarounds
  in ifcopenshell.file. Verified against a current wrapper build that
  the direct call arranges polygons and serializes to SVG, with and
  without a logger.
- Optimise.py: igraph is an optional dependency with a guarded import
  and a toposort fallback, but it was missing from the ios type-check
  venv so ty could not resolve it. Add it to type-check-requirements
  next to the toposort fallback that is already listed.

After this, poe ty-bonsai and poe ty-ios both pass cleanly.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Petru Conduraru
2026-07-19 22:48:25 +03:00
committed by Dion Moult
parent bb49822f2e
commit 6d6d92b849
4 changed files with 9 additions and 11 deletions
@@ -413,12 +413,13 @@ class UnlinkObject(bpy.types.Operator, tool.Ifc.Operator):
skip_invoke: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"}) skip_invoke: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
def _execute(self, context): def _execute(self, context):
objects: list[bpy.types.Object]
if self.obj: if self.obj:
objects = [bpy.data.objects.get(self.obj)] requested_obj = bpy.data.objects.get(self.obj)
objects = [requested_obj] if requested_obj is not None else []
else: else:
objects = context.selected_objects objects = context.selected_objects
objects: list[bpy.types.Object]
for obj in objects: for obj in objects:
was_active_object = obj == context.active_object was_active_object = obj == context.active_object
+3 -3
View File
@@ -1159,11 +1159,11 @@ class Sequence(bonsai.core.tool.Sequence):
props.task_input_colors.clear() props.task_input_colors.clear()
for group, data in groups.items(): for group, data in groups.items():
for predefined_type in data["PredefinedType"]: for predefined_type in data["PredefinedType"]:
if group in ["CREATION", "OPERATION", "MOVEMENT_TO"]: if group in ("CREATION", "OPERATION", "MOVEMENT_TO"):
predefined_type_item = props.task_output_colors.add() predefined_type_item = props.task_output_colors.add()
elif group in ["MOVEMENT_FROM"]: elif group in ("MOVEMENT_FROM",):
predefined_type_item = props.task_input_colors.add() predefined_type_item = props.task_input_colors.add()
elif group in ["USERDEFINED", "DESTRUCTION"]: elif group in ("USERDEFINED", "DESTRUCTION"):
predefined_type_item = props.task_input_colors.add() predefined_type_item = props.task_input_colors.add()
predefined_type_item2 = props.task_output_colors.add() predefined_type_item2 = props.task_output_colors.add()
predefined_type_item2.name = predefined_type predefined_type_item2.name = predefined_type
+2 -6
View File
@@ -42,7 +42,7 @@ WHITE = numpy.array((1.0, 1.0, 1.0))
DO_NOTHING = lambda *args: None DO_NOTHING = lambda *args: None
ARRANGE_POLYGON_SETTINGS = W.arrange_polygon_settings() if hasattr(W, "arrange_polygon_settings") else None ARRANGE_POLYGON_SETTINGS = W.arrange_polygon_settings()
@dataclass @dataclass
@@ -546,11 +546,7 @@ def main(
*(tup for i, tup in enumerate(zip(path_objects, section_polies, polies)) if has_relevant_zone(i)) *(tup for i, tup in enumerate(zip(path_objects, section_polies, polies)) if has_relevant_zone(i))
) )
arranged = W.arrange_polygons( arranged = W.arrange_polygons(ARRANGE_POLYGON_SETTINGS, polies, logger)
*filter(None, (ARRANGE_POLYGON_SETTINGS,)),
polies,
*((logger,) if logger is not None else ()),
)
svg_data_3 = W.polygons_to_svg(arranged, False) svg_data_3 = W.polygons_to_svg(arranged, False)
dom3 = parseString(svg_data_3) dom3 = parseString(svg_data_3)
svg3 = dom3.childNodes[0] svg3 = dom3.childNodes[0]
@@ -3,6 +3,7 @@ cjio >=0.8, <0.10
deepdiff deepdiff
docutils docutils
flask flask
igraph
isodate isodate
jinja2 jinja2
lark lark