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

Adafruit Logging is required #49

Merged
merged 6 commits into from
Sep 23, 2020
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
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dependencies
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Adafruit Logging <https://github.com/adafruit/Adafruit_CircuitPython_Logging>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
Expand Down
8 changes: 5 additions & 3 deletions adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def remove_topic_callback(self, mqtt_topic):
try:
del self._on_message_filtered[mqtt_topic]
except KeyError:
raise KeyError("MQTT topic callback not added with add_topic_callback.")
raise KeyError(
"MQTT topic callback not added with add_topic_callback."
) from None

@property
def on_message(self):
Expand Down Expand Up @@ -287,7 +289,7 @@ def connect(self, clean_session=True):
conntype = _the_interface.TLS_MODE
self._sock.connect((self.broker, self.port), conntype)
except RuntimeError as e:
raise MMQTTException("Invalid broker address defined.", e)
raise MMQTTException("Invalid broker address defined.", e) from None
else:
try:
if self.logger is not None:
Expand All @@ -299,7 +301,7 @@ def connect(self, clean_session=True):
)[0]
self._sock.connect(addr[-1], _the_interface.TCP_MODE)
except RuntimeError as e:
raise MMQTTException("Invalid broker address defined.", e)
raise MMQTTException("Invalid broker address defined.", e) from None

# Fixed Header
fixed_header = bytearray([0x10])
Expand Down
4 changes: 2 additions & 2 deletions adafruit_minimqtt/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __getitem__(self, key):
raise KeyError(key)
return node.content
except KeyError:
raise KeyError(key)
raise KeyError(key) from None

def __delitem__(self, key):
"""Delete the value associated with some topic filter :key"""
Expand All @@ -67,7 +67,7 @@ def __delitem__(self, key):
lst.append((parent, k, node))
node.content = None
except KeyError:
raise KeyError(key)
raise KeyError(key) from None
else: # cleanup
for parent, k, node in reversed(lst):
if node.children or node.content is not None:
Expand Down