From 5066fc5a294e5f7c447c46c000e7a61acb346d06 Mon Sep 17 00:00:00 2001 From: Richard Brice <37087370+RickBrice@users.noreply.github.com> Date: Tue, 24 Feb 2026 08:58:00 -0800 Subject: [PATCH] black --- .../api/alignment/_add_segment_to_curve.py | 5 +---- .../alignment/_create_offset_curve_representation.py | 2 +- .../api/alignment/clear_layout_segments.py | 4 +--- .../api/alignment/get_alignment_layout.py | 2 +- .../ifcopenshell/api/alignment/util.py | 12 +++++++++--- .../test/api/alignment/test_get_alignment_layout.py | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py index 90c44fef46..db493a3311 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py @@ -152,10 +152,7 @@ def _add_segment_to_curve(file: ifcopenshell.file, segment: entity_instance, cur axis_geom_subcontext = ifcopenshell.api.alignment.get_axis_subcontext(file) axis_representation = file.createIfcShapeRepresentation( - ContextOfItems=axis_geom_subcontext, - RepresentationIdentifier="Axis", - RepresentationType="Segment", - Items = items + ContextOfItems=axis_geom_subcontext, RepresentationIdentifier="Axis", RepresentationType="Segment", Items=items ) product = file.createIfcProductDefinitionShape(Representations=(axis_representation,)) diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py index a5675a4dc2..28a9f6ef49 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_create_offset_curve_representation.py @@ -36,7 +36,7 @@ def _create_offset_curve_representation( expected_type = "IfcAlignment" if not alignment.is_a(expected_type): raise TypeError(f"Expected {expected_type} but got {alignment.is_a()}") - + expected_type = "IfcPointByDistanceExpression" for offset in offsets: if not offset.is_a(expected_type): diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/clear_layout_segments.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/clear_layout_segments.py index 43e8875d63..4c534fea33 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/clear_layout_segments.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/clear_layout_segments.py @@ -71,9 +71,7 @@ def clear_layout_segments(file: ifcopenshell.file, layout: entity_instance) -> N """ expected_types = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant"] if layout.is_a() not in expected_types: - raise TypeError( - f"Expected entity type to be one of {expected_types}, instead received {layout.is_a()}" - ) + raise TypeError(f"Expected entity type to be one of {expected_types}, instead received {layout.is_a()}") # Get the geometric curve for this layout curve = ifcopenshell.api.alignment.get_layout_curve(layout) diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout.py index fdf7d29138..28d393e08e 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_alignment_layout.py @@ -32,7 +32,7 @@ def get_alignment_layout(segment: entity_instance) -> entity_instance: ) layout = None - layouts=["IfcAlignmentHorizontal","IfcAlignmentVertical","IfcAlignmentCant"] + layouts = ["IfcAlignmentHorizontal", "IfcAlignmentVertical", "IfcAlignmentCant"] for nest in segment.Nests: if nest.RelatingObject.is_a() in layouts: layout = nest.RelatingObject diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py index 7b4a0f1b71..7c06dafb1a 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py @@ -63,15 +63,21 @@ def evaluate_segment(segment: entity_instance, dist_along: float) -> np.ndarray: # Validate dist_along is within segment bounds # SegmentLength can be negative (indicates curve direction), so we need to handle both cases - seg_len = segment.SegmentLength.wrappedValue if hasattr(segment.SegmentLength, 'wrappedValue') else segment.SegmentLength + seg_len = ( + segment.SegmentLength.wrappedValue if hasattr(segment.SegmentLength, "wrappedValue") else segment.SegmentLength + ) if seg_len >= 0: # Positive length: valid range is 0 to seg_len if dist_along < 0 or dist_along > seg_len: - raise ValueError(f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength}).") + raise ValueError( + f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength})." + ) else: # Negative length: valid range is seg_len to 0 if dist_along > 0 or dist_along < seg_len: - raise ValueError(f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength}).") + raise ValueError( + f"Provided value {dist_along=} is beyond the end of the segment ({segment.SegmentLength})." + ) s = ifcopenshell.geom.settings() function_item = ifcopenshell_wrapper.map_shape(s, segment.wrapped_data) diff --git a/src/ifcopenshell-python/test/api/alignment/test_get_alignment_layout.py b/src/ifcopenshell-python/test/api/alignment/test_get_alignment_layout.py index 017b7eb58a..ce83d67691 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_get_alignment_layout.py +++ b/src/ifcopenshell-python/test/api/alignment/test_get_alignment_layout.py @@ -36,7 +36,7 @@ def test_get_alignment_layout(): parent=geometric_representation_context, ) - alignment = ifcopenshell.api.alignment.create(file,"Test",include_vertical=True,include_cant=True) + alignment = ifcopenshell.api.alignment.create(file, "Test", include_vertical=True, include_cant=True) horiz = ifcopenshell.api.alignment.get_horizontal_layout(alignment) vert = ifcopenshell.api.alignment.get_vertical_layout(alignment) cant = ifcopenshell.api.alignment.get_cant_layout(alignment) @@ -46,4 +46,4 @@ def test_get_alignment_layout(): assert cant == ifcopenshell.api.alignment.get_alignment_layout(cant.IsNestedBy[0].RelatedObjects[0]) -test_get_alignment_layout() \ No newline at end of file +test_get_alignment_layout()