CV: tidy up Schema wrapper (#6105)

This commit is contained in:
Jesse Hills 2024-01-17 20:28:46 +13:00 committed by GitHub
parent 0cd232cdf5
commit b606e976e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
}
),
)