Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type annotations #828

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading