How to use the yamale.util function in yamale

To help you get started, we’ve selected a few yamale examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 23andMe / Yamale / yamale / validators / validators.py View on Github external
class Mac(Regex):
    """MAC address validator"""
    tag = 'mac'

    def __init__(self, *args, **kwargs):
        super(Mac, self).__init__(*args, **kwargs)
        self.regexes = [
            re.compile("[0-9a-fA-F]{2}([-:]?)[0-9a-fA-F]{2}(\\1[0-9a-fA-F]{2}){4}$"),
            re.compile("[0-9a-fA-F]{4}([-:]?)[0-9a-fA-F]{4}(\\1[0-9a-fA-F]{4})$"),
        ]


DefaultValidators = {}

for v in util.get_subclasses(Validator):
    # Allow validator nodes to contain either tags or actual name
    DefaultValidators[v.tag] = v
    DefaultValidators[v.__name__] = v
github 23andMe / Yamale / yamale / schema / data.py View on Github external
def __init__(self, data_dict, name=''):
        flat_data = util.flatten(data_dict, keep_iter=True)
        dict.__init__(self, flat_data)
        self.name = name
        self.dict = data_dict