Fix RUF015 (next() instead of list comprehensions[0])

https://docs.astral.sh/ruff/rules/-iterable-allocation-for-first-element/
This commit is contained in:
Andrej730
2025-06-16 12:29:41 +05:00
parent b486b32c8d
commit a12bb343ca
29 changed files with 64 additions and 61 deletions
@@ -48,14 +48,14 @@ def create_segment_representations(
representation.RepresentationIdentifier == "FootPrint" and representation.RepresentationType == "Curve2D"
):
curve = ifcopenshell.api.alignment.get_basis_curve(alignment)
nested_alignment = [
nested_alignment = next(
c for c in ifcopenshell.util.element.get_components(alignment) if c.is_a("IfcAlignmentHorizontal")
][0]
)
elif representation.RepresentationIdentifier == "Axis" and representation.RepresentationType == "Curve3D":
curve = ifcopenshell.api.alignment.get_curve(alignment)
nested_alignment = [
nested_alignment = next(
c for c in ifcopenshell.util.element.get_components(alignment) if c.is_a("IfcAlignmentVertical")
][0]
)
curve_segments = curve.Segments
segments = nested_alignment.IsNestedBy[0].RelatingObjects