Skip to content

Commit 0bdf7ee

Browse files
authored
asyncio.iscoroutinefunction() is deprecated (#2822)
1 parent 5141942 commit 0bdf7ee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pymodbus/simulator/simdata.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Simulator data model classes."""
22
from __future__ import annotations
33

4-
import asyncio
4+
import inspect
55
from collections.abc import Awaitable, Callable
66
from dataclasses import dataclass
77
from typing import TypeAlias, cast
@@ -140,7 +140,7 @@ def __check_simple(self):
140140
raise TypeError("1 <= address + count < 65536")
141141
if not isinstance(self.datatype, DataType):
142142
raise TypeError("datatype= must by an DataType")
143-
if self.action and not (callable(self.action) and asyncio.iscoroutinefunction(self.action)):
143+
if self.action and not (callable(self.action) and inspect.iscoroutinefunction(self.action)):
144144
raise TypeError("action= not a async function")
145145
if self.register_count != -1:
146146
raise TypeError("register_count= is illegal")
@@ -166,6 +166,3 @@ def __post_init__(self):
166166
raise TypeError(f"value= can only contain {x_datatype!s}")
167167
super().__setattr__("register_count", self.count * x_len)
168168
super().__setattr__("type_size", x_len)
169-
170-
171-

0 commit comments

Comments
 (0)