diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f7df0..3cb3762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Next version + +### ⚙️ Engineering + +* Improved typing. + + ## 0.3.3 - September 12, 2024 ### 🚀 New diff --git a/src/lvmopstools/devices/ion.py b/src/lvmopstools/devices/ion.py index 50b1712..bf45c3c 100644 --- a/src/lvmopstools/devices/ion.py +++ b/src/lvmopstools/devices/ion.py @@ -75,7 +75,7 @@ class IonPumpDict(TypedDict): on: bool | None -async def read_ion_pumps(cameras: list[str] | None = None): +async def read_ion_pumps(cameras: list[str] | None = None) -> dict[str, IonPumpDict]: """Reads the signal and on/off status from an ion pump. Parameters @@ -87,7 +87,7 @@ async def read_ion_pumps(cameras: list[str] | None = None): ion_config: list[dict] = config["devices.ion"] - results: dict[str, dict] = {} + results: dict[str, IonPumpDict] = {} tasks: list[asyncio.Task] = [] for ion_controller in ion_config: diff --git a/src/lvmopstools/devices/nps.py b/src/lvmopstools/devices/nps.py index 13f7051..56157b1 100644 --- a/src/lvmopstools/devices/nps.py +++ b/src/lvmopstools/devices/nps.py @@ -29,7 +29,7 @@ class NPSStatus(TypedDict): @Retrier(max_attempts=3, delay=1) -async def read_nps(): +async def read_nps() -> dict[str, NPSStatus]: """Returns the status of all NPS.""" actors = ["lvmnps.sp1", "lvmnps.sp2", "lvmnps.sp3", "lvmnps.calib"] diff --git a/src/lvmopstools/devices/specs.py b/src/lvmopstools/devices/specs.py index 33916f7..7b59d60 100644 --- a/src/lvmopstools/devices/specs.py +++ b/src/lvmopstools/devices/specs.py @@ -24,8 +24,8 @@ "spectrograph_temperatures", "spectrograph_pressures", "spectrograph_mechanics", - "exposure_etr", "spectrogaph_status", + "exposure_etr", ] @@ -36,7 +36,7 @@ SpecToStatus = dict[Spectrographs, SpecStatus] -def spectrograph_temperature_label(camera: str, sensor: str = "ccd"): +def spectrograph_temperature_label(camera: str, sensor: str = "ccd") -> str: """Returns the archon label associated with a temperature sensor.""" if sensor == "ccd": @@ -55,11 +55,13 @@ def spectrograph_temperature_label(camera: str, sensor: str = "ccd"): elif camera == "z": return "mod12/tempb" + raise ValueError(f"Invalid camera {camera!r} or sensor {sensor!r}.") + async def spectrograph_temperatures( spec: Spectrographs | None = None, ignore_errors: bool = True, -): +) -> dict[str, float | None]: """Returns a dictionary of spectrograph temperatures. Parameters @@ -141,7 +143,7 @@ async def spectrograph_temperatures( async def spectrograph_pressures( spec: Spectrographs | None = None, ignore_errors: bool = True, -): +) -> dict[str, float | None]: """Returns a dictionary of spectrograph pressures. Parameters @@ -212,7 +214,7 @@ async def spectrograph_pressures( async def spectrograph_mechanics( spec: Spectrographs | None = None, ignore_errors: bool = True, -): +) -> dict[str, str | None]: """Returns a dictionary of spectrograph shutter and hartmann door status. Parameters diff --git a/uv.lock b/uv.lock index 5712c2a..b5a2918 100644 --- a/uv.lock +++ b/uv.lock @@ -781,7 +781,7 @@ wheels = [ [[package]] name = "lvmopstools" -version = "0.3.3" +version = "0.3.4a0" source = { editable = "." } dependencies = [ { name = "astropy" },