From 9aa7c87f619442e80f921823afb9f1d76ad76097 Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Thu, 2 Apr 2026 19:18:28 +0100 Subject: [PATCH] Correct the type for Deploy.init The code in the constructor actually depends on lots of fields that are only in SimCfg, but we aren't really type-safe yet, so only find this out at runtime (when we try to do something other than a simulation). Correct the type safety at the site where we actually create the Deploy object. Signed-off-by: Rupert Swarbrick --- src/dvsim/job/deploy.py | 5 +++-- src/dvsim/logging.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dvsim/job/deploy.py b/src/dvsim/job/deploy.py index 71247b85..26e29eda 100644 --- a/src/dvsim/job/deploy.py +++ b/src/dvsim/job/deploy.py @@ -25,8 +25,9 @@ ) if TYPE_CHECKING: - from dvsim.flow.sim import SimCfg + from dvsim.flow.base import FlowCfg from dvsim.modes import BuildMode + from dvsim.sim.flow import SimCfg __all__ = ( @@ -59,7 +60,7 @@ def __str__(self) -> str: """Get a string representation of the deployment object.""" return pprint.pformat(self.__dict__) if log.isEnabledFor(log.VERBOSE) else self.full_name - def __init__(self, sim_cfg: "SimCfg") -> None: + def __init__(self, sim_cfg: "FlowCfg") -> None: """Initialise deployment object. Args: diff --git a/src/dvsim/logging.py b/src/dvsim/logging.py index 620fe0d3..03979e4b 100644 --- a/src/dvsim/logging.py +++ b/src/dvsim/logging.py @@ -104,7 +104,7 @@ def _build_logger() -> DVSimLogger: # Log any unhandled exceptions _previous_excepthook = sys.excepthook - def _handle_exception(exc_type, exc_value, exc_tb): + def _handle_exception(exc_type, exc_value, exc_tb) -> None: logger.critical("Unhandled exception", exc_info=(exc_type, exc_value, exc_tb)) _previous_excepthook(exc_type, exc_value, exc_tb)