Skip to content

Commit 14560b0

Browse files
committed
reduce self.params.
1 parent cf57e64 commit 14560b0

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

pymodbus/client/base.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import asyncio
55
import socket
6-
import ssl
76
from dataclasses import dataclass
87
from typing import Any, Callable
98

@@ -50,19 +49,17 @@ class ModbusBaseClient(ModbusClientMixin, Transport):
5049
"""
5150

5251
@dataclass
53-
class _params: # pylint: disable=too-many-instance-attributes
52+
class _params:
5453
"""Parameter class."""
5554

5655
host: str = None
5756
port: str | int = None
58-
framer: type[ModbusFramer] = None
5957
timeout: float = None
6058
retries: int = None
6159
retry_on_empty: bool = None
6260
close_comm_on_error: bool = None
6361
strict: bool = None
6462
broadcast_enable: bool = None
65-
kwargs: dict = None
6663
reconnect_delay: int = None
6764

6865
baudrate: int = None
@@ -73,7 +70,6 @@ class _params: # pylint: disable=too-many-instance-attributes
7370

7471
source_address: tuple[str, int] = None
7572

76-
sslctx: ssl.SSLContext = None
7773
server_hostname: str = None
7874

7975
def __init__( # pylint: disable=too-many-arguments
@@ -112,7 +108,6 @@ def __init__( # pylint: disable=too-many-arguments
112108
)
113109
self.framer = framer
114110
self.params = self._params()
115-
self.params.framer = framer
116111
self.params.timeout = float(timeout)
117112
self.params.retries = int(retries)
118113
self.params.retry_on_empty = bool(retry_on_empty)
@@ -122,15 +117,14 @@ def __init__( # pylint: disable=too-many-arguments
122117
self.params.reconnect_delay = int(reconnect_delay)
123118
self.reconnect_delay_max = int(reconnect_delay_max)
124119
self.on_reconnect_callback = on_reconnect_callback
125-
self.params.kwargs = kwargs
126120
self.retry_on_empty: int = 0
127121
# -> retry read on nothing
128122

129123
self.slaves: list[int] = []
130124
# -> list of acceptable slaves (0 for accept all)
131125

132126
# Common variables.
133-
self.framer = self.params.framer(ClientDecoder(), self)
127+
self.framer = framer(ClientDecoder(), self)
134128
self.transaction = DictTransactionManager(
135129
self, retries=retries, retry_on_empty=retry_on_empty, **kwargs
136130
)

pymodbus/client/tls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def __init__(
131131
self.sslctx = CommParams.generate_ssl(
132132
False, certfile, keyfile, password, sslctx=sslctx
133133
)
134-
self.params.sslctx = sslctx
135134
self.params.server_hostname = server_hostname
136135

137136
@property

0 commit comments

Comments
 (0)