Python voluptuous.ALLOW_EXTRA Examples

The following are 6 code examples of voluptuous.ALLOW_EXTRA(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module voluptuous , or try the search function .
Example #1
Source File: create_schema.py    From visonic with Apache License 2.0 5 votes vote down vote up
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 ) 
Example #2
Source File: test_deploy.py    From takeoff with GNU General Public License v3.0 5 votes vote down vote up
def schema(self) -> vol.Schema:
        return vol.Schema({}, extra=vol.ALLOW_EXTRA) 
Example #3
Source File: _importer.py    From tcconfig with MIT License 5 votes vote down vote up
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))
        ) 
Example #4
Source File: config.py    From spid-testenv2 with GNU Affero General Public License v3.0 5 votes vote down vote up
def _validate(self):
        schema = Schema(
            All(self._schema, *self._custom_validators),
            extra=ALLOW_EXTRA,
        )
        schema(self._confdata) 
Example #5
Source File: instanceio.py    From flavio with MIT License 5 votes vote down vote up
def input_schema(cls):
        return vol.Schema(cls._input_schema_dict, extra=vol.ALLOW_EXTRA) 
Example #6
Source File: utils.py    From LedFx with MIT License 5 votes vote down vote up
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