本文整理匯總了Python中voluptuous.ALLOW_EXTRA屬性的典型用法代碼示例。如果您正苦於以下問題:Python voluptuous.ALLOW_EXTRA屬性的具體用法?Python voluptuous.ALLOW_EXTRA怎麽用?Python voluptuous.ALLOW_EXTRA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類voluptuous
的用法示例。
在下文中一共展示了voluptuous.ALLOW_EXTRA屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_schema
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def create_schema():
global options
# Miss out CONFIG_SCHEMA_PARAMETERS1a and use CONFIG_SCHEMA instead
dest = {**CONFIG_SCHEMA, **create_parameters1cv(options), **create_parameters2cv(options), **create_parameters3cv(options), **create_parameters4cv(options)}
#_LOGGER.info("Visonic create schema = {0}".format(dest))
return dest # vol.Schema({ DOMAIN: vol.Schema(dest), }, extra=vol.ALLOW_EXTRA )
示例2: schema
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def schema(self) -> vol.Schema:
return vol.Schema({}, extra=vol.ALLOW_EXTRA)
示例3: load_tcconfig
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def load_tcconfig(self, config_file_path):
from voluptuous import Schema, Required, Any, ALLOW_EXTRA
schema = Schema(
{Required(str): {Any(*TrafficDirection.LIST): {str: {str: Any(str, int, float)}}}},
extra=ALLOW_EXTRA,
)
with open(config_file_path, encoding="utf-8") as fp:
self.__config_table = json.load(fp)
schema(self.__config_table)
self.__logger.debug(
"tc config file: {:s}".format(json.dumps(self.__config_table, indent=4))
)
示例4: _validate
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def _validate(self):
schema = Schema(
All(self._schema, *self._custom_validators),
extra=ALLOW_EXTRA,
)
schema(self._confdata)
示例5: input_schema
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def input_schema(cls):
return vol.Schema(cls._input_schema_dict, extra=vol.ALLOW_EXTRA)
示例6: schema
# 需要導入模塊: import voluptuous [as 別名]
# 或者: from voluptuous import ALLOW_EXTRA [as 別名]
def schema(self, extended=True, extra=vol.ALLOW_EXTRA):
"""Returns the extended schema of the class"""
if extended is False:
return getattr_explicit(
type(self), self._schema_attr, vol.Schema({}))
schema = vol.Schema({}, extra=extra)
classes = inspect.getmro(self)[::-1]
for c in classes:
c_schema = getattr_explicit(c, self._schema_attr, None)
if c_schema is not None:
schema = schema.extend(c_schema.schema)
return schema