Skip to content

Commit fb1f450

Browse files
committed
Merge branch 'main' into mahe-typehint
2 parents a03f98f + 1f885d5 commit fb1f450

13 files changed

+29
-34
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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_io/adafruit_io.py

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,6 @@ def subscribe(self, feed_key: str=None, group_key: str=None, shared_user: str=No
257257
.. code-block:: python
258258
259259
client.subscribe('temperature')
260-
261-
Example of subscribing to two Adafruit IO feeds: 'temperature'
262-
and 'humidity'.
263-
264-
.. code-block:: python
265-
266-
client.subscribe([('temperature'), ('humidity')])
267260
"""
268261
if shared_user is not None and feed_key is not None:
269262
validate_feed_key(feed_key)
@@ -338,13 +331,6 @@ def unsubscribe(self, feed_key: str=None, group_key: str=None, shared_user: str=
338331
339332
client.unsubscribe('temperature')
340333
341-
Example of unsubscribing from two feeds: 'temperature'
342-
and 'humidity'
343-
344-
.. code-block:: python
345-
346-
client.unsubscribe([('temperature'), ('humidity')])
347-
348334
Example of unsubscribing from a shared feed.
349335
350336
.. code-block:: python
@@ -542,12 +528,12 @@ def _post(self, path: str, payload: json):
542528
:param str path: Formatted Adafruit IO URL from _compose_path
543529
:param json payload: JSON data to send to Adafruit IO
544530
"""
545-
response = self._http.post(
531+
with self._http.post(
546532
path, json=payload, headers=self._create_headers(self._aio_headers[0])
547-
)
548-
self._handle_error(response)
549-
json_data = response.json()
550-
response.close()
533+
) as response:
534+
self._handle_error(response)
535+
json_data = response.json()
536+
551537
return json_data
552538

553539
def _get(self, path: str):
@@ -556,12 +542,11 @@ def _get(self, path: str):
556542
557543
:param str path: Formatted Adafruit IO URL from _compose_path
558544
"""
559-
response = self._http.get(
545+
with self._http.get(
560546
path, headers=self._create_headers(self._aio_headers[1])
561-
)
562-
self._handle_error(response)
563-
json_data = response.json()
564-
response.close()
547+
) as response:
548+
self._handle_error(response)
549+
json_data = response.json()
565550
return json_data
566551

567552
def _delete(self, path: str):
@@ -570,12 +555,12 @@ def _delete(self, path: str):
570555
571556
:param str path: Formatted Adafruit IO URL from _compose_path
572557
"""
573-
response = self._http.delete(
558+
with self._http.delete(
574559
path, headers=self._create_headers(self._aio_headers[0])
575-
)
576-
self._handle_error(response)
577-
json_data = response.json()
578-
response.close()
560+
) as response:
561+
self._handle_error(response)
562+
json_data = response.json()
563+
579564
return json_data
580565

581566
# Data

docs/conf.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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/adafruit_io_mqtt/adafruit_io_feed_callback.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
# status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)
5050
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
5151

52+
5253
# Define callback functions which will be called when certain events happen.
5354
# pylint: disable=unused-argument
5455
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_location.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
# status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)
5353
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
5454

55+
5556
# Define callback functions which will be called when certain events happen.
5657
# pylint: disable=unused-argument
5758
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_pubsub_rp2040.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
led_pin = DigitalInOut(board.LED)
3636
led_pin.switch_to_output()
3737

38+
3839
# Define callback functions which will be called when certain events happen.
3940
# pylint: disable=unused-argument
4041
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_simpletest_cellular.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
gsm.connect()
4646
time.sleep(5)
4747

48+
4849
# Define callback functions which will be called when certain events happen.
4950
# pylint: disable=unused-argument
5051
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_simpletest_esp32s2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
wifi.radio.connect(secrets["ssid"], secrets["password"])
3232
print("Connected to %s!" % secrets["ssid"])
3333

34+
3435
# Define callback functions which will be called when certain events happen.
3536
# pylint: disable=unused-argument
3637
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_simpletest_eth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# Initialize ethernet interface with DHCP
3131
eth = WIZNET5K(spi_bus, cs)
3232

33+
3334
# Define callback functions which will be called when certain events happen.
3435
# pylint: disable=unused-argument
3536
def connected(client):

examples/adafruit_io_mqtt/adafruit_io_time.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
# status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)
5353
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
5454

55+
5556
# Define callback functions which will be called when certain events happen.
5657
# pylint: disable=unused-argument
5758
def connected(client):

examples/adafruit_io_simpletest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
# status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)
5656
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
5757

58+
5859
# Define callback functions which will be called when certain events happen.
5960
# pylint: disable=unused-argument
6061
def connected(client):

0 commit comments

Comments
 (0)