Fix lint failures and add missing pyparsing dependency (#8048)

* unblock voxel schema loading, add test for express

* Apply black formatting

* Fix lint failures and add missing pyparsing dependency

* align ty -> 0.0.34
This commit is contained in:
Geert Hesselink
2026-05-18 22:17:45 +02:00
committed by GitHub
parent 4e406ab1ce
commit 508b99cb73
9 changed files with 19 additions and 17 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
uv tool install ruff uv tool install ruff
uv tool install black uv tool install black
uv tool install poethepoet uv tool install poethepoet
uv tool install ty uv tool install ty==0.0.34
# black doesn't catch all syntax errors, so we check them explicitly. # black doesn't catch all syntax errors, so we check them explicitly.
- name: Check syntax errors - name: Check syntax errors
+1 -1
View File
@@ -51,7 +51,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install xmlschema xsdata numpy lxml pytest isodate lark networkx tabulate python-dateutil shapely pip install xmlschema xsdata numpy lxml pytest isodate lark networkx tabulate python-dateutil shapely pyparsing
pip install src/bcf --no-deps pip install src/bcf --no-deps
pip install pytest-xdist==3.8.0 pip install pytest-xdist==3.8.0
+1 -2
View File
@@ -126,9 +126,8 @@ ssl._create_default_https_context = ssl._create_unverified_context
import time import time
from collections.abc import Generator, Sequence from collections.abc import Generator, Sequence
from pathlib import Path from pathlib import Path
from urllib.request import urlretrieve
from typing import Literal, Union from typing import Literal, Union
from urllib.request import urlretrieve
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
+5 -1
View File
@@ -468,7 +468,11 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, 0, tolerance=0.001) else existing_x_angle existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, 0, tolerance=0.001) else existing_x_angle
existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle
profiles = extrusion.SweptArea.Profiles if extrusion.SweptArea.is_a("IfcCompositeProfileDef") else [extrusion.SweptArea] profiles = (
extrusion.SweptArea.Profiles
if extrusion.SweptArea.is_a("IfcCompositeProfileDef")
else [extrusion.SweptArea]
)
for profile in profiles: for profile in profiles:
coord_list = builder.get_polyline_coords(profile.OuterCurve) coord_list = builder.get_polyline_coords(profile.OuterCurve)
coord_list = [ coord_list = [
+3 -7
View File
@@ -17,20 +17,20 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>. # along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import test.bim.bootstrap
import ifcopenshell.api.cost import ifcopenshell.api.cost
import bonsai.core.tool import bonsai.core.tool
import bonsai.tool as tool import bonsai.tool as tool
import test.bim.bootstrap import test.bim.bootstrap
from bonsai.tool.cost import Cost as subject
from test.bim.bootstrap import NewFile from test.bim.bootstrap import NewFile
from bonsai.tool.cost import Cost as subject
class TestImplementsTool(NewFile): class TestImplementsTool(NewFile):
def test_run(self): def test_run(self):
assert isinstance(subject(), bonsai.core.tool.Cost) assert isinstance(subject(), bonsai.core.tool.Cost)
class TestDisableEditingCostItemParent(NewFile): class TestDisableEditingCostItemParent(NewFile):
def test_avoid_recursion_error(newfile, monkeypatch): def test_avoid_recursion_error(newfile, monkeypatch):
class DummyProps: class DummyProps:
@@ -39,11 +39,7 @@ class TestDisableEditingCostItemParent(NewFile):
self.active_cost_item_id = 5 self.active_cost_item_id = 5
props = DummyProps() props = DummyProps()
monkeypatch.setattr( monkeypatch.setattr("bonsai.tool.Cost.get_cost_props", lambda: props)
"bonsai.tool.Cost.get_cost_props",
lambda: props
)
subject.disable_editing_cost_item_parent() subject.disable_editing_cost_item_parent()
assert props.active_cost_item_id == 0 assert props.active_cost_item_id == 0
assert props.change_cost_item_parent is not False assert props.change_cost_item_parent is not False
+4 -1
View File
@@ -538,7 +538,10 @@ 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(*filter(None, (ARRANGE_POLYGON_SETTINGS,)), polies) arranged = W.arrange_polygons(
*filter(None, (ARRANGE_POLYGON_SETTINGS,)),
polies, # ty: ignore[too-many-positional-arguments]
)
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]
@@ -1695,7 +1695,7 @@ class type_declaration(declaration):
class uninitialized_tag: ... class uninitialized_tag: ...
def arrange_polygons(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): ...
def construct_iterator_with_include_exclude(geometry_library, settings, file, elems, include, num_threads): ... def construct_iterator_with_include_exclude(geometry_library, settings, file, elems, include, num_threads): ...
+1
View File
@@ -21,6 +21,7 @@ dependencies = [
"isodate", "isodate",
"python-dateutil", "python-dateutil",
"lark", "lark",
"pyparsing",
"typing-extensions", "typing-extensions",
] ]
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.control import ifcopenshell.api.control
import ifcopenshell.api.cost import ifcopenshell.api.cost
@@ -25,6 +24,7 @@ import ifcopenshell.api.root
import ifcopenshell.util.cost as subject import ifcopenshell.util.cost as subject
class TestGetCostItemForProduct(test.bootstrap.IFC4): class TestGetCostItemForProduct(test.bootstrap.IFC4):
def test_run(self): def test_run(self):
model = self.file model = self.file
@@ -40,7 +40,7 @@ class TestGetCostItemForProduct(test.bootstrap.IFC4):
cost_schedule = ifcopenshell.api.cost.add_cost_schedule(model) cost_schedule = ifcopenshell.api.cost.add_cost_schedule(model)
item1 = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=cost_schedule) item1 = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=cost_schedule)
ifcopenshell.api.control.assign_control(model, related_objects=[element], relating_control=item1) ifcopenshell.api.control.assign_control(model, related_objects=[element], relating_control=item1)
ifcopenshell.api.cost.remove_cost_item(model, cost_item = item1) ifcopenshell.api.cost.remove_cost_item(model, cost_item=item1)
assert list(subject.get_cost_items_for_product(element)) == [] assert list(subject.get_cost_items_for_product(element)) == []
def test_no_assigned_cost_items(self): def test_no_assigned_cost_items(self):
@@ -49,4 +49,3 @@ class TestGetCostItemForProduct(test.bootstrap.IFC4):
cost_schedule = ifcopenshell.api.cost.add_cost_schedule(model) cost_schedule = ifcopenshell.api.cost.add_cost_schedule(model)
item1 = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=cost_schedule) item1 = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=cost_schedule)
assert list(subject.get_cost_items_for_product(element)) == [] assert list(subject.get_cost_items_for_product(element)) == []