mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+1
-2
@@ -126,9 +126,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)
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -17,20 +17,20 @@
|
||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -538,7 +538,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]
|
||||
|
||||
@@ -1695,7 +1695,7 @@ class type_declaration(declaration):
|
||||
|
||||
class uninitialized_tag: ...
|
||||
|
||||
def arrange_polygons(polygons): ...
|
||||
def arrange_polygons(settings, polygons): ...
|
||||
def clear_schemas(): ...
|
||||
def construct_iterator(geometry_library, settings, file, num_threads): ...
|
||||
def construct_iterator_with_include_exclude(geometry_library, settings, file, elems, include, num_threads): ...
|
||||
|
||||
@@ -21,6 +21,7 @@ dependencies = [
|
||||
"isodate",
|
||||
"python-dateutil",
|
||||
"lark",
|
||||
"pyparsing",
|
||||
"typing-extensions",
|
||||
]
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)) == []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user