@classmethod<EOL><INDENT>def validate(cls, cfg, path="<STR_LIT>", nested=<NUM_LIT:0>, parent_cfg=None):<DEDENT>
<EOL>num_crit = <NUM_LIT:0><EOL>num_warn = <NUM_LIT:0><EOL>for name in dir(cls):<EOL><INDENT>if nested > <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>try:<EOL><INDENT>attr = getattr(cls, name)<EOL>if isinstance(attr, Attribute):<EOL><INDENT>if attr.default is None and name not in cfg:<EOL><INDENT>if path:<EOL><INDENT>attr_full_name = "<STR_LIT>" % (path, name)<EOL><DEDENT>else:<EOL><INDENT>attr_full_name = name<EOL><DEDENT>raise vodka.exceptions.ConfigErrorMissing(<EOL>attr_full_name, attr)<EOL><DEDENT>attr.preload(cfg, name)<EOL><DEDENT><DEDENT>except vodka.exceptions.ConfigErrorMissing as inst:<EOL><INDENT>if inst.level == "<STR_LIT>":<EOL><INDENT>vodka.log.warn(inst.explanation)<EOL>num_warn += <NUM_LIT:1><EOL><DEDENT>elif inst.level == "<STR_LIT>":<EOL><INDENT>vodka.log.error(inst.explanation)<EOL>num_crit += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>if type(cfg) in [dict, Config]:<EOL><INDENT>keys = list(cfg.keys())<EOL>if nested > <NUM_LIT:0>:<EOL><INDENT>for _k, _v in cfg.items():<EOL><INDENT>_num_crit, _num_warn = cls.validate(<EOL>_v,<EOL>path=("<STR_LIT>" % (path, _k)),<EOL>nested=nested-<NUM_LIT:1>,<EOL>parent_cfg=cfg<EOL>)<EOL>num_crit += _num_crit<EOL>num_warn += _num_warn<EOL><DEDENT>return num_crit, num_warn<EOL><DEDENT><DEDENT>elif type(cfg) == list:<EOL><INDENT>keys = list(range(<NUM_LIT:0>, len(cfg)))<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>for key in keys:<EOL><INDENT>try:<EOL><INDENT>_num_crit, _num_warn = cls.check(cfg, key, path)<EOL>num_crit += _num_crit<EOL>num_warn += _num_warn<EOL><DEDENT>except (<EOL>vodka.exceptions.ConfigErrorUnknown,<EOL>vodka.exceptions.ConfigErrorValue,<EOL>vodka.exceptions.ConfigErrorType<EOL>) as inst:<EOL><INDENT>if inst.level == "<STR_LIT>":<EOL><INDENT>vodka.log.warn(inst.explanation)<EOL>num_warn += <NUM_LIT:1><EOL><DEDENT>elif inst.level == "<STR_LIT>":<EOL><INDENT>vodka.log.error(inst.explanation)<EOL>num_crit += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return num_crit, num_warn<EOL>
Validates a section of a config dict. Will automatically
validate child sections as well if their attribute pointers
are instantiated with a handler property