mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 02:04:13 +01:00
CV: tidy up Schema wrapper (#6105)
This commit is contained in:
parent
0cd232cdf5
commit
b606e976e1
1 changed files with 15 additions and 11 deletions
|
@ -2004,15 +2004,19 @@ def suppress_invalid():
|
|||
pass
|
||||
|
||||
|
||||
GIT_SCHEMA = {
|
||||
Required(CONF_URL): url,
|
||||
Optional(CONF_REF): git_ref,
|
||||
Optional(CONF_USERNAME): string,
|
||||
Optional(CONF_PASSWORD): string,
|
||||
}
|
||||
LOCAL_SCHEMA = {
|
||||
Required(CONF_PATH): directory,
|
||||
}
|
||||
GIT_SCHEMA = Schema(
|
||||
{
|
||||
Required(CONF_URL): url,
|
||||
Optional(CONF_REF): git_ref,
|
||||
Optional(CONF_USERNAME): string,
|
||||
Optional(CONF_PASSWORD): string,
|
||||
}
|
||||
)
|
||||
LOCAL_SCHEMA = Schema(
|
||||
{
|
||||
Required(CONF_PATH): directory,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def validate_source_shorthand(value):
|
||||
|
@ -2053,8 +2057,8 @@ SOURCE_SCHEMA = Any(
|
|||
validate_source_shorthand,
|
||||
typed_schema(
|
||||
{
|
||||
TYPE_GIT: Schema(GIT_SCHEMA),
|
||||
TYPE_LOCAL: Schema(LOCAL_SCHEMA),
|
||||
TYPE_GIT: GIT_SCHEMA,
|
||||
TYPE_LOCAL: LOCAL_SCHEMA,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue