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

Bump pylint from 2.10.2 to 2.11.1 (#2334)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
dependabot[bot]
2021-09-19 19:22:28 +02:00
committed by GitHub
parent 50da630811
commit dbb195691b
40 changed files with 219 additions and 384 deletions

View File

@@ -74,19 +74,20 @@ def wizard_file(**kwargs):
# Configure API
if "password" in kwargs:
config += ' password: "{0}"\n'.format(kwargs["password"])
config += f" password: \"{kwargs['password']}\"\n"
# Configure OTA
config += "\nota:\n"
if "ota_password" in kwargs:
config += ' password: "{0}"'.format(kwargs["ota_password"])
config += f" password: \"{kwargs['ota_password']}\""
elif "password" in kwargs:
config += ' password: "{0}"'.format(kwargs["password"])
config += f" password: \"{kwargs['password']}\""
# Configuring wifi
config += "\n\nwifi:\n"
if "ssid" in kwargs:
# pylint: disable=consider-using-f-string
config += """ ssid: "{ssid}"
password: "{psk}"
""".format(
@@ -99,6 +100,7 @@ def wizard_file(**kwargs):
networks:
"""
# pylint: disable=consider-using-f-string
config += """
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
@@ -126,7 +128,7 @@ def wizard_write(path, **kwargs):
platform = kwargs["platform"]
write_file(path, wizard_file(**kwargs))
storage = StorageJSON.from_wizard(name, name + ".local", platform, board)
storage = StorageJSON.from_wizard(name, f"{name}.local", platform, board)
storage_path = ext_storage_path(os.path.dirname(path), os.path.basename(path))
storage.save(storage_path)
@@ -168,14 +170,12 @@ def strip_accents(value):
def wizard(path):
if not path.endswith(".yaml") and not path.endswith(".yml"):
safe_print(
"Please make your configuration file {} have the extension .yaml or .yml"
"".format(color(Fore.CYAN, path))
f"Please make your configuration file {color(Fore.CYAN, path)} have the extension .yaml or .yml"
)
return 1
if os.path.exists(path):
safe_print(
"Uh oh, it seems like {} already exists, please delete that file first "
"or chose another configuration file.".format(color(Fore.CYAN, path))
f"Uh oh, it seems like {color(Fore.CYAN, path)} already exists, please delete that file first or chose another configuration file."
)
return 2
safe_print("Hi there!")
@@ -191,17 +191,13 @@ def wizard(path):
sleep(3.0)
safe_print()
safe_print_step(1, CORE_BIG)
safe_print(
"First up, please choose a " + color(Fore.GREEN, "name") + " for your node."
)
safe_print(f"First up, please choose a {color(Fore.GREEN, 'name')} for your node.")
safe_print(
"It should be a unique name that can be used to identify the device later."
)
sleep(1)
safe_print(
"For example, I like calling the node in my living room {}.".format(
color(Fore.BOLD_WHITE, "livingroom")
)
f"For example, I like calling the node in my living room {color(Fore.BOLD_WHITE, 'livingroom')}."
)
safe_print()
sleep(1)
@@ -222,13 +218,11 @@ def wizard(path):
name = strip_accents(name).lower().replace(" ", "-")
name = strip_accents(name).lower().replace("_", "-")
name = "".join(c for c in name if c in ALLOWED_NAME_CHARS)
safe_print(
'Shall I use "{}" as the name instead?'.format(color(Fore.CYAN, name))
)
safe_print(f'Shall I use "{color(Fore.CYAN, name)}" as the name instead?')
sleep(0.5)
name = default_input("(name [{}]): ", name)
safe_print('Great! Your node is now called "{}".'.format(color(Fore.CYAN, name)))
safe_print(f'Great! Your node is now called "{color(Fore.CYAN, name)}".')
sleep(1)
safe_print_step(2, ESP_BIG)
safe_print(
@@ -236,11 +230,7 @@ def wizard(path):
"firmwares for it."
)
safe_print(
"Are you using an "
+ color(Fore.GREEN, "ESP32")
+ " or "
+ color(Fore.GREEN, "ESP8266")
+ " platform? (Choose ESP8266 for Sonoff devices)"
f"Are you using an {color(Fore.GREEN, 'ESP32')} or {color(Fore.GREEN, 'ESP8266')} platform? (Choose ESP8266 for Sonoff devices)"
)
while True:
sleep(0.5)
@@ -252,12 +242,9 @@ def wizard(path):
break
except vol.Invalid:
safe_print(
"Unfortunately, I can't find an espressif microcontroller called "
'"{}". Please try again.'.format(platform)
f'Unfortunately, I can\'t find an espressif microcontroller called "{platform}". Please try again.'
)
safe_print(
"Thanks! You've chosen {} as your platform.".format(color(Fore.CYAN, platform))
)
safe_print(f"Thanks! You've chosen {color(Fore.CYAN, platform)} as your platform.")
safe_print()
sleep(1)
@@ -270,24 +257,20 @@ def wizard(path):
"http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards"
)
safe_print(
"Next, I need to know what " + color(Fore.GREEN, "board") + " you're using."
)
safe_print(f"Next, I need to know what {color(Fore.GREEN, 'board')} you're using.")
sleep(0.5)
safe_print(
"Please go to {} and choose a board.".format(color(Fore.GREEN, board_link))
)
safe_print(f"Please go to {color(Fore.GREEN, board_link)} and choose a board.")
if platform == "ESP32":
safe_print("(Type " + color(Fore.GREEN, "esp01_1m") + " for Sonoff devices)")
safe_print(f"(Type {color(Fore.GREEN, 'esp01_1m')} for Sonoff devices)")
safe_print()
# Don't sleep because user needs to copy link
if platform == "ESP32":
safe_print('For example "{}".'.format(color(Fore.BOLD_WHITE, "nodemcu-32s")))
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'nodemcu-32s')}\".")
boards = list(ESP32_BOARD_PINS.keys())
else:
safe_print('For example "{}".'.format(color(Fore.BOLD_WHITE, "nodemcuv2")))
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'nodemcuv2')}\".")
boards = list(ESP8266_BOARD_PINS.keys())
safe_print("Options: {}".format(", ".join(sorted(boards))))
safe_print(f"Options: {', '.join(sorted(boards))}")
while True:
board = input(color(Fore.BOLD_WHITE, "(board): "))
@@ -302,9 +285,7 @@ def wizard(path):
sleep(0.25)
safe_print()
safe_print(
"Way to go! You've chosen {} as your board.".format(color(Fore.CYAN, board))
)
safe_print(f"Way to go! You've chosen {color(Fore.CYAN, board)} as your board.")
safe_print()
sleep(1)
@@ -313,12 +294,10 @@ def wizard(path):
safe_print()
sleep(1)
safe_print(
"First, what's the "
+ color(Fore.GREEN, "SSID")
+ f" (the name) of the WiFi network {name} should connect to?"
f"First, what's the {color(Fore.GREEN, 'SSID')} (the name) of the WiFi network {name} should connect to?"
)
sleep(1.5)
safe_print('For example "{}".'.format(color(Fore.BOLD_WHITE, "Abraham Linksys")))
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'Abraham Linksys')}\".")
while True:
ssid = input(color(Fore.BOLD_WHITE, "(ssid): "))
try:
@@ -328,27 +307,23 @@ def wizard(path):
safe_print(
color(
Fore.RED,
'Unfortunately, "{}" doesn\'t seem to be a valid SSID. '
"Please try again.".format(ssid),
f'Unfortunately, "{ssid}" doesn\'t seem to be a valid SSID. Please try again.',
)
)
safe_print()
sleep(1)
safe_print(
'Thank you very much! You\'ve just chosen "{}" as your SSID.'
"".format(color(Fore.CYAN, ssid))
f'Thank you very much! You\'ve just chosen "{color(Fore.CYAN, ssid)}" as your SSID.'
)
safe_print()
sleep(0.75)
safe_print(
"Now please state the "
+ color(Fore.GREEN, "password")
+ " of the WiFi network so that I can connect to it (Leave empty for no password)"
f"Now please state the {color(Fore.GREEN, 'password')} of the WiFi network so that I can connect to it (Leave empty for no password)"
)
safe_print()
safe_print('For example "{}"'.format(color(Fore.BOLD_WHITE, "PASSWORD42")))
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'PASSWORD42')}\"")
sleep(0.5)
psk = input(color(Fore.BOLD_WHITE, "(PSK): "))
safe_print(
@@ -362,8 +337,7 @@ def wizard(path):
"(over the air) and integrates into Home Assistant with a native API."
)
safe_print(
"This can be insecure if you do not trust the WiFi network. Do you want to set "
"a " + color(Fore.GREEN, "password") + " for connecting to this ESP?"
f"This can be insecure if you do not trust the WiFi network. Do you want to set a {color(Fore.GREEN, 'password')} for connecting to this ESP?"
)
safe_print()
sleep(0.25)