Skip to content

Commit de679a6

Browse files
committed
Merge branch 'main' into settings_dot_toml
2 parents 1da654e + 40b9096 commit de679a6

20 files changed

+56
-14
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: 22.3.0
7+
rev: 23.3.0
88
hooks:
99
- id: black
1010
- repo: https://github.com/fsfe/reuse-tool
11-
rev: v0.14.0
11+
rev: v1.1.2
1212
hooks:
1313
- id: reuse
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.2.0
15+
rev: v4.4.0
1616
hooks:
1717
- id: check-yaml
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pycqa/pylint
21-
rev: v2.15.5
21+
rev: v2.17.4
2222
hooks:
2323
- id: pylint
2424
name: pylint (library code)

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,4 @@ min-public-methods=1
396396

397397
# Exceptions that will emit a warning when being caught. Defaults to
398398
# "Exception"
399-
overgeneral-exceptions=Exception
399+
overgeneral-exceptions=builtins.Exception

adafruit_minimqtt/adafruit_minimqtt.py

-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ def __init__(
191191
connect_retries: int = 5,
192192
user_data=None,
193193
) -> None:
194-
195194
self._socket_pool = socket_pool
196195
self._ssl_context = ssl_context
197196
self._sock = None

adafruit_minimqtt/matcher.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ def __delitem__(self, key: str) -> None:
7070
node.content = None
7171
except KeyError:
7272
raise KeyError(key) from None
73-
else: # cleanup
74-
for parent, k, node in reversed(lst):
75-
if node.children or node.content is not None:
76-
break
77-
del parent.children[k]
73+
for parent, k, node in reversed(lst):
74+
if node.children or node.content is not None:
75+
break
76+
del parent.children[k]
7877

