mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +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 in 45ea5eb07 but 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.
This commit is contained in:
@@ -231,7 +231,7 @@ def open(
|
|||||||
kwargs = {"mmap": mmap}
|
kwargs = {"mmap": mmap}
|
||||||
if logger is not None:
|
if logger is not None:
|
||||||
kwargs["logger"] = logger
|
kwargs["logger"] = logger
|
||||||
f = ifcopenshell_wrapper.open(str(path.absolute()), **kwargs) # ty: ignore[unknown-argument]
|
f = ifcopenshell_wrapper.open(str(path.absolute()), **kwargs)
|
||||||
else:
|
else:
|
||||||
f = ifcopenshell_wrapper.open(str(path.absolute()), False, *((logger,) if logger is not None else ()))
|
f = ifcopenshell_wrapper.open(str(path.absolute()), False, *((logger,) if logger is not None else ()))
|
||||||
return file(f)
|
return file(f)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import ifcopenshell.api.alignment
|
import ifcopenshell.api.alignment
|
||||||
|
import ifcopenshell.geom
|
||||||
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
from ifcopenshell import entity_instance, ifcopenshell_wrapper
|
||||||
from ifcopenshell.api.alignment._map_alignment_segment import _map_alignment_segment
|
from ifcopenshell.api.alignment._map_alignment_segment import _map_alignment_segment
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.api.alignment
|
||||||
import ifcopenshell.util.placement
|
import ifcopenshell.util.placement
|
||||||
from ifcopenshell import entity_instance
|
from ifcopenshell import entity_instance
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.placement
|
import ifcopenshell.util.placement
|
||||||
|
import ifcopenshell.util.unit
|
||||||
from ifcopenshell import entity_instance
|
from ifcopenshell import entity_instance
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ class FormulaEvaluator(ast.NodeVisitor):
|
|||||||
def visit_BinOp(self, node):
|
def visit_BinOp(self, node):
|
||||||
left = self.visit(node.left)
|
left = self.visit(node.left)
|
||||||
right = self.visit(node.right)
|
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):
|
def visit_Name(self, node):
|
||||||
return self.values[node.id]
|
return self.values[node.id]
|
||||||
|
|||||||
@@ -1697,10 +1697,16 @@ class uninitialized_tag: ...
|
|||||||
|
|
||||||
def arrange_polygons(settings, polygons): ...
|
def arrange_polygons(settings, polygons): ...
|
||||||
def clear_schemas(): ...
|
def clear_schemas(): ...
|
||||||
def construct_iterator(geometry_library, settings, file, num_threads): ...
|
def construct_iterator(geometry_library, settings, file, num_threads, logger=...): ...
|
||||||
def construct_iterator_with_include_exclude(geometry_library, settings, file, elems, include, num_threads): ...
|
def construct_iterator_with_include_exclude(
|
||||||
def construct_iterator_with_include_exclude_globalid(geometry_library, settings, file, elems, include, num_threads): ...
|
geometry_library, settings, file, elems, include, num_threads, logger=...
|
||||||
def construct_iterator_with_include_exclude_id(geometry_library, settings, file, elems, include, num_threads): ...
|
): ...
|
||||||
|
def construct_iterator_with_include_exclude_globalid(
|
||||||
|
geometry_library, settings, file, elems, include, num_threads, logger=...
|
||||||
|
): ...
|
||||||
|
def construct_iterator_with_include_exclude_id(
|
||||||
|
geometry_library, settings, file, elems, include, num_threads, logger=...
|
||||||
|
): ...
|
||||||
def convert_loop_to_function_item(loop): ...
|
def convert_loop_to_function_item(loop): ...
|
||||||
def create_box(*args): ...
|
def create_box(*args): ...
|
||||||
def create_epeck(*args): ...
|
def create_epeck(*args): ...
|
||||||
@@ -1717,8 +1723,8 @@ def line_segments_to_polygons(s, eps, segments): ...
|
|||||||
def map_shape(settings, instance): ...
|
def map_shape(settings, instance): ...
|
||||||
def nary_union(sequence): ...
|
def nary_union(sequence): ...
|
||||||
def new_IfcBaseClass(schema_identifier: str, name: str) -> entity_instance: ...
|
def new_IfcBaseClass(schema_identifier: str, name: str) -> entity_instance: ...
|
||||||
def open(fn: str, readonly: bool = False) -> file: ...
|
def open(fn: str, readonly: bool = False, logger=...) -> file: ...
|
||||||
def parse_ifcxml(filename): ...
|
def parse_ifcxml(filename, logger=...): ...
|
||||||
def polygons_to_svg(*args): ...
|
def polygons_to_svg(*args): ...
|
||||||
def read(data): ...
|
def read(data): ...
|
||||||
def register_schema(arg1): ...
|
def register_schema(arg1): ...
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def append_zero_length_segments(file: ifcopenshell.file) -> ifcopenshell.file:
|
|||||||
for alignment in alignments:
|
for alignment in alignments:
|
||||||
layouts = ifcopenshell.api.alignment.get_alignment_layouts(alignment)
|
layouts = ifcopenshell.api.alignment.get_alignment_layouts(alignment)
|
||||||
for layout in layouts:
|
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)
|
curve = ifcopenshell.api.alignment.get_layout_curve(layout)
|
||||||
if curve:
|
if curve:
|
||||||
ifcopenshell.api.alignment.add_zero_length_segment(patched_file, curve)
|
ifcopenshell.api.alignment.add_zero_length_segment(patched_file, curve)
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ import math
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
|
import ifcopenshell.api.aggregate
|
||||||
import ifcopenshell.api.alignment
|
import ifcopenshell.api.alignment
|
||||||
|
import ifcopenshell.api.context
|
||||||
|
import ifcopenshell.api.spatial
|
||||||
import ifcopenshell.api.unit
|
import ifcopenshell.api.unit
|
||||||
|
import ifcopenshell.util.unit
|
||||||
|
|
||||||
|
|
||||||
def test_create_representation():
|
def test_create_representation():
|
||||||
|
|||||||
Reference in New Issue
Block a user