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 pass
GIT_SCHEMA = { GIT_SCHEMA = Schema(
{
Required(CONF_URL): url, Required(CONF_URL): url,
Optional(CONF_REF): git_ref, Optional(CONF_REF): git_ref,
Optional(CONF_USERNAME): string, Optional(CONF_USERNAME): string,
Optional(CONF_PASSWORD): string, Optional(CONF_PASSWORD): string,
} }
LOCAL_SCHEMA = { )
LOCAL_SCHEMA = Schema(
{
Required(CONF_PATH): directory, Required(CONF_PATH): directory,
} }
)
def validate_source_shorthand(value): def validate_source_shorthand(value):
@ -2053,8 +2057,8 @@ SOURCE_SCHEMA = Any(
validate_source_shorthand, validate_source_shorthand,
typed_schema( typed_schema(
{ {
TYPE_GIT: Schema(GIT_SCHEMA), TYPE_GIT: GIT_SCHEMA,
TYPE_LOCAL: Schema(LOCAL_SCHEMA), TYPE_LOCAL: LOCAL_SCHEMA,
} }
), ),
) )