Skip to content

Commit

Permalink
MAINT: init type annotations, manual/simpler error text
Browse files Browse the repository at this point in the history
  • Loading branch information
ZLLentz committed Jun 25, 2024
1 parent 87b98d3 commit ee526b7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions typhos/plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class SignalConnection(PyDMConnection):
def __init__(self, channel, address, protocol=None, parent=None):
# Create base connection
super().__init__(channel, address, protocol=protocol, parent=parent)
self._connection_open = True
self.signal_type = None
self.is_float = False
self.enum_strs = ()
self._connection_open: bool = True
self.signal_type: type | None = None
self.is_float: bool = False
self.enum_strs: tuple[str, ...] = ()

# Collect our signal
self.signal = self.find_signal(address)
Expand Down Expand Up @@ -161,7 +161,9 @@ def cast(self, value):
except (TypeError, ValueError):
value = str(value)
else:
raise TypeError(f"Invalid combination: {self.enum_strs=} with {self.signal_type=}")
raise TypeError(
f"Invalid combination: enum_strs={self.enum_strs} with signal_type={self.signal_type}"
)
elif self.signal_type is np.ndarray:
value = np.asarray(value)
else:
Expand Down

0 comments on commit ee526b7

Please sign in to comment.