From 2720860f1b56dde243610a50b23a66b3b34e5d24 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 19 Oct 2026 16:51:32 +0100 Subject: [PATCH] use pvvalue --- util/channel_access.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/util/channel_access.py b/util/channel_access.py index 0d97f10..1e10920 100644 --- a/util/channel_access.py +++ b/util/channel_access.py @@ -1,12 +1,11 @@ import binascii import json import zlib -from builtins import object from enum import Enum from genie_python.channel_access_exceptions import ReadAccessException, UnableToConnectToPVException -from genie_python.genie import PVValue from genie_python.genie_cachannel_wrapper import CaChannelWrapper +from ibex_non_ca_helpers.typing import PVValue # Some instruments may not be available. If this is the case, we don't want to wait too long # for the response which will never come (which would slow down the tests) @@ -24,7 +23,7 @@ class PvInterestingLevel(Enum): FACILITY = "FACILITY" -class ChannelAccessUtils(object): +class ChannelAccessUtils: """ Class containing utility methods for interacting with a PV """ @@ -32,17 +31,14 @@ class ChannelAccessUtils(object): def __init__(self, pv_prefix: str = "") -> None: self.pv_prefix = pv_prefix - def get_value(self, pv: str, timeout: float = None) -> PVValue: + def get_value(self, pv: str, timeout: float | None = None) -> PVValue: """ Gets the value of the PV. Returns None if PV is unavailable. :return: The PV value as a string, or None if there was an error """ try: return CaChannelWrapper.get_pv_value( - "{}{}".format( - self.pv_prefix, - pv, - ), + f"{self.pv_prefix}{pv}", timeout=timeout or CHANNEL_ACCESS_TIMEOUT, ) except (UnableToConnectToPVException, ReadAccessException):