mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix ty-ios type-check errors (ifcopenshell-python side)
poe ty's sequence only reaches ty-ios once ty-bonsai passes, so these never surfaced until now: - util/alignment.py: drop the stale `include_referent=False` kwarg from add_zero_length_segment() - that parameter was removed from the function's signature in45ea5eb07but this caller in a different file was missed, leaving a latent TypeError if this code path is ever exercised. - ifcopenshell_wrapper.pyi: add the optional trailing `logger` parameter to parse_ifcxml/open/construct_iterator*, matching the real SWIG signatures in src/ifcwrap/*.i (all declare `Logger& logger = Logger::Root()`) that the hand-maintained stub never picked up. - ifcopenshell/__init__.py: remove a stale `ty: ignore[unknown-argument]` comment that ty confirms is no longer suppressing anything. - assign_cost_item_quantity.py: OPERATORS mixes 2-arg binary operators with the 1-arg `operator.neg` (for ast.USub), but FormulaEvaluator has no visit_UnaryOp so USub can never reach this lookup via visit_BinOp. Suppressed at the call site rather than touching the dict, since this looks like scaffolding for unary-minus support rather than dead code. - Explicit submodule imports (ifcopenshell.geom / api.alignment / util.unit / api.aggregate / api.context / api.spatial) added where accessed but only reachable by accident of import order. (cherry picked from commitd5e890bccd)
This commit is contained in:
committed by
Dion Moult
parent
17177d5f1c
commit
7036ea5c33
@@ -249,7 +249,7 @@ def open(
|
||||
kwargs = {"mmap": mmap}
|
||||
if logger is not None:
|
||||
kwargs["logger"] = logger
|
||||
f = ifcopenshell_wrapper.open(str(path.absolute()), **kwargs) # ty: ignore[unknown-argument]
|
||||
f = ifcopenshell_wrapper.open(str(path.absolute()), **kwargs)
|
||||
else:
|
||||
f = ifcopenshell_wrapper.open(str(path.absolute()), False, *optional_logger_args(logger))
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import numpy as np
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.util.placement
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.unit
|
||||
from ifcopenshell import entity_instance
|
||||
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ class FormulaEvaluator(ast.NodeVisitor):
|
||||
def visit_BinOp(self, node):
|
||||
left = self.visit(node.left)
|
||||
right = self.visit(node.right)
|
||||
return OPERATORS[type(node.op)](left, right)
|
||||
return OPERATORS[type(node.op)](left, right) # ty: ignore[too-many-positional-arguments]
|
||||
|
||||
def visit_Name(self, node):
|
||||
return self.values[node.id]
|
||||
|
||||
@@ -56,7 +56,7 @@ def append_zero_length_segments(file: ifcopenshell.file) -> ifcopenshell.file:
|
||||
for alignment in alignments:
|
||||
layouts = ifcopenshell.api.alignment.get_alignment_layouts(alignment)
|
||||
for layout in layouts:
|
||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file, layout, include_referent=False)
|
||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file, layout)
|
||||
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
|
||||
if curve:
|
||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file, curve)
|
||||
|
||||
@@ -21,8 +21,12 @@ import math
|
||||
|
||||
import pytest
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.aggregate
|
||||
import ifcopenshell.api.alignment
|
||||
import ifcopenshell.api.context
|
||||
import ifcopenshell.api.spatial
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.util.unit
|
||||
|
||||
|
||||
def test_create_representation():
|
||||
|
||||
Reference in New Issue
Block a user