diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index 4ef84f8cbb..677ec10c25 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -30,7 +30,7 @@ jobs: uv tool install ruff uv tool install black 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. - name: Check syntax errors diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0580a4b061..2084496669 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: Install dependencies run: | 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 pytest-xdist==3.8.0 diff --git a/nix/build-all.py b/nix/build-all.py index cc7978d9b1..cd04bc5f24 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -125,9 +125,8 @@ ssl._create_default_https_context = ssl._create_unverified_context import time from collections.abc import Generator, Sequence from pathlib import Path -from urllib.request import urlretrieve - from typing import Literal, Union +from urllib.request import urlretrieve logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index b5d2f5fa77..dd900f4a23 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -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, 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: coord_list = builder.get_polyline_coords(profile.OuterCurve) coord_list = [ diff --git a/src/bonsai/test/tool/test_cost.py b/src/bonsai/test/tool/test_cost.py index 3cfbe03c91..564337a8d4 100644 --- a/src/bonsai/test/tool/test_cost.py +++ b/src/bonsai/test/tool/test_cost.py @@ -17,20 +17,20 @@ # along with Bonsai. If not, see . -import test.bim.bootstrap import ifcopenshell.api.cost import bonsai.core.tool import bonsai.tool as tool import test.bim.bootstrap +from bonsai.tool.cost import Cost as subject from test.bim.bootstrap import NewFile -from bonsai.tool.cost import Cost as subject class TestImplementsTool(NewFile): def test_run(self): assert isinstance(subject(), bonsai.core.tool.Cost) + class TestDisableEditingCostItemParent(NewFile): def test_avoid_recursion_error(newfile, monkeypatch): class DummyProps: @@ -39,11 +39,7 @@ class TestDisableEditingCostItemParent(NewFile): self.active_cost_item_id = 5 props = DummyProps() - monkeypatch.setattr( - "bonsai.tool.Cost.get_cost_props", - lambda: props - ) + monkeypatch.setattr("bonsai.tool.Cost.get_cost_props", lambda: props) subject.disable_editing_cost_item_parent() assert props.active_cost_item_id == 0 assert props.change_cost_item_parent is not False - diff --git a/src/ifcopenshell-python/ifcopenshell/draw.py b/src/ifcopenshell-python/ifcopenshell/draw.py index c37457d80e..7ea766ebe6 100644 --- a/src/ifcopenshell-python/ifcopenshell/draw.py +++ b/src/ifcopenshell-python/ifcopenshell/draw.py @@ -528,7 +528,10 @@ def main( *(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) dom3 = parseString(svg_data_3) svg3 = dom3.childNodes[0] diff --git a/src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.pyi b/src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.pyi index 777c00d106..84f0b5aa2d 100644 --- a/src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.pyi +++ b/src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.pyi @@ -1687,7 +1687,7 @@ class type_declaration(declaration): class uninitialized_tag: ... -def arrange_polygons(polygons): ... +def arrange_polygons(settings, polygons): ... def clear_plugin_search_paths() -> None: ... def clear_schemas(): ... def construct_iterator(geometry_library, settings, file, num_threads): ... diff --git a/src/ifcopenshell-python/pyproject.toml b/src/ifcopenshell-python/pyproject.toml index 9bcaeeebaa..288e3e3585 100644 --- a/src/ifcopenshell-python/pyproject.toml +++ b/src/ifcopenshell-python/pyproject.toml @@ -21,6 +21,7 @@ dependencies = [ "isodate", "python-dateutil", "lark", + "pyparsing", "typing-extensions", ] diff --git a/src/ifcopenshell-python/test/util/test_cost.py b/src/ifcopenshell-python/test/util/test_cost.py index 516a69edd0..d0f9612673 100644 --- a/src/ifcopenshell-python/test/util/test_cost.py +++ b/src/ifcopenshell-python/test/util/test_cost.py @@ -16,7 +16,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with IfcOpenShell. If not, see . -import pytest import ifcopenshell.api.control import ifcopenshell.api.cost @@ -25,6 +24,7 @@ import ifcopenshell.api.root import ifcopenshell.util.cost as subject + class TestGetCostItemForProduct(test.bootstrap.IFC4): def test_run(self): model = self.file @@ -40,7 +40,7 @@ class TestGetCostItemForProduct(test.bootstrap.IFC4): cost_schedule = ifcopenshell.api.cost.add_cost_schedule(model) 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.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)) == [] 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) item1 = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=cost_schedule) assert list(subject.get_cost_items_for_product(element)) == [] -