added ruff test
This commit is contained in:
@@ -18,6 +18,7 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
APP_ROOT = Path(__file__).resolve().parents[1]
|
||||
REPO_ROOT = APP_ROOT.parents[1]
|
||||
for _path in (APP_ROOT / "src", REPO_ROOT / "shared" / "src"):
|
||||
@@ -185,7 +186,6 @@ def _fake_packet(
|
||||
something visible (see ``ui_snapshot --scene replay``).
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from orisys_app_shared.acquisition.sdk_worker import SdkPacket
|
||||
|
||||
nan = float("nan")
|
||||
@@ -558,12 +558,10 @@ def audit_palette(verbose: bool = False) -> list[str]:
|
||||
|
||||
|
||||
def main() -> int:
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from orisys_app_shared.force.calibration_io import CalSample
|
||||
from orisys_app_shared.i18n import set_locale, t
|
||||
from orisys_app_shared.theme import build_qss, load_colors
|
||||
from orisys_studio.app_window import VIEW_SPLITTER_SIZES, StudioMainWindow
|
||||
from orisys_studio.app_window import StudioMainWindow
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
app = QApplication.instance() or QApplication(sys.argv)
|
||||
set_locale("zh_CN")
|
||||
@@ -768,12 +766,14 @@ def main() -> int:
|
||||
window.cal_panel.table.item(1, 5).text() == t("cal.state_excluded"),
|
||||
"the excluded row does not show its state",
|
||||
)
|
||||
import orisys.calibration as _sdk_calibration
|
||||
from orisys_app_shared.force.calibration_io import (
|
||||
build_export_model,
|
||||
build_force_calibration_v2 as _build_v2,
|
||||
predict_channel,
|
||||
)
|
||||
import orisys.calibration as _sdk_calibration
|
||||
from orisys_app_shared.force.calibration_io import (
|
||||
build_force_calibration_v2 as _build_v2,
|
||||
)
|
||||
|
||||
store = window.cal_panel._store
|
||||
model = build_export_model(
|
||||
@@ -1798,6 +1798,7 @@ def main() -> int:
|
||||
section("acquisition correctness")
|
||||
import csv as _csv
|
||||
import shutil as _shutil
|
||||
|
||||
import numpy as np
|
||||
|
||||
# A device that only confirms its calibration a moment after the first
|
||||
@@ -2090,6 +2091,10 @@ def main() -> int:
|
||||
env=env,
|
||||
capture_output=True,
|
||||
timeout=60,
|
||||
# Deliberately not ``check=True``: a non-zero exit *is* one of the things
|
||||
# being measured here (a crash on shutdown), and it is reported through
|
||||
# this checker's own ``check()`` below rather than as a traceback.
|
||||
check=False,
|
||||
)
|
||||
elapsed = time.perf_counter() - started
|
||||
print(f" window closed and the process returned in {elapsed:.1f}s")
|
||||
@@ -2326,17 +2331,18 @@ def main() -> int:
|
||||
import json as _cal_json
|
||||
from unittest.mock import patch as _patch_mismatch
|
||||
|
||||
import orisys_studio.ui.cal_panel as _cal_panel_module
|
||||
import orisys_studio.calibration_service as _cal_service_module
|
||||
from PySide6.QtWidgets import QMessageBox as _QMessageBox
|
||||
|
||||
import orisys_studio.ui.cal_panel as _cal_panel_module
|
||||
from orisys_app_shared.force.calibration_io import (
|
||||
build_force_calibration_v2 as _build_v2b,
|
||||
)
|
||||
from orisys_app_shared.force.calibration_io import (
|
||||
write_force_calibration as _write_cal,
|
||||
)
|
||||
from orisys_app_shared.force.calibration_session import (
|
||||
build_session_document as _build_session_doc,
|
||||
)
|
||||
from PySide6.QtWidgets import QMessageBox as _QMessageBox
|
||||
|
||||
record_dir = APP_ROOT / "outputs" / "_cal_record_check"
|
||||
if record_dir.exists():
|
||||
@@ -3065,7 +3071,6 @@ def main() -> int:
|
||||
recorder.on_packet(_fake_packet(index))
|
||||
recorder.stop()
|
||||
|
||||
from orisys_studio.replay import ReplayEngine
|
||||
|
||||
# The replay lives in the main window: one engine, one progress bar, and the
|
||||
# charts read the recording itself.
|
||||
@@ -3314,7 +3319,6 @@ def main() -> int:
|
||||
# Long-history browsing: an interval read is bounded by the interval, and the
|
||||
# whole-session envelope is a band rather than every row.
|
||||
from orisys_app_shared.force.source import RecordingCurveSource
|
||||
from orisys_app_shared.record.index import RecordingIndex
|
||||
from orisys_app_shared.record.playback import RecordingReader as _RecordingReader
|
||||
|
||||
reader = _RecordingReader(recording, max_rows=10)
|
||||
|
||||
@@ -38,9 +38,7 @@ os.chdir(APP_ROOT)
|
||||
def _replay_data(window, app) -> Path:
|
||||
"""Synthesize one short recording (with visible frames) and open it."""
|
||||
import numpy as np
|
||||
|
||||
from orisys_app_shared.record import ExperimentRecorder, RecordConfig
|
||||
|
||||
from ui_check import _fake_packet
|
||||
|
||||
root = APP_ROOT / "outputs" / "_snapshot_replay"
|
||||
@@ -121,7 +119,6 @@ def _run_scene(window, app, scene: str):
|
||||
window._run_timer.stop()
|
||||
|
||||
from orisys_app_shared.record.experiment import RecordStats
|
||||
|
||||
from orisys_studio.ui import record_status
|
||||
|
||||
directory = "20240101T101500Z_session0001_a1b2c3d4e5f6"
|
||||
@@ -160,7 +157,6 @@ def _flow_scene(window, app, *, frames: int = 240) -> None:
|
||||
|
||||
import numpy as np
|
||||
from orisys_app_shared.acquisition.sdk_worker import SdkPacket
|
||||
|
||||
from ui_check import _StuckWorker
|
||||
|
||||
stuck = _StuckWorker()
|
||||
@@ -304,14 +300,12 @@ def _demo_data(window) -> None:
|
||||
|
||||
# Synthetic outward flow so the branded canvas and flow ramp are reviewable.
|
||||
import numpy as np
|
||||
|
||||
from orisys_app_shared.acquisition.arrows import (
|
||||
draw_arrow_display,
|
||||
flow_colormap,
|
||||
hex_to_bgr,
|
||||
)
|
||||
from orisys_app_shared.theme import color
|
||||
|
||||
from orisys_studio.app_window import _bgr_to_qimage
|
||||
|
||||
size = 320
|
||||
@@ -393,11 +387,10 @@ def main() -> int:
|
||||
|
||||
panels = {part.strip().lower() for part in args.panels.split(",") if part.strip()}
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from orisys_app_shared.i18n import set_locale
|
||||
from orisys_app_shared.theme import build_qss
|
||||
from orisys_studio.app_window import StudioMainWindow
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
set_locale(args.lang)
|
||||
|
||||
Reference in New Issue
Block a user