From 9a3c69c61ba7ba01a97a5712436cdec8164223b6 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 19 May 2020 15:49:12 -0400 Subject: [PATCH 1/2] black! --- adafruit_gc_iot_core.py | 10 +++------- examples/gc_iot_core_simpletest.py | 11 ++--------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/adafruit_gc_iot_core.py b/adafruit_gc_iot_core.py index 4ef62a9..d3c1ed9 100644 --- a/adafruit_gc_iot_core.py +++ b/adafruit_gc_iot_core.py @@ -66,9 +66,7 @@ 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 @@ -326,9 +324,7 @@ 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") @@ -339,7 +335,7 @@ def __init__(self, esp, secrets, log=False): self._reg_id = secrets["registry_id"] self._device_id = secrets["device_id"] self._private_key = secrets["private_key"] - self.broker = "https://mqtt.googleapis.com" + self.broker = "mqtt.googleapis.com" self.username = b"unused" self.cid = self.client_id diff --git a/examples/gc_iot_core_simpletest.py b/examples/gc_iot_core_simpletest.py index a1ec214..34e03e1 100644 --- a/examples/gc_iot_core_simpletest.py +++ b/examples/gc_iot_core_simpletest.py @@ -32,9 +32,7 @@ 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 @@ -105,12 +103,7 @@ 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) From 6dba7bf6d7cd0fff45c4ecb01df28e3f81b2739f Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 19 May 2020 15:51:08 -0400 Subject: [PATCH 2/2] black2 --- 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 34e03e1..a1ec214 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)