Skip to content

Commit 74c5825

Browse files
author
Johannes.Hennecke
committed
Resolved pylint issues in asyncio_mqtt.py
1 parent cb38786 commit 74c5825

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

mqtt_io/mqtt/asyncio_mqtt.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828
def _map_exception(func: Func) -> Func:
2929
"""
30-
Creates a decorator that wraps a function and maps any raised `MqttError` exception to a `MQTTException`.
30+
Creates a decorator that wraps a function and maps any raised `MqttError`
31+
exception to a `MQTTException`.
3132
3233
:param func: The function to be wrapped.
3334
:type func: Func
@@ -37,7 +38,8 @@ def _map_exception(func: Func) -> Func:
3738
@wraps(func)
3839
async def inner(*args: Any, **kwargs: Any) -> Any:
3940
"""
40-
Decorator for asynchronous functions that catches `MqttError` exceptions and raises `MQTTException` instead.
41+
Decorator for asynchronous functions that catches `MqttError` exceptions
42+
and raises `MQTTException` instead.
4143
4244
Parameters:
4345
func (Callable): The function to be decorated.
@@ -117,10 +119,10 @@ async def connect(self, timeout: int = 10) -> None:
117119
async def disconnect(self) -> None:
118120
"""
119121
This function is an asynchronous method that handles the disconnection of the client.
120-
122+
121123
Parameters:
122124
self: The current instance of the class.
123-
125+
124126
Returns:
125127
None
126128
"""
@@ -135,8 +137,10 @@ async def subscribe(self, topics: List[Tuple[str, int]]) -> None:
135137
Subscribe to the given list of topics.
136138
137139
Args:
138-
topics (List[Tuple[str, int]]): A list of tuples representing the topics to subscribe to.
139-
Each tuple should contain a string representing the topic name and an integer representing the QoS level.
140+
topics (List[Tuple[str, int]]): A list of tuples representing the topics
141+
to subscribe to.
142+
Each tuple should contain a string representing the topic name and
143+
an integer representing the QoS level.
140144
141145
Returns:
142146
None: This function does not return anything.
@@ -191,7 +195,7 @@ def _on_message(
191195
def message_queue(self) -> "asyncio.Queue[MQTTMessage]":
192196
"""
193197
Returns the message queue for receiving MQTT messages.
194-
198+
195199
:return: The message queue for receiving MQTT messages.
196200
:rtype: asyncio.Queue[MQTTMessage]
197201
"""

mqtt_io/server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ async def get_sensor_value(
661661
A decorator that applies exponential backoff to the function `get_sensor_value`.
662662
663663
Parameters:
664-
sensor_module (GenericSensor): The sensor module to use for getting the sensor value.
664+
sensor_module (GenericSensor): The sensor module to use for getting
665+
the sensor value.
665666
sens_conf (ConfigType): The configuration for the sensor.
666667
667668
Returns:
@@ -792,7 +793,7 @@ async def _mqtt_publish(self, msg: MQTTMessageSend, wait: bool = True) -> None:
792793

793794
if msg.payload is None:
794795
_LOG.debug("Publishing MQTT message on topic %r with no payload", msg.topic)
795-
elif isinstance(msg.payload, bytes) or isinstance(msg.payload, bytearray):
796+
elif isinstance(msg.payload, (bytearray, bytes)):
796797
try:
797798
payload = msg.payload.decode("utf8")
798799
except UnicodeDecodeError:

0 commit comments

Comments
 (0)