7978
def iter_match(self, topic: str):
8079
"""Return an iterator on all values associated with filters

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# ones.
1818
extensions = [
1919
"sphinx.ext.autodoc",
20+
"sphinxcontrib.jquery",
2021
"sphinx.ext.intersphinx",
2122
"sphinx.ext.napoleon",
2223
"sphinx.ext.todo",

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Unlicense
44

55
sphinx>=4.0.0
6+
sphinxcontrib-jquery

examples/cellular/minimqtt_adafruitio_cellular.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
### Code ###
3838

39+
3940
# Define callback methods which are called when events occur
4041
# pylint: disable=unused-argument, redefined-outer-name
4142
def connected(client, userdata, flags, rc):

examples/cellular/minimqtt_simpletest_cellular.py

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
### Code ###
4040

41+
4142
# Define callback methods which are called when events occur
4243
# pylint: disable=unused-argument, redefined-outer-name
4344
def connect(client, userdata, flags, rc):

examples/cpython/minimqtt_adafruitio_cpython.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
### Code ###
2727

28+
2829
# Define callback methods which are called when events occur
2930
# pylint: disable=unused-argument, redefined-outer-name
3031
def connected(client, userdata, flags, rc):

examples/cpython/minimqtt_simpletest_cpython.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# Use this topic if you'd like to connect to io.adafruit.com
2626
# mqtt_topic = secrets["aio_username"] + "/feeds/temperature"
2727

28+
2829
### Code ###
2930
# Define callback methods which are called when events occur
3031
# pylint: disable=unused-argument, redefined-outer-name

examples/esp32spi/minimqtt_certificate_esp32spi.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
### Code ###
6161

62+
6263
# Define callback methods which are called when events occur
6364
# pylint: disable=unused-argument, redefined-outer-name
6465
def connect(client, userdata, flags, rc):

examples/esp32spi/minimqtt_pub_sub_blocking_topic_callbacks_esp32spi.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
### Code ###
5252

53+
5354
# Define callback methods which are called when events occur
5455
# pylint: disable=unused-argument, redefined-outer-name
5556
def connected(client, userdata, flags, rc):

examples/esp32spi/minimqtt_pub_sub_nonblocking_esp32spi.py

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
default_topic = aio_username + "/feeds/testfeed"
5252

5353

54+
5455
### Code ###
5556
# Define callback methods which are called when events occur
5657
# pylint: disable=unused-argument, redefined-outer-name

examples/esp32spi/minimqtt_pub_sub_pyportal_esp32spi.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# ------------- MQTT Topic Setup ------------- #
2222
mqtt_topic = "test/topic"
2323

24+
2425
### Code ###
2526
# Define callback methods which are called when events occur
2627
# pylint: disable=unused-argument, redefined-outer-name

examples/ethernet/minimqtt_adafruitio_eth.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
### Code ###
3636

37+
3738
# Define callback methods which are called when events occur
3839
# pylint: disable=unused-argument, redefined-outer-name
3940
def connected(client, userdata, flags, rc):

examples/ethernet/minimqtt_simpletest_eth.py

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
### Code ###
3535

36+
3637
# Define callback methods which are called when events occur
3738
# pylint: disable=unused-argument, redefined-outer-name
3839
def connect(client, userdata, flags, rc):

examples/minimqtt_simpletest.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
# Use this topic if you'd like to connect to io.adafruit.com
5151
mqtt_topic = aio_username + "/feeds/temperature"
5252

53+
5354
### Code ###
5455

5556

examples/native_networking/minimqtt_adafruitio_native_networking.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ def message(client, topic, message):
5757

5858
# Create a socket pool
5959
pool = socketpool.SocketPool(wifi.radio)
60+
ssl_context = ssl.create_default_context()
61+
62+
# If you need to use certificate/key pair authentication (e.g. X.509), you can load them in the
63+
# ssl context by uncommenting the lines below and adding the following keys to the "secrets"
64+
# dictionary in your secrets.py file:
65+
# "device_cert_path" - Path to the Device Certificate
66+
# "device_key_path" - Path to the RSA Private Key
67+
# ssl_context.load_cert_chain(
68+
# certfile=secrets["device_cert_path"], keyfile=secrets["device_key_path"]
69+
# )
6070

6171
# Set up a MiniMQTT Client
6272
mqtt_client = MQTT.MQTT(
@@ -65,7 +75,7 @@ def message(client, topic, message):
6575
username=aio_username,
6676
password=aio_key,
6777
socket_pool=pool,
68-
ssl_context=ssl.create_default_context(),
78+
ssl_context=ssl_context,
6979
)
7080

7181
# Setup the callback methods above

examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
default_topic = aio_username + "/feeds/testfeed"
3131

3232

33+
3334
### Code ###
3435
# Define callback methods which are called when events occur
3536
# pylint: disable=unused-argument, redefined-outer-name
@@ -57,6 +58,16 @@ def message(client, topic, message):
5758

5859
# Create a socket pool
5960
pool = socketpool.SocketPool(wifi.radio)
61+
ssl_context = ssl.create_default_context()
62+
63+
# If you need to use certificate/key pair authentication (e.g. X.509), you can load them in the
64+
# ssl context by uncommenting the lines below and adding the following keys to the "secrets"
65+
# dictionary in your secrets.py file:
66+
# "device_cert_path" - Path to the Device Certificate
67+
# "device_key_path" - Path to the RSA Private Key
68+
# ssl_context.load_cert_chain(
69+
# certfile=secrets["device_cert_path"], keyfile=secrets["device_key_path"]
70+
# )
6071

6172
# Set up a MiniMQTT Client
6273
mqtt_client = MQTT.MQTT(
@@ -65,7 +76,7 @@ def message(client, topic, message):
6576
username=aio_username,
6677
password=aio_key,
6778
socket_pool=pool,
68-
ssl_context=ssl.create_default_context(),
79+
ssl_context=ssl_context,
6980
)
7081

7182
# Setup the callback methods above

examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ def on_message(client, topic, message):
6464

6565
# Create a socket pool
6666
pool = socketpool.SocketPool(wifi.radio)
67+
ssl_context = ssl.create_default_context()
68+
69+
# If you need to use certificate/key pair authentication (e.g. X.509), you can load them in the
70+
# ssl context by uncommenting the lines below and adding the following keys to the "secrets"
71+
# dictionary in your secrets.py file:
72+
# "device_cert_path" - Path to the Device Certificate
73+
# "device_key_path" - Path to the RSA Private Key
74+
# ssl_context.load_cert_chain(
75+
# certfile=secrets["device_cert_path"], keyfile=secrets["device_key_path"]
76+
# )
6777

6878
# Set up a MiniMQTT Client
6979
client = MQTT.MQTT(
@@ -72,7 +82,7 @@ def on_message(client, topic, message):
7282
username=aio_username,
7383
password=aio_key,
7484
socket_pool=pool,
75-
ssl_context=ssl.create_default_context(),
85+
ssl_context=ssl_context,
7686
)
7787

7888
# Setup the callback methods above

0 commit comments

Comments
 (0)