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

refactor: Bump paho-mqtt, ruff, and mypy; #286 #305

Merged
merged 1 commit into from
Jun 5, 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
12 changes: 6 additions & 6 deletions aiomqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def __init__( # noqa: C901, PLR0912, PLR0913, PLR0915
# Create the underlying paho-mqtt client instance
self._client: mqtt.Client = mqtt.Client(
callback_api_version=CallbackAPIVersion.VERSION1,
client_id=identifier, # type: ignore[arg-type]
protocol=protocol,
client_id=identifier,
protocol=protocol.value,
clean_session=clean_session,
transport=transport,
reconnect_on_failure=False,
Expand Down Expand Up @@ -371,9 +371,9 @@ async def subscribe( # noqa: PLR0913
if result != mqtt.MQTT_ERR_SUCCESS or mid is None:
raise MqttCodeError(result, "Could not subscribe to topic")
# Create future for when the on_subscribe callback is called
callback_result: asyncio.Future[
tuple[int, ...] | list[ReasonCode]
] = asyncio.Future()
callback_result: asyncio.Future[tuple[int, ...] | list[ReasonCode]] = (
asyncio.Future()
)
with self._pending_call(mid, callback_result, self._pending_subscribes):
# Wait for callback_result
return await self._wait_for(callback_result, timeout=timeout)
Expand All @@ -400,7 +400,7 @@ async def unsubscribe(
**kwargs: Additional keyword arguments to pass to paho-mqtt's unsubscribe
method.
"""
result, mid = self._client.unsubscribe(topic, properties, *args, **kwargs) # type: ignore[arg-type]
result, mid = self._client.unsubscribe(topic, properties, *args, **kwargs)
# Early out on error
if result != mqtt.MQTT_ERR_SUCCESS or mid is None:
raise MqttCodeError(result, "Could not unsubscribe from topic")
Expand Down
5 changes: 2 additions & 3 deletions aiomqtt/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __str__(self) -> str:
if isinstance(self.rc, ReasonCode):
return f"[code:{self.rc.value}] {self.rc!s}"
if isinstance(self.rc, int):
return f"[code:{self.rc}] {mqtt.error_string(self.rc)}" # type: ignore[arg-type]
return f"[code:{self.rc}] {mqtt.error_string(self.rc)}"
return f"[code:{self.rc}] {super().__str__()}"


Expand All @@ -37,8 +37,7 @@ def __init__(self, rc: int | ReasonCode) -> None:
super().__init__(rc, msg)


class MqttReentrantError(MqttError):
...
class MqttReentrantError(MqttError): ...


_CONNECT_RC_STRINGS: dict[int, str] = {
Expand Down
Loading
Loading