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

@ -6,12 +6,12 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddAnalysisCasesCommand,
DeleteAnalysisCasesCommand,
UpdateAnalysisCaseCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
LinearTimeSeries,
ModalCase,
NodalLoad,
@ -20,7 +20,7 @@ from otko.core import ( # noqa: E402
StaticCase,
TransientCase,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
def _vm_with_pattern() -> ProjectViewModel:

View file

@ -12,21 +12,21 @@ import pytest
pytest.importorskip("PySide6")
pytest.importorskip("openseespy.opensees")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddAnalysisCasesCommand,
AddElementsCommand,
AddNodalLoadsCommand,
AddNodesCommand,
AddSectionsCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
Node,
StaticCase,
)
from otko.services.results import StaticResults # noqa: E402
from otko.viewmodels import AnalysisRunner, ProjectViewModel # noqa: E402
from otko.services.results import StaticResults
from otko.viewmodels import AnalysisRunner, ProjectViewModel
@pytest.fixture

View file

@ -6,15 +6,14 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import AddNodalLoadsCommand # noqa: E402
from otko.core import ( # noqa: E402
from otko.commands import AddNodalLoadsCommand
from otko.core import (
LinearTimeSeries,
Node,
PlainLoadPattern,
Project,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.views.dialogs.assign_load import AssignLoadDialog # noqa: E402
from otko.viewmodels import ProjectViewModel
from otko.views.dialogs.assign_load import AssignLoadDialog
@pytest.mark.gui

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.views.dialogs.assign_masses import AssignMassesDialog # noqa: E402
from otko.views.dialogs.assign_masses import AssignMassesDialog
@pytest.mark.gui

View file

@ -6,12 +6,12 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticSection,
Node,
Project,
)
from otko.views.dialogs.assign_zls import ( # noqa: E402
from otko.views.dialogs.assign_zls import (
AssignZeroLengthSectionDialog,
)

View file

@ -12,7 +12,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
CoordinateGridSystem,
CoordinateSystem,
GridSystem,

View file

@ -6,13 +6,13 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
NodalLoad,
PlainLoadPattern,
StaticCase,
TransientCase,
)
from otko.views.dialogs.case_forms import TransientCaseForm # noqa: E402
from otko.views.dialogs.case_forms import TransientCaseForm
def _patterns(): # type: ignore[no-untyped-def]

View file

@ -11,15 +11,14 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddElementsCommand,
AddNodalLoadsCommand,
AddNodesCommand,
DeleteElementsCommand,
DeleteNodesCommand,
SetRestraintCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
LinearTimeSeries,
NodalLoad,
Node,
@ -27,7 +26,7 @@ from otko.core import ( # noqa: E402
Steel01,
TrussElement,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
# ─────────────────────────── helpers ────────────────────────────────

View file

@ -6,21 +6,21 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddElementsCommand,
AddMaterialsCommand,
AddNodesCommand,
AddSectionsCommand,
ConvertElementTypeCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
ElasticUniaxial,
Node,
TrussElement,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
def _vm_setup() -> ProjectViewModel:

View file

@ -6,9 +6,9 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import LinearTimeSeries, Project # noqa: E402
from otko.views.dialogs.linear_time_series import LinearTimeSeriesDialog # noqa: E402
from otko.views.dialogs.plain_pattern import PlainPatternDialog # noqa: E402
from otko.core import LinearTimeSeries, Project
from otko.views.dialogs.linear_time_series import LinearTimeSeriesDialog
from otko.views.dialogs.plain_pattern import PlainPatternDialog
@pytest.mark.gui

View file

@ -11,11 +11,11 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import AddNodesCommand # noqa: E402
from otko.core import ElasticBeamColumn, ElasticSection, Node # noqa: E402
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.views.canvas3d import SelectionState # noqa: E402
from otko.views.tools.draw_frame import DrawFrameTool # noqa: E402
from otko.commands import AddNodesCommand
from otko.core import ElasticBeamColumn, ElasticSection, Node
from otko.viewmodels import ProjectViewModel
from otko.views.canvas3d import SelectionState
from otko.views.tools.draw_frame import DrawFrameTool
class _CanvasStub:

View file

@ -10,10 +10,10 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import GridSystem, Node, Project # noqa: E402
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.views.canvas3d.selection import SelectionState # noqa: E402
from otko.views.tools.draw_node import ( # noqa: E402
from otko.core import GridSystem, Node
from otko.viewmodels import ProjectViewModel
from otko.views.canvas3d.selection import SelectionState
from otko.views.tools.draw_node import (
DrawNodeTool,
_snap_to_grid,
)

View file

@ -6,18 +6,17 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
CoordinateGridSystem,
CoordinateSystem,
ElasticUniaxial,
GridSystem,
Node,
TrussElement,
make_grid_lines,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.views.canvas3d.selection import SelectionState # noqa: E402
from otko.views.tools.draw_truss import DrawTrussTool # noqa: E402
from otko.viewmodels import ProjectViewModel
from otko.views.canvas3d.selection import SelectionState
from otko.views.tools.draw_truss import DrawTrussTool
class _CanvasStub:

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
CoordinateGridSystem,
CoordinateSystem,
GridLine,

View file

@ -6,10 +6,10 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import Concrete04 # noqa: E402
from otko.views.dialogs.material_forms import ( # noqa: E402
Concrete04Form,
from otko.core import Concrete04
from otko.views.dialogs.material_forms import (
FORM_REGISTRY,
Concrete04Form,
)

View file

@ -10,7 +10,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.views.dialogs.material_forms import ( # noqa: E402
from otko.views.dialogs.material_forms import (
Concrete01Form,
Concrete02Form,
Steel01Form,

View file

@ -8,17 +8,16 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddLoadPatternCommand,
AddTimeSeriesCommand,
)
from otko.core import ( # noqa: E402
Node,
from otko.core import (
PathTimeSeries,
Project,
UniformExcitationPattern,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
# ─────────────── AddTimeSeriesCommand / AddLoadPatternCommand ──────────────

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddElementsCommand,
AddMaterialsCommand,
AddNodesCommand,
@ -16,7 +16,7 @@ from otko.commands import ( # noqa: E402
UpdateMaterialCommand,
UpdateSectionCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
Node,
@ -24,7 +24,7 @@ from otko.core import ( # noqa: E402
Steel02,
TrussElement,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
def _vm_with_steel() -> ProjectViewModel:

View file

@ -10,13 +10,10 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
Concrete01,
from otko.core import (
Concrete02,
ElasticIsotropic,
ElasticPP,
ElasticSection,
ElasticUniaxial,
Steel01,
Steel02,
)
@ -100,10 +97,14 @@ def test_elastic_section_form_round_trip(qtbot) -> None: # type: ignore[no-unty
def test_form_for_dispatches_by_type(qtbot) -> None: # type: ignore[no-untyped-def]
from otko.views.dialogs.material_forms import (
Steel01Form,
)
from otko.views.dialogs.material_forms import (
form_for as material_form_for,
)
from otko.views.dialogs.section_forms import (
ElasticSectionForm,
)
from otko.views.dialogs.section_forms import (
form_for as section_form_for,
)

View file

@ -7,9 +7,9 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import UnitSystem # noqa: E402
from otko.services.results import PushoverResults # noqa: E402
from otko.views.docks.pushover_curve import ( # noqa: E402
from otko.core import UnitSystem
from otko.services.results import PushoverResults
from otko.views.docks.pushover_curve import (
PushoverCurveView,
_is_rotation_dof,
)

View file

@ -8,11 +8,11 @@ import pytest
pytest.importorskip("PySide6")
from PySide6.QtCore import QObject, Signal # noqa: E402
from PySide6.QtCore import QObject, Signal
from otko.core import LinearTimeSeries, PlainLoadPattern, Project, TransientCase # noqa: E402
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.views.dialogs.run_analysis import RunAnalysisDialog # noqa: E402
from otko.core import LinearTimeSeries, PlainLoadPattern, TransientCase
from otko.viewmodels import ProjectViewModel
from otko.views.dialogs.run_analysis import RunAnalysisDialog
class _FakeRunner(QObject):

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
Node,

View file

@ -7,14 +7,14 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
AggregatorDOF,
ElasticSection,
FiberSection,
RectangularPatch,
SectionAggregator,
)
from otko.views.dialogs.section_forms import ( # noqa: E402
from otko.views.dialogs.section_forms import (
FORM_REGISTRY,
form_for,
)

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.views.canvas3d import SelectionState # noqa: E402
from otko.views.canvas3d import SelectionState
@pytest.mark.gui

View file

@ -6,15 +6,15 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddElementsCommand,
AddNodesCommand,
MirrorCommand,
MoveNodesCommand,
ReplicateCommand,
)
from otko.core import Node, Steel01, TrussElement # noqa: E402
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.core import Node, Steel01, TrussElement
from otko.viewmodels import ProjectViewModel
def _populated_vm() -> ProjectViewModel:

View file

@ -6,10 +6,9 @@ import pytest
pytest.importorskip("PySide6")
from PySide6.QtCore import Qt # noqa: E402
from PySide6.QtWidgets import QTreeWidget # noqa: E402
from PySide6.QtWidgets import QTreeWidget
from otko.core import Node # noqa: E402
from otko.core import Node
@pytest.mark.gui

View file

@ -6,7 +6,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import UnitSystem # noqa: E402
from otko.core import UnitSystem
@pytest.mark.gui

View file

@ -6,18 +6,18 @@ import pytest
pytest.importorskip("PySide6")
from otko.commands import ( # noqa: E402
from otko.commands import (
AddElementsCommand,
AddMaterialsCommand,
AddNodesCommand,
UpdateElementFieldsCommand,
)
from otko.core import ( # noqa: E402
from otko.core import (
ElasticUniaxial,
Node,
TrussElement,
)
from otko.viewmodels import ProjectViewModel # noqa: E402
from otko.viewmodels import ProjectViewModel
def _vm_with_truss() -> ProjectViewModel:

View file

@ -7,7 +7,7 @@ import pytest
pytest.importorskip("PySide6")
from otko.core import ( # noqa: E402
from otko.core import (
CoordinateGridSystem,
GridSystem,
Project,

View file

@ -11,7 +11,7 @@ import pytest
pytest.importorskip("openseespy")
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -25,7 +25,7 @@ def test_basic_truss_matches_opensees_tcl_reference() -> None:
a linear rescale of the Tcl model — any deviation would flag a
real solver/translation issue.
"""
from examples.basic_truss import build_basic_truss, IN_TO_M
from examples.basic_truss import IN_TO_M, build_basic_truss
proj = build_basic_truss()
runner = OpenSeesRunner(proj)
@ -45,6 +45,7 @@ def test_basic_truss_matches_opensees_tcl_reference() -> None:
def test_basic_truss_round_trips(tmp_path) -> None: # type: ignore[no-untyped-def]
"""The example project must survive save/load without any information loss."""
from examples.basic_truss import build_basic_truss
from otko.services import load_project, save_project
p = build_basic_truss()

View file

@ -9,8 +9,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -8,7 +8,7 @@ import pytest
ops = pytest.importorskip("openseespy.opensees") # skip if OpenSeesPy not installed
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
LinearTimeSeries,
@ -20,8 +20,8 @@ from otko.core import ( # noqa: E402
Project,
StaticCase,
)
from otko.services import OpenSeesRunner, evaluate_combination # noqa: E402
from otko.services.results import StaticResults # noqa: E402
from otko.services import OpenSeesRunner, evaluate_combination
from otko.services.results import StaticResults
pytestmark = pytest.mark.slow

View file

@ -18,7 +18,7 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import ( # noqa: E402
from otko.core import (
Concrete04,
FiberSection,
ForceBeamColumn,
@ -32,7 +32,7 @@ from otko.core import ( # noqa: E402
StaticCase,
UnitSystem,
)
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -11,7 +11,7 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticUniaxial,
LinearTimeSeries,
NodalLoad,
@ -21,7 +21,7 @@ from otko.core import ( # noqa: E402
StaticCase,
TrussElement,
)
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -8,9 +8,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import ModalCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import ModalCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -8,9 +8,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import ModalCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import ModalCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -8,9 +8,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import ModalCase, StaticCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import ModalCase, StaticCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -29,7 +29,6 @@ def _reload(proj, tmp_path): # type: ignore[no-untyped-def]
def test_elastic_frame_gravity_reactions(tmp_path) -> None: # type: ignore[no-untyped-def]
"""ΣFy at base = total applied gravity (distributed w × beam × floors)."""
from examples.elastic_frame import (
BAY,
LOAD_F1,
LOAD_F2,
LOAD_F3,
@ -70,7 +69,6 @@ def test_elastic_frame_gravity_reactions(tmp_path) -> None: # type: ignore[no-u
def test_elastic_frame_gravity_plus_lateral_reactions(tmp_path) -> None: # type: ignore[no-untyped-def]
"""ΣFx at base must equal -(lateral applied) within PDelta tolerance."""
from examples.elastic_frame import (
BAY,
LOAD_F1,
LOAD_F2,
LOAD_F3,
@ -120,5 +118,5 @@ def test_elastic_frame_modal_periods(tmp_path) -> None: # type: ignore[no-untyp
# 0.1930, 0.1562, 0.130 s. Our solve nails these within 1.5%.
expected = [1.040, 0.3526, 0.1930, 0.1562, 0.130]
periods = [2.0 * math.pi / math.sqrt(v) for v in r.eigenvalues]
for i, (T, T_ref) in enumerate(zip(periods, expected), start=1):
assert T == pytest.approx(T_ref, rel=0.02), f"T{i} = {T:.4f} s, reference {T_ref:.4f} s"
for i, (T, T_ref) in enumerate(zip(periods, expected, strict=False), start=1):
assert pytest.approx(T_ref, rel=0.02) == T, f"T{i} = {T:.4f} s, reference {T_ref:.4f} s"

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,8 +9,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,9 +9,9 @@ import pytest
pytest.importorskip("openseespy")
from otko.core import PushoverCase, TransientCase # noqa: E402
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.core import PushoverCase, TransientCase
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -8,13 +8,11 @@ behaviour is exercised by the Phase 9 pushover tests.
from __future__ import annotations
import math
import pytest
pytest.importorskip("openseespy")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticUniaxial,
FiberSection,
LinearTimeSeries,
@ -26,7 +24,7 @@ from otko.core import ( # noqa: E402
StaticCase,
ZeroLengthSectionElement,
)
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -134,7 +132,7 @@ def test_pushover_drives_rotation_for_moment_curvature() -> None:
# Every (κ, M) point must satisfy M = E·I·κ (1 % tolerance allows
# for the ~20-fibre discretisation of the rectangular section).
for kappa, moment in zip(result.control_disp, result.base_shear):
for kappa, moment in zip(result.control_disp, result.base_shear, strict=False):
if abs(kappa) < 1e-12:
continue
expected_M = E * I * kappa

View file

@ -6,8 +6,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -15,13 +15,13 @@ pytestmark = pytest.mark.slow
def test_moment_curvature_example_round_trips_and_converges(tmp_path) -> None: # type: ignore[no-untyped-def]
"""build_moment_curvature() → save → load → run → expected shape."""
from examples.moment_curvature import (
build_moment_curvature,
COL_DEPTH,
COVER,
E_STEEL,
FY,
MU,
NUM_INCR,
build_moment_curvature,
)
proj = build_moment_curvature()

View file

@ -8,7 +8,7 @@ import pytest
ops = pytest.importorskip("openseespy.opensees") # skip if OpenSeesPy not installed
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
LinearTimeSeries,
@ -18,7 +18,7 @@ from otko.core import ( # noqa: E402
Project,
StaticCase,
)
from otko.services import OpenSeesRunner # noqa: E402
from otko.services import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -9,8 +9,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -18,9 +18,8 @@ pytestmark = pytest.mark.slow
def test_rc_frame_earthquake_runs_and_has_oscillatory_response(tmp_path) -> None: # type: ignore[no-untyped-def]
"""Synthetic ground motion produces bounded, oscillatory response."""
from examples.rc_frame_earthquake import (
build_rc_frame_earthquake,
DT,
N_PTS,
build_rc_frame_earthquake,
)
proj = build_rc_frame_earthquake()

View file

@ -6,8 +6,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -22,7 +22,7 @@ def test_rc_frame_gravity_matches_opensees_reference(tmp_path) -> None: # type:
The column axial force is 180 kip compression (from the 180 kip
load stepped onto each top node).
"""
from examples.rc_frame_gravity import build_rc_frame_gravity, P_LOAD
from examples.rc_frame_gravity import P_LOAD, build_rc_frame_gravity
proj = build_rc_frame_gravity()
proj.validate_references()

View file

@ -6,8 +6,8 @@ import pytest
pytest.importorskip("openseespy")
from otko.services import load_project, save_project # noqa: E402
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
from otko.services import load_project, save_project
from otko.services.opensees_runner import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -19,10 +19,11 @@ def test_rc_frame_pushover_reaches_target_with_fallback(tmp_path) -> None: # ty
AND shows expected nonlinear shape.
"""
from examples.rc_frame_pushover import (
build_rc_frame_pushover,
D_STEP,
D_TARGET,
build_rc_frame_pushover,
)
from otko.core import PushoverCase
proj = build_rc_frame_pushover()

View file

@ -23,7 +23,7 @@ import pytest
ops = pytest.importorskip("openseespy.opensees")
h5py = pytest.importorskip("h5py")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticUniaxial,
ImposedSupportMotionPattern,
Node,
@ -33,7 +33,7 @@ from otko.core import ( # noqa: E402
UniformExcitationPattern,
ZeroLengthElement,
)
from otko.services import OpenSeesRunner # noqa: E402
from otko.services import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -15,16 +15,16 @@ import math
import pytest
ops = pytest.importorskip("openseespy.opensees") # noqa: F401
ops = pytest.importorskip("openseespy.opensees")
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
ModalCase,
Node,
Project,
)
from otko.services import OpenSeesRunner # noqa: E402
from otko.services import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -12,7 +12,7 @@ import pytest
ops = pytest.importorskip("openseespy.opensees") # skip if OpenSeesPy not installed
from otko.core import ( # noqa: E402
from otko.core import (
ElasticBeamColumn,
ElasticSection,
LinearTimeSeries,
@ -22,7 +22,7 @@ from otko.core import ( # noqa: E402
Project,
StaticCase,
)
from otko.services import OpenSeesRunner # noqa: E402
from otko.services import OpenSeesRunner
pytestmark = pytest.mark.slow

View file

@ -12,10 +12,10 @@ import math
import numpy as np
import pytest
ops = pytest.importorskip("openseespy.opensees") # noqa: F401
h5py = pytest.importorskip("h5py") # noqa: F401
ops = pytest.importorskip("openseespy.opensees")
h5py = pytest.importorskip("h5py")
from otko.core import ( # noqa: E402
from otko.core import (
ConstantTimeSeries,
ElasticBeamColumn,
ElasticSection,
@ -27,7 +27,7 @@ from otko.core import ( # noqa: E402
StaticCase,
TransientCase,
)
from otko.services import OpenSeesRunner # noqa: E402
from otko.services import OpenSeesRunner
pytestmark = pytest.mark.slow
@ -51,7 +51,6 @@ def test_sdof_free_vibration_matches_cosine(tmp_path) -> None: # type: ignore[n
# (already done), then verify dt-step Newmark integration of free
# vibration starting from a static IC.
F0 = 100.0
u0 = F0 / k
project = Project(
ndm=2,

View file

@ -19,7 +19,6 @@ from otko.services.element_forces import (
)
from otko.services.results import StaticResults
# ──────────────────────────────────────────────────────────────────────
# Fixtures: a tiny 3D project with 2 elements + canned force results.
# ──────────────────────────────────────────────────────────────────────

View file

@ -23,7 +23,6 @@ from otko.core import (
Node,
PlainLoadPattern,
Project,
StaticCase,
Steel01,
TrussElement,
ZeroLengthElement,

View file

@ -10,7 +10,6 @@ from otko.core import (
CircularPatch,
ElasticSection,
FiberSection,
Project,
RectangularPatch,
StraightLayer,
)

View file

@ -13,6 +13,7 @@ import json
from pathlib import Path
import pytest
from tools.gidopensees_import.parse_schemas import (
ParseError,
_parse_dependencies,

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),