style: resolve the remaining ruff findings
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / type (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.12) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.12) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.12) (pull_request) Has been cancelled
CI / test-gui (pull_request) Has been cancelled
CI / test-integration (macos-latest) (pull_request) Has been cancelled
CI / test-integration (ubuntu-latest) (pull_request) Has been cancelled
CI / test-integration (windows-latest) (pull_request) Has been cancelled

Auto-fixes (UP037, UP038, F401, I001, SIM105, RUF100) plus hand-fixes:
drop the now-unused `Union` imports, annotate mutable class attributes
with ClassVar, raise ValidationError instead of blind Exception in the
zero-length test, delete two dead locals, and bind the per-iteration
grid-builder closures to their loop variables (B023).
This commit is contained in:
smillmorel 2026-09-16 13:20:36 -04:00
commit 61b850bf46
126 changed files with 359 additions and 397 deletions

View file

@ -136,6 +136,7 @@ class TestConcrete04JsonRoundTrip:
def test_old_osmodel_without_concrete04_loads_cleanly(self) -> None:
"""An osmodel payload that doesn't mention Concrete04 is unaffected."""
from pathlib import Path
from otko.services import load_project
osmodel = Path(__file__).parents[4] / "examples" / "cantilever.osmodel"

View file

@ -15,21 +15,21 @@ import pytest
# Force pyvista off-screen before any pyvista import in this module's chain.
os.environ.setdefault("PYVISTA_OFF_SCREEN", "true")
import pyvista as pv # noqa: E402
import pyvista as pv
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
Node,
Project,
)
from otko.services.element_forces import ( # noqa: E402
from otko.services.element_forces import (
DiagramData,
ForceComponent,
extract_diagram_data,
)
from otko.services.results import StaticResults # noqa: E402
from otko.views.canvas3d.diagram_renderer import DiagramRenderer # noqa: E402
from otko.services.results import StaticResults
from otko.views.canvas3d.diagram_renderer import DiagramRenderer
pv.OFF_SCREEN = True

View file

@ -6,8 +6,8 @@ import pytest
from pydantic import TypeAdapter, ValidationError
from otko.core import (
Element,
ElasticBeamColumn,
Element,
ForceBeamColumn,
TrussElement,
ZeroLengthElement,

View file

@ -2,7 +2,6 @@
from __future__ import annotations
import math
from pathlib import Path
import pytest
@ -174,7 +173,7 @@ def test_coord_system_round_trip_world_local() -> None:
p_local = (1.5, -0.5, 2.0)
p_world = cs.local_to_world(p_local)
p_back = cs.world_to_local(p_world)
for a, b in zip(p_local, p_back):
for a, b in zip(p_local, p_back, strict=False):
assert a == pytest.approx(b, abs=1e-9)

View file

@ -8,7 +8,6 @@
from __future__ import annotations
import numpy as np
import pytest
from otko.commands.nodes import SetMassCommand

View file

@ -10,9 +10,7 @@ import pytest
from otko.core import (
AggregatorDOF,
CircularPatch,
ElasticSection,
FiberSection,
Fibre,
Project,
RectangularPatch,
SectionAggregator,
@ -155,7 +153,7 @@ def test_Iz_of_rect_matches_analytical() -> None:
# ── Round-trip persistence ───────────────────────────────────────────
def test_fiber_section_with_patches_round_trips(tmp_path) -> None: # type: ignore[no-untyped-def]
from otko.core import Node, ElasticBeamColumn
from otko.core import ElasticBeamColumn, Node
p = Project(
nodes=[Node(id=1, coords=(0, 0, 0)), Node(id=2, coords=(1, 0, 0))],

View file

@ -5,9 +5,9 @@ from __future__ import annotations
import pytest
pv = pytest.importorskip("pyvista")
import numpy as np # noqa: E402
import numpy as np
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
LinearTimeSeries,
@ -18,8 +18,8 @@ from otko.core import ( # noqa: E402
Steel01,
TrussElement,
)
from otko.services.deformation import DeformationSource # noqa: E402
from otko.views.canvas3d.model_renderer import ( # noqa: E402
from otko.services.deformation import DeformationSource
from otko.views.canvas3d.model_renderer import (
ModelRenderer,
RendererMode,
_classify_support,

View file

@ -2,8 +2,6 @@
from __future__ import annotations
import pytest
from otko.core import UnitSystem, labels_for

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import pytest
from pydantic import ValidationError
from otko.core import (
ElasticSection,
@ -21,7 +22,7 @@ def test_zero_length_section_schema_defaults() -> None:
def test_zero_length_section_rejects_extra_fields() -> None:
with pytest.raises(Exception):
with pytest.raises(ValidationError):
ZeroLengthSectionElement(
id=1,
nodes=(1, 2),