Skip to content

Commit

Permalink
Merge pull request #828 from JonathanPlasse/fix-type-annotations
Browse files Browse the repository at this point in the history
Fix type annotations
  • Loading branch information
PierreF authored Mar 24, 2024
2 parents 96cf6d9 + ea6a952 commit 992b394
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class WebsocketConnectionError(ConnectionError):
pass


def error_string(mqtt_errno: MQTTErrorCode) -> str:
def error_string(mqtt_errno: MQTTErrorCode | int) -> str:
"""Return the error string associated with an mqtt error number."""
if mqtt_errno == MQTT_ERR_SUCCESS:
return "No error."
Expand Down Expand Up @@ -729,7 +729,7 @@ def on_connect(client, userdata, flags, reason_code, properties):
def __init__(
self,
callback_api_version: CallbackAPIVersion,
client_id: str = "",
client_id: str | None = "",
clean_session: bool | None = None,
userdata: Any = None,
protocol: int = MQTTv311,
Expand Down Expand Up @@ -2032,7 +2032,7 @@ def subscribe(
return self._send_subscribe(False, topic_qos_list, properties)

def unsubscribe(
self, topic: str, properties: Properties | None = None
self, topic: str | list[str], properties: Properties | None = None
) -> tuple[MQTTErrorCode, int | None]:
"""Unsubscribe the client from one or more topics.
Expand Down
2 changes: 1 addition & 1 deletion src/paho/mqtt/reasoncodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ReasonCode:
"""

def __init__(self, packetType, aName="Success", identifier=-1):
def __init__(self, packetType: int, aName: str ="Success", identifier: int =-1):
"""
packetType: the type of the packet, such as PacketTypes.CONNECT that
this reason code will be used with. Some reason codes have different
Expand Down

0 comments on commit 992b394

Please sign in to comment.