Skip to content

Commit b396c39

Browse files
authored
Remove async get_factory. (#990)
1 parent ecad90e commit b396c39

File tree

8 files changed

+8
-44
lines changed

8 files changed

+8
-44
lines changed

pymodbus/client/asynchronous/factory/serial.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,3 @@ def async_io_factory(port=None, framer=None, **kwargs):
3535
future.result()
3636

3737
return loop, client
38-
39-
40-
def get_factory():
41-
"""Get protocol factory.
42-
43-
:return: new factory
44-
"""
45-
return async_io_factory

pymodbus/client/asynchronous/factory/tcp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,3 @@ def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
3838
client = future.result()
3939

4040
return loop, client
41-
42-
43-
def get_factory():
44-
"""Get protocol factory.
45-
46-
:return: new factory
47-
"""
48-
return async_io_factory

pymodbus/client/asynchronous/factory/tls.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,3 @@ def async_io_factory(
5151
client = future.result()
5252

5353
return loop, client
54-
55-
56-
def get_factory():
57-
"""Get protocol factory.
58-
59-
:return: protocol object
60-
"""
61-
return async_io_factory

pymodbus/client/asynchronous/factory/udp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,3 @@ def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
3535
client = client.result()
3636

3737
return loop, client
38-
39-
40-
def get_factory():
41-
"""Get protocol factory.
42-
43-
:return: new factory
44-
"""
45-
return async_io_factory

pymodbus/client/asynchronous/serial.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""SERIAL communication."""
22
import logging
33

4-
from pymodbus.client.asynchronous.factory.serial import get_factory
4+
from pymodbus.client.asynchronous.factory.serial import async_io_factory
55
from pymodbus.exceptions import ParameterException
66
from pymodbus.factory import ClientDecoder
77
from pymodbus.transaction import (
@@ -58,7 +58,6 @@ def __new__(cls, method, port, **kwargs):
5858
:param kwargs:
5959
:return:
6060
"""
61-
factory_class = get_factory()
6261
framer = cls._framer(method)
63-
yieldable = factory_class(framer=framer, port=port, **kwargs)
62+
yieldable = async_io_factory(framer=framer, port=port, **kwargs)
6463
return yieldable

pymodbus/client/asynchronous/tcp.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""TCP communication."""
22
import logging
33

4-
from pymodbus.client.asynchronous.factory.tcp import get_factory
4+
from pymodbus.client.asynchronous.factory.tcp import async_io_factory
55
from pymodbus.constants import Defaults
66

77
_logger = logging.getLogger(__name__)
@@ -33,8 +33,7 @@ def __new__(
3333
:param kwargs: Other extra args specific to Backend being used
3434
:return:
3535
"""
36-
factory_class = get_factory()
37-
yieldable = factory_class(
36+
yieldable = async_io_factory(
3837
host=host,
3938
port=port,
4039
framer=framer,

pymodbus/client/asynchronous/tls.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""TLS communication."""
22
import logging
33

4-
from pymodbus.client.asynchronous.factory.tls import get_factory
4+
from pymodbus.client.asynchronous.factory.tls import async_io_factory
55
from pymodbus.constants import Defaults
66
from pymodbus.factory import ClientDecoder
77
from pymodbus.transaction import ModbusTlsFramer
@@ -44,8 +44,7 @@ def __new__(
4444
:return:
4545
"""
4646
framer = framer or ModbusTlsFramer(ClientDecoder())
47-
factory_class = get_factory()
48-
yieldable = factory_class(
47+
yieldable = async_io_factory(
4948
host=host,
5049
port=port,
5150
sslctx=sslctx,

pymodbus/client/asynchronous/udp.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""UDP communication."""
22
import logging
33

4-
from pymodbus.client.asynchronous.factory.udp import get_factory
4+
from pymodbus.client.asynchronous.factory.udp import async_io_factory
55
from pymodbus.constants import Defaults
66

77
_logger = logging.getLogger(__name__)
@@ -33,8 +33,7 @@ def __new__(
3333
:param kwargs: Other extra args specific to Backend being used
3434
:return:
3535
"""
36-
factory_class = get_factory()
37-
yieldable = factory_class(
36+
yieldable = async_io_factory(
3837
host=host,
3938
port=port,
4039
framer=framer,

0 commit comments

Comments
 (0)