Skip to content

Commit

Permalink
resource: restore ModbusRTU resource but mark as deprecated,
Browse files Browse the repository at this point in the history
ensuring backwards compatibility

Signed-off-by: Felix Zwettler <[email protected]>
  • Loading branch information
flxzt committed Aug 19, 2024
1 parent 3a55606 commit f7751ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions labgrid/resource/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .ethernetport import SNMPEthernetPort
from .serialport import RawSerialPort, NetworkSerialPort
from .modbus import ModbusTCPCoil
from .modbusrtu import ModbusRTU
from .networkservice import NetworkService
from .onewireport import OneWirePIO
from .power import NetworkPowerPort, PDUDaemonPort
Expand Down
17 changes: 17 additions & 0 deletions labgrid/resource/modbusrtu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import warnings
import attr

from ..factory import target_factory
from .base import SerialPort


@target_factory.reg_resource
@attr.s(eq=False)
class ModbusRTU():
def __new__(cls, *args, **kwargs):
warnings.warn(
"The ModbusRTU class is deprecated. Use SerialPort instead.",
DeprecationWarning,
stacklevel=2,
)
return SerialPort(*args, **kwargs)

0 comments on commit f7751ef

Please sign in to comment.