mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Clean up ALLOWED_CHARS (#1235)
This commit is contained in:
parent
aad9a539c1
commit
8a294e4134
2 changed files with 5 additions and 6 deletions
|
@ -11,9 +11,9 @@ from string import ascii_letters, digits
|
|||
import voluptuous as vol
|
||||
|
||||
from esphome import core
|
||||
from esphome.const import CONF_AVAILABILITY, CONF_COMMAND_TOPIC, CONF_DISCOVERY, CONF_ID, \
|
||||
CONF_INTERNAL, CONF_NAME, CONF_PAYLOAD_AVAILABLE, CONF_PAYLOAD_NOT_AVAILABLE, \
|
||||
CONF_RETAIN, CONF_SETUP_PRIORITY, CONF_STATE_TOPIC, CONF_TOPIC, \
|
||||
from esphome.const import ALLOWED_NAME_CHARS, CONF_AVAILABILITY, CONF_COMMAND_TOPIC, \
|
||||
CONF_DISCOVERY, CONF_ID, CONF_INTERNAL, CONF_NAME, CONF_PAYLOAD_AVAILABLE, \
|
||||
CONF_PAYLOAD_NOT_AVAILABLE, CONF_RETAIN, CONF_SETUP_PRIORITY, CONF_STATE_TOPIC, CONF_TOPIC, \
|
||||
CONF_HOUR, CONF_MINUTE, CONF_SECOND, CONF_VALUE, CONF_UPDATE_INTERVAL, CONF_TYPE_ID, CONF_TYPE
|
||||
from esphome.core import CORE, HexInt, IPAddress, Lambda, TimePeriod, TimePeriodMicroseconds, \
|
||||
TimePeriodMilliseconds, TimePeriodSeconds, TimePeriodMinutes
|
||||
|
@ -40,8 +40,6 @@ ALLOW_EXTRA = vol.ALLOW_EXTRA
|
|||
UNDEFINED = vol.UNDEFINED
|
||||
RequiredFieldInvalid = vol.RequiredFieldInvalid
|
||||
|
||||
ALLOWED_NAME_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_-'
|
||||
|
||||
RESERVED_IDS = [
|
||||
# C++ keywords http://en.cppreference.com/w/cpp/keyword
|
||||
'alignas', 'alignof', 'and', 'and_eq', 'asm', 'auto', 'bitand', 'bitor', 'bool', 'break',
|
||||
|
|
|
@ -11,6 +11,7 @@ from esphome.helpers import color, get_bool_env, write_file
|
|||
from esphome.pins import ESP32_BOARD_PINS, ESP8266_BOARD_PINS
|
||||
from esphome.storage_json import StorageJSON, ext_storage_path
|
||||
from esphome.util import safe_print
|
||||
from esphome.const import ALLOWED_NAME_CHARS
|
||||
|
||||
CORE_BIG = r""" _____ ____ _____ ______
|
||||
/ ____/ __ \| __ \| ____|
|
||||
|
@ -172,7 +173,7 @@ def wizard(path):
|
|||
f"include numbers, lower-case letters, underscores and "
|
||||
f"hyphens."))
|
||||
name = strip_accents(name).lower().replace(' ', '_')
|
||||
name = ''.join(c for c in name if c in cv.ALLOWED_NAME_CHARS)
|
||||
name = ''.join(c for c in name if c in ALLOWED_NAME_CHARS)
|
||||
safe_print("Shall I use \"{}\" as the name instead?".format(color('cyan', name)))
|
||||
sleep(0.5)
|
||||
name = default_input("(name [{}]): ", name)
|
||||
|
|
Loading…
Reference in a new issue