本文整理汇总了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