From 42a3e4a9c11ee0a914d4fd5b31cccfa1593910b0 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 9 Apr 2020 16:19:54 -0400 Subject: [PATCH] Black reformatting with Python 3 target. --- adafruit_io/adafruit_io.py | 1 - docs/conf.py | 16 ++++++++-------- examples/mqtt/adafruit_io_groups.py | 9 ++++++--- examples/mqtt/adafruit_io_location.py | 9 ++++++--- examples/mqtt/adafruit_io_simpletest.py | 9 ++++++--- examples/mqtt/adafruit_io_simpletest_eth.py | 17 ++++++++++++----- examples/mqtt/adafruit_io_time.py | 8 +++++--- 7 files changed, 43 insertions(+), 26 deletions(-) diff --git a/adafruit_io/adafruit_io.py b/adafruit_io/adafruit_io.py index f0edbee..f8eedf2 100755 --- a/adafruit_io/adafruit_io.py +++ b/adafruit_io/adafruit_io.py @@ -108,7 +108,6 @@ def reconnect(self): except: raise AdafruitIO_MQTTError("Unable to reconnect to Adafruit IO.") - def connect(self): """Connects to the Adafruit IO MQTT Broker. Must be called before any other API methods are called. diff --git a/docs/conf.py b/docs/conf.py index a53846a..24bc606 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,18 +31,18 @@ master_doc = "index" # General information about the project. -project = u"Adafruit Adafruit_IO Library" -copyright = u"2019 Brent Rubell" -author = u"Brent Rubell" +project = "Adafruit Adafruit_IO Library" +copyright = "2019 Brent Rubell" +author = "Brent Rubell" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u"1.0" +version = "1.0" # The full version, including alpha/beta/rc tags. -release = u"1.0" +release = "1.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -133,7 +133,7 @@ ( master_doc, "AdafruitAdafruit_IOLibrary.tex", - u"AdafruitAdafruit_IO Library Documentation", + "AdafruitAdafruit_IO Library Documentation", author, "manual", ), @@ -147,7 +147,7 @@ ( master_doc, "AdafruitAdafruit_IOlibrary", - u"Adafruit Adafruit_IO Library Documentation", + "Adafruit Adafruit_IO Library Documentation", [author], 1, ) @@ -162,7 +162,7 @@ ( master_doc, "AdafruitAdafruit_IOLibrary", - u"Adafruit Adafruit_IO Library Documentation", + "Adafruit Adafruit_IO Library Documentation", author, "AdafruitAdafruit_IOLibrary", "One line description of project.", diff --git a/examples/mqtt/adafruit_io_groups.py b/examples/mqtt/adafruit_io_groups.py index 0623a0a..34ffef0 100755 --- a/examples/mqtt/adafruit_io_groups.py +++ b/examples/mqtt/adafruit_io_groups.py @@ -76,6 +76,7 @@ def message(client, feed_id, payload): # the new value. print("Feed {0} received new value: {1}".format(feed_id, payload)) + # Connect to WiFi print("Connecting to WiFi...") wifi.connect() @@ -85,9 +86,11 @@ def message(client, feed_id, payload): MQTT.set_socket(socket, esp) # Initialize a new MQTT Client object -mqtt_client = MQTT.MQTT(broker="https://io.adafruit.com", - username=secrets["aio_user"], - password=secrets["aio_key"]) +mqtt_client = MQTT.MQTT( + broker="https://io.adafruit.com", + username=secrets["aio_user"], + password=secrets["aio_key"], +) # Initialize an Adafruit IO MQTT Client io = IO_MQTT(mqtt_client) diff --git a/examples/mqtt/adafruit_io_location.py b/examples/mqtt/adafruit_io_location.py index f77eef9..ec0635b 100755 --- a/examples/mqtt/adafruit_io_location.py +++ b/examples/mqtt/adafruit_io_location.py @@ -75,6 +75,7 @@ def message(client, feed_id, payload): # the new value. print("Feed {0} received new value: {1}".format(feed_id, payload)) + # Connect to WiFi print("Connecting to WiFi...") wifi.connect() @@ -84,9 +85,11 @@ def message(client, feed_id, payload): MQTT.set_socket(socket, esp) # Initialize a new MQTT Client object -mqtt_client = MQTT.MQTT(broker="https://io.adafruit.com", - username=secrets["aio_user"], - password=secrets["aio_key"]) +mqtt_client = MQTT.MQTT( + broker="https://io.adafruit.com", + username=secrets["aio_user"], + password=secrets["aio_key"], +) # Initialize an Adafruit IO MQTT Client io = IO_MQTT(mqtt_client) diff --git a/examples/mqtt/adafruit_io_simpletest.py b/examples/mqtt/adafruit_io_simpletest.py index ec6c28c..e6f60aa 100755 --- a/examples/mqtt/adafruit_io_simpletest.py +++ b/examples/mqtt/adafruit_io_simpletest.py @@ -89,6 +89,7 @@ def message(client, feed_id, payload): # the new value. print("Feed {0} received new value: {1}".format(feed_id, payload)) + # Connect to WiFi print("Connecting to WiFi...") wifi.connect() @@ -98,9 +99,11 @@ def message(client, feed_id, payload): MQTT.set_socket(socket, esp) # Initialize a new MQTT Client object -mqtt_client = MQTT.MQTT(broker="https://io.adafruit.com", - username=secrets["aio_user"], - password=secrets["aio_key"]) +mqtt_client = MQTT.MQTT( + broker="https://io.adafruit.com", + username=secrets["aio_user"], + password=secrets["aio_key"], +) # Initialize an Adafruit IO MQTT Client diff --git a/examples/mqtt/adafruit_io_simpletest_eth.py b/examples/mqtt/adafruit_io_simpletest_eth.py index e5fc421..bcba9ce 100755 --- a/examples/mqtt/adafruit_io_simpletest_eth.py +++ b/examples/mqtt/adafruit_io_simpletest_eth.py @@ -40,19 +40,23 @@ def connected(client): # Subscribe to changes on a feed named DemoFeed. client.subscribe("DemoFeed") + def subscribe(client, userdata, topic, granted_qos): # This method is called when the client subscribes to a new feed. - print('Subscribed to {0} with QOS level {1}'.format(topic, granted_qos)) + print("Subscribed to {0} with QOS level {1}".format(topic, granted_qos)) + def unsubscribe(client, userdata, topic, pid): # This method is called when the client unsubscribes from a feed. - print('Unsubscribed from {0} with PID {1}'.format(topic, pid)) + print("Unsubscribed from {0} with PID {1}".format(topic, pid)) + # pylint: disable=unused-argument def disconnected(client): # Disconnected function will be called when the client disconnects. print("Disconnected from Adafruit IO!") + # pylint: disable=unused-argument def message(client, feed_id, payload): # Message function will be called when a subscribed feed has a new value. @@ -60,13 +64,16 @@ def message(client, feed_id, payload): # the new value. print("Feed {0} received new value: {1}".format(feed_id, payload)) + # Initialize MQTT interface with the ethernet interface MQTT.set_socket(socket, eth) # Initialize a new MQTT Client object -mqtt_client = MQTT.MQTT(broker="http://io.adafruit.com", - username=secrets["aio_user"], - password=secrets["aio_key"]) +mqtt_client = MQTT.MQTT( + broker="http://io.adafruit.com", + username=secrets["aio_user"], + password=secrets["aio_key"], +) # Initialize an Adafruit IO MQTT Client io = IO_MQTT(mqtt_client) diff --git a/examples/mqtt/adafruit_io_time.py b/examples/mqtt/adafruit_io_time.py index 546e71a..142ccb6 100755 --- a/examples/mqtt/adafruit_io_time.py +++ b/examples/mqtt/adafruit_io_time.py @@ -99,9 +99,11 @@ def message(client, feed_id, payload): MQTT.set_socket(socket, esp) # Initialize a new MQTT Client object -mqtt_client = MQTT.MQTT(broker="https://io.adafruit.com", - username=secrets["aio_user"], - password=secrets["aio_key"]) +mqtt_client = MQTT.MQTT( + broker="https://io.adafruit.com", + username=secrets["aio_user"], + password=secrets["aio_key"], +) # Initialize an Adafruit IO MQTT Client io = IO_MQTT(mqtt_client)