Skip to content

Black reformatting with Python 3 target. #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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