From 62d0f509094bd39ba43c13a1c29f92cf2355b990 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 6 Aug 2020 09:53:06 -0400 Subject: [PATCH 1/2] update example attributeerror --- examples/gc_iot_core_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gc_iot_core_simpletest.py b/examples/gc_iot_core_simpletest.py index 34e03e1..64fe0ab 100644 --- a/examples/gc_iot_core_simpletest.py +++ b/examples/gc_iot_core_simpletest.py @@ -7,7 +7,7 @@ from adafruit_esp32spi import adafruit_esp32spi_wifimanager import adafruit_esp32spi.adafruit_esp32spi_socket as socket -import adafruit_minimqtt as MQTT +import adafruit_minimqtt.adafruit_minimqtt as MQTT from adafruit_gc_iot_core import Cloud_Core, MQTT_API ### WiFi ### From 91f107a80a701153e4ac0e8b93cde2a4caa135f6 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 6 Aug 2020 09:56:24 -0400 Subject: [PATCH 2/2] black --- adafruit_gc_iot_core.py | 8 ++++++-- examples/gc_iot_core_simpletest.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/adafruit_gc_iot_core.py b/adafruit_gc_iot_core.py index d3c1ed9..37f48ec 100644 --- a/adafruit_gc_iot_core.py +++ b/adafruit_gc_iot_core.py @@ -66,7 +66,9 @@ def __init__(self, mqtt_client): if "MQTT" in mqtt_client_type: self._client = mqtt_client else: - raise TypeError("This class requires a MiniMQTT client object, please create one.") + raise TypeError( + "This class requires a MiniMQTT client object, please create one." + ) # Verify that the MiniMQTT client was setup correctly. try: self.user = self._client.user @@ -324,7 +326,9 @@ def __init__(self, esp, secrets, log=False): if hasattr(secrets, "keys"): self._secrets = secrets else: - raise AttributeError("Project settings are kept in secrets.py, please add them there!") + raise AttributeError( + "Project settings are kept in secrets.py, please add them there!" + ) self.logger = None if log is True: self.logger = logging.getLogger("log") diff --git a/examples/gc_iot_core_simpletest.py b/examples/gc_iot_core_simpletest.py index 64fe0ab..1c9dac0 100644 --- a/examples/gc_iot_core_simpletest.py +++ b/examples/gc_iot_core_simpletest.py @@ -32,7 +32,9 @@ spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) """Use below for Most Boards""" -status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards +status_light = neopixel.NeoPixel( + board.NEOPIXEL, 1, brightness=0.2 +) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" # status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) # Uncomment below for an externally defined RGB LED @@ -103,7 +105,12 @@ def message(client, topic, msg): # print("Your JWT is: ", jwt) # Set up a new MiniMQTT Client -client = MQTT.MQTT(broker=google_iot.broker, username=google_iot.username, password=secrets["jwt"], client_id=google_iot.cid,) +client = MQTT.MQTT( + broker=google_iot.broker, + username=google_iot.username, + password=secrets["jwt"], + client_id=google_iot.cid, +) # Initialize Google MQTT API Client google_mqtt = MQTT_API(client)