Adjusting old deprecation test and exception for non-abstract use of StreamInterface

This commit is contained in:
Travis-L-R
2025-11-11 18:57:52 +10:30
parent 3c6dba78a3
commit 79334e83e6

View File

@@ -39,12 +39,11 @@ class StreamInterface(MeshInterface):
timeout -- How long to wait for replies (default: 300 seconds)
Raises:
Exception: [description]
Exception: [description]
RuntimeError: Raised if StreamInterface is instantiated when noProto is false.
"""
if not hasattr(self, "stream") and not noProto:
raise Exception( # pylint: disable=W0719
if not noProto and type(self) == StreamInterface:
raise RuntimeError(
"StreamInterface is now abstract (to update existing code create SerialInterface instead)"
)
self.stream: Optional[serial.Serial] # only serial uses this, TCPInterface overrides the relevant methods instead