1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 08:12:22 +01:00

Drop Python 2 Support (#793)

* Remove Python 2 support

* Remove u-strings

* Remove docker symlinks

* Remove from travis

* Update requirements

* Upgrade flake8/pylint

* Fixes

* Manual

* Run pyupgrade

* Lint

* Remove base_int

* Fix

* Update platformio_api.py

* Update component.cpp
This commit is contained in:
Otto Winter
2019-12-07 18:28:55 +01:00
committed by GitHub
parent b5714cd70f
commit 056c72d50d
78 changed files with 815 additions and 1097 deletions

View File

@@ -64,28 +64,28 @@ def validate_config(value):
topic_prefix = value[CONF_TOPIC_PREFIX]
if CONF_BIRTH_MESSAGE not in value:
out[CONF_BIRTH_MESSAGE] = {
CONF_TOPIC: '{}/status'.format(topic_prefix),
CONF_TOPIC: f'{topic_prefix}/status',
CONF_PAYLOAD: 'online',
CONF_QOS: 0,
CONF_RETAIN: True,
}
if CONF_WILL_MESSAGE not in value:
out[CONF_WILL_MESSAGE] = {
CONF_TOPIC: '{}/status'.format(topic_prefix),
CONF_TOPIC: f'{topic_prefix}/status',
CONF_PAYLOAD: 'offline',
CONF_QOS: 0,
CONF_RETAIN: True,
}
if CONF_SHUTDOWN_MESSAGE not in value:
out[CONF_SHUTDOWN_MESSAGE] = {
CONF_TOPIC: '{}/status'.format(topic_prefix),
CONF_TOPIC: f'{topic_prefix}/status',
CONF_PAYLOAD: 'offline',
CONF_QOS: 0,
CONF_RETAIN: True,
}
if CONF_LOG_TOPIC not in value:
out[CONF_LOG_TOPIC] = {
CONF_TOPIC: '{}/debug'.format(topic_prefix),
CONF_TOPIC: f'{topic_prefix}/debug',
CONF_QOS: 0,
CONF_RETAIN: True,
}
@@ -95,7 +95,7 @@ def validate_config(value):
def validate_fingerprint(value):
value = cv.string(value)
if re.match(r'^[0-9a-f]{40}$', value) is None:
raise cv.Invalid(u"fingerprint must be valid SHA1 hash")
raise cv.Invalid("fingerprint must be valid SHA1 hash")
return value