dpath/path.py
def validate(path, separator="/", regex=None):
    """
    Validate that all the keys in the given list of path components are valid, given that they do not contain the separator, and match any optional regex given.
    """
    validated = []
    for elem in path:
        key = elem[0]
        strkey = str(key)
        if (separator and (separator in strkey)):
            raise dpath.exceptions.InvalidKeyName("{} at {} contains the separator {}"
                                                  "".format(strkey,
                                                            separator.join(validated),
                                                            separator))
        elif (regex and (not regex.findall(strkey))):
            raise dpath.exceptions.InvalidKeyName("{} at {} does not match the expression {}"
                                                  "".format(strkey,
                                                            separator.join(validated),
                                                            regex.pattern))
        validated.append(strkey)

    Validate that all the keys in the given list of path components are valid, given that they do not contain the separator, and match any optional regex given.
    
Validate that all the keys in the given list of path components are valid, given that they do not contain the separator, and match any optional regex given.
Validate that all the keys in the given list of path components are valid given that they do not contain the separator and match any optional regex given .
def validate(path, separator="/", regex=None):
    validated = []
    for elem in path:
        key = elem[0]
        strkey = str(key)
        if (separator and (separator in strkey)):
            raise dpath.exceptions.InvalidKeyName("{} at {} contains the separator {}"
                                                  "".format(strkey,
                                                            separator.join(validated),
                                                            separator))
        elif (regex and (not regex.findall(strkey))):
            raise dpath.exceptions.InvalidKeyName("{} at {} does not match the expression {}"
                                                  "".format(strkey,
                                                            separator.join(validated),
                                                            regex.pattern))
        validated.append(strkey)
def validate ( path , separator = "/" , regex = None ) : validated = [ ] for elem in path : key = elem [ 0 ] strkey = str ( key ) if ( separator and ( separator in strkey ) ) : raise dpath . exceptions . InvalidKeyName ( "{} at {} contains the separator {}" "" . format ( strkey , separator . join ( validated ) , separator ) ) elif ( regex and ( not regex . findall ( strkey ) ) ) : raise dpath . exceptions . InvalidKeyName ( "{} at {} does not match the expression {}" "" . format ( strkey , separator . join ( validated ) , regex . pattern ) ) validated . append ( strkey )
Validate that all the keys in the given list of path components are valid, given that they do not contain the separator, and match any optional regex given.
Validate that all the keys in the given list of path components are valid given that they do not contain the separator and match any optional regex given .
"""
    Validate that all the keys in the given list of path components are valid, given that they do not contain the separator, and match any optional regex given.
    """
path
separator
regex