From 61dbdf0cf8568dd7debd67a3212ad22cd45bbc57 Mon Sep 17 00:00:00 2001 From: Vladimir Kotal Date: Wed, 25 Oct 2023 22:59:36 +0200 Subject: [PATCH] no need to pass self to _handle_on_message() --- adafruit_minimqtt/adafruit_minimqtt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_minimqtt/adafruit_minimqtt.py b/adafruit_minimqtt/adafruit_minimqtt.py index 6b974dd..cbeb8f6 100644 --- a/adafruit_minimqtt/adafruit_minimqtt.py +++ b/adafruit_minimqtt/adafruit_minimqtt.py @@ -444,15 +444,15 @@ def on_message(self): def on_message(self, method) -> None: self._on_message = method - def _handle_on_message(self, client, topic: str, message: str): + def _handle_on_message(self, topic: str, message: str): matched = False if topic is not None: for callback in self._on_message_filtered.iter_match(topic): - callback(client, topic, message) # on_msg with callback + callback(self, topic, message) # on_msg with callback matched = True if not matched and self.on_message: # regular on_message - self.on_message(client, topic, message) + self.on_message(self, topic, message) def username_pw_set(self, username: str, password: Optional[str] = None) -> None: """Set client's username and an optional password. @@ -1072,7 +1072,7 @@ def _wait_for_msg(self) -> Optional[int]: raw_msg = self._sock_exact_recv(sz) msg = raw_msg if self._use_binary_mode else str(raw_msg, "utf-8") self.logger.debug("Receiving PUBLISH \nTopic: %s\nMsg: %s\n", topic, raw_msg) - self._handle_on_message(self, topic, msg) + self._handle_on_message(topic, msg) if res[0] & 0x06 == 0x02: pkt = bytearray(b"\x40\x02\0\0") struct.pack_into("!H", pkt, 2, pid)