From 564f970aba2538165986c7749969b936be5a5b85 Mon Sep 17 00:00:00 2001 From: Robert Tuck Date: Thu, 30 May 2024 15:07:01 +0100 Subject: [PATCH] (DiamondLightSource/hyperion#1307) change DetectorParams detector_size_constants validator to allow the declared type --- src/dodal/devices/detector/detector.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dodal/devices/detector/detector.py b/src/dodal/devices/detector/detector.py index eecabe2bac..2528d4fc18 100644 --- a/src/dodal/devices/detector/detector.py +++ b/src/dodal/devices/detector/detector.py @@ -67,7 +67,11 @@ def create_beamxy_and_runnumber(cls, values: dict[str, Any]) -> dict[str, Any]: def _parse_detector_size_constants( cls, det_type: str, values: dict[str, Any] ) -> DetectorSizeConstants: - return constants_from_type(det_type) + return ( + det_type + if isinstance(det_type, DetectorSizeConstants) + else constants_from_type(det_type) + ) @validator("directory", pre=True) def _parse_directory(cls, directory: str, values: dict[str, Any]) -> str: