added ruff test

This commit is contained in:
ykcheungab
2026-09-27 19:20:43 +08:00
parent bcab2790bf
commit fa2703968e
178 changed files with 3277 additions and 1034 deletions
+4 -5
View File
@@ -77,7 +77,6 @@ def _grid_scene(target_vertices: int):
stand-in.
"""
import numpy as np
from orisys_app_shared.scene3d.contracts import (
CameraPreset,
Material,
@@ -88,6 +87,8 @@ def _grid_scene(target_vertices: int):
)
from orisys_app_shared.scene3d.digest import (
field_domain_id as compute_domain_id,
)
from orisys_app_shared.scene3d.digest import (
geometry_id as compute_geometry_id,
)
from orisys_app_shared.scene3d.legacy import vertex_normals
@@ -207,7 +208,6 @@ def measure_cpu(
what is left is the number an LOD decision should be made on.
"""
import numpy as np
from orisys_app_shared.scene3d import synthetic
from orisys_app_shared.scene3d.composer import SceneComposer
from orisys_app_shared.scene3d.contracts import (
@@ -310,12 +310,11 @@ def measure(
) -> tuple[dict, int]:
"""Run the assembled view and report what each stage cost."""
import numpy as np
from PySide6.QtWidgets import QApplication
from orisys_app_shared.scene3d import synthetic
from orisys_app_shared.scene3d.contracts import DisplaySettings
from orisys_studio.scene3d.gl_backend import configure_surface_format
from orisys_studio.scene3d.view import Scene3DView
from PySide6.QtWidgets import QApplication
configure_surface_format(profile) # type: ignore[arg-type]
app = QApplication.instance() or QApplication(sys.argv)
@@ -337,8 +336,8 @@ def measure(
report["reason"] = view.reason
return report, 4
if package is not None:
from orisys_app_shared.scene3d.package import PackagedAssetLoader
from orisys_app_shared.scene3d import protect
from orisys_app_shared.scene3d.package import PackagedAssetLoader
provider = (
protect.load_key_file(Path(key_file), key_id=key_id)
+1 -2
View File
@@ -89,8 +89,8 @@ def _platform_lock_from_args(args):
def _sealing_from_args(args):
"""The key material the command line points at, or ``None`` for a plain package."""
from orisys_app_shared.scene3d.contracts import Sealing
from orisys_app_shared.scene3d import protect
from orisys_app_shared.scene3d.contracts import Sealing
signing_pem = None
if args.sign_key is not None:
@@ -191,7 +191,6 @@ def main(argv: list[str] | None = None) -> int:
_bootstrap_paths()
import numpy as np
from orisys_app_shared.scene3d.contracts import ThreeDError
from orisys_app_shared.scene3d.legacy import LegacyFingerImporter
from orisys_app_shared.scene3d.package import describe_envelope, write_package
+10 -2
View File
@@ -71,7 +71,12 @@ MM_PER_SENSOR_UNIT = 0.001
def derive(design_dir: Path, sensor_dir: Path, *, tolerance: float) -> dict:
from align_housing import apply_similarity, fit_similarity, load_faces, load_vertices
from align_housing import (
apply_similarity,
fit_similarity,
load_faces,
load_vertices,
)
design_mesh = design_dir / "mesh.npz"
sensor_mesh = sensor_dir / "mesh.npz"
@@ -160,7 +165,10 @@ def verify(design_dir: Path, sensor_dir: Path, rigid: np.ndarray, units: float)
render vertices come out in the same order.
"""
from orisys_app_shared.scene3d.contracts import ThreeDError
from orisys_app_shared.scene3d.legacy import LegacyFingerImporter, validate_rigid_transform
from orisys_app_shared.scene3d.legacy import (
LegacyFingerImporter,
validate_rigid_transform,
)
design_map = design_dir / "unroll_map_uv_s0.42.npz"
sensor_map = sensor_dir / "unroll_map_uv_s0.4.npz"
+3 -5
View File
@@ -21,7 +21,6 @@ from __future__ import annotations
import argparse
import json
import os
import platform
import sys
import time
@@ -43,10 +42,6 @@ def _bootstrap_paths() -> None:
def collect(profile: str, *, keep_open_s: float) -> dict:
"""Create a real window, let Qt initialise it, and report what it got."""
from PySide6.QtCore import QTimer
from PySide6.QtOpenGLWidgets import QOpenGLWidget
from PySide6.QtWidgets import QApplication
from orisys_studio.scene3d.gl_backend import (
GLDispatch,
GLRenderer,
@@ -54,6 +49,9 @@ def collect(profile: str, *, keep_open_s: float) -> dict:
configure_surface_format,
lut_rgba,
)
from PySide6.QtCore import QTimer
from PySide6.QtOpenGLWidgets import QOpenGLWidget
from PySide6.QtWidgets import QApplication
configure_surface_format(profile) # type: ignore[arg-type]
app = QApplication.instance() or QApplication(sys.argv)
+2 -4
View File
@@ -115,10 +115,9 @@ def run(
late_rate_limit_mb_per_min: float,
) -> tuple[dict, int]:
"""Produce frames through the real pipeline and watch what it costs over time."""
import numpy as np
from concurrent.futures import ThreadPoolExecutor
import numpy as np
from orisys_app_shared.scene3d import synthetic
from orisys_app_shared.scene3d.composer import SceneComposer
from orisys_app_shared.scene3d.contracts import (
@@ -141,10 +140,9 @@ def run(
view = None
widget = None
if use_gui:
from PySide6.QtWidgets import QApplication
from orisys_studio.scene3d.gl_backend import configure_surface_format
from orisys_studio.scene3d.view import Scene3DView
from PySide6.QtWidgets import QApplication
configure_surface_format(profile) # type: ignore[arg-type]
app = QApplication.instance() or QApplication(sys.argv)
+5 -2
View File
@@ -36,8 +36,11 @@ def _bootstrap_paths() -> None:
def _legacy_report(args) -> tuple[int, dict]:
import numpy as np
from orisys_app_shared.scene3d.contracts import ExpectedGeometry, ThreeDError, validate_assets
from orisys_app_shared.scene3d.contracts import (
ExpectedGeometry,
ThreeDError,
validate_assets,
)
from orisys_app_shared.scene3d.legacy import (
LegacyFingerImporter,
estimate_meters_per_source_unit,