Skip to content

Commit

Permalink
Merge pull request #33 from adafruit/black-update
Browse files Browse the repository at this point in the history
Black reformatting with Python 3 target.
  • Loading branch information
dhalbert committed Apr 10, 2020
2 parents 5cb8c04 + 42a3e4a commit 98ed369
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 26 deletions.
1 change: 0 additions & 1 deletion adafruit_io/adafruit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -133,7 +133,7 @@
(
master_doc,
"AdafruitAdafruit_IOLibrary.tex",
u"AdafruitAdafruit_IO Library Documentation",
"AdafruitAdafruit_IO Library Documentation",
author,
"manual",
),
Expand All @@ -147,7 +147,7 @@
(
master_doc,
"AdafruitAdafruit_IOlibrary",
u"Adafruit Adafruit_IO Library Documentation",
"Adafruit Adafruit_IO Library Documentation",
[author],
1,
)
Expand All @@ -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.",
Expand Down
9 changes: 6 additions & 3 deletions examples/mqtt/adafruit_io_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions examples/mqtt/adafruit_io_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions examples/mqtt/adafruit_io_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
17 changes: 12 additions & 5 deletions examples/mqtt/adafruit_io_simpletest_eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,40 @@ 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.
# The feed_id parameter identifies the feed, and the payload parameter has
# 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)
Expand Down
8 changes: 5 additions & 3 deletions examples/mqtt/adafruit_io_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 98ed369

Please sign in to comment.