Skip to content

Commit

Permalink
Fix type of _protocol field
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreF committed Mar 24, 2024
1 parent 992b394 commit f544b4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def __init__(
client_id: str | None = "",
clean_session: bool | None = None,
userdata: Any = None,
protocol: int = MQTTv311,
protocol: MQTTProtocolVersion = MQTTv311,
transport: Literal["tcp", "websockets"] = "tcp",
reconnect_on_failure: bool = True,
manual_ack: bool = False,
Expand Down Expand Up @@ -3462,7 +3462,7 @@ def _send_simple_command(self, command: int) -> MQTTErrorCode:
return self._packet_queue(command, packet, 0, 0)

def _send_connect(self, keepalive: int) -> MQTTErrorCode:
proto_ver = self._protocol
proto_ver = int(self._protocol)
# hard-coded UTF-8 encoded string
protocol = b"MQTT" if proto_ver >= MQTTv311 else b"MQIsdp"

Expand Down
6 changes: 3 additions & 3 deletions src/paho/mqtt/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any, List, Tuple, Union

from paho.mqtt.enums import CallbackAPIVersion
from paho.mqtt.enums import CallbackAPIVersion, MQTTProtocolVersion
from paho.mqtt.properties import Properties
from paho.mqtt.reasoncodes import ReasonCode

Expand Down Expand Up @@ -112,7 +112,7 @@ def multiple(
will: MessageDict | None = None,
auth: AuthParameter | None = None,
tls: TLSParameter | None = None,
protocol: int = paho.MQTTv311,
protocol: MQTTProtocolVersion = paho.MQTTv311,
transport: Literal["tcp", "websockets"] = "tcp",
proxy_args: Any | None = None,
) -> None:
Expand Down Expand Up @@ -240,7 +240,7 @@ def single(
will: MessageDict | None = None,
auth: AuthParameter | None = None,
tls: TLSParameter | None = None,
protocol: int = paho.MQTTv311,
protocol: MQTTProtocolVersion = paho.MQTTv311,
transport: Literal["tcp", "websockets"] = "tcp",
proxy_args: Any | None = None,
) -> None:
Expand Down

0 comments on commit f544b4e

Please sign in to comment.