Skip to content

Commit

Permalink
Avoid using class variables
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Jun 21, 2023
1 parent 4cf2953 commit 5fec06f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions productivity/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, address, tag_filepath, timeout=1, *args, **kwargs):
self._coils = defaultdict(bool)
self._discrete_inputs = defaultdict(bool)
self._registers = defaultdict(bytes)
self._register_types = ['holding', 'input']
self._detect_pymodbus_version()
if self.pymodbus33plus:
self.client.close = lambda: None
Expand Down
3 changes: 1 addition & 2 deletions productivity/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ class AsyncioModbusClient:
including standard timeouts, async context manager, and queued requests.
"""

_register_types = ['holding', 'input']

def __init__(self, address, timeout=1):
"""Set up communication parameters."""
self.ip = address
self.timeout = timeout
self._register_types = ['holding', 'input']
self._detect_pymodbus_version()
if self.pymodbus30plus:
self.client = AsyncModbusTcpClient(address, timeout=timeout)
Expand Down

0 comments on commit 5fec06f

Please sign in to comment.