(option, value)
return props
Validate authMechanismProperties.
Validate authMechanismProperties.
Validate authMechanismProperties .
def validate_auth_mechanism_properties(option, value):
    """Validate authMechanismProperties."""
    value = validate_string(option, value)
    props = {}
    for opt in value.split(','):
        try:
            key, val = opt.split(':')
        except ValueError:
            raise ValueError("auth mechanism properties must be "
                             "key:value pairs like SERVICE_NAME:"
                             "mongodb, not %s." % (opt,))
        if key not in _MECHANISM_PROPS:
            raise ValueError("%s is not a supported auth "
                             "mechanism property. Must be one of "
                             "%s." % (key, tuple(_MECHANISM_PROPS)))
        if key == 'CANONICALIZE_HOST_NAME':
            props[key] = validate_boolean_or_string(key, val)
        else:
            props[key] = val

    return props
def validate_auth_mechanism_properties ( option , value ) : value = validate_string ( option , value ) props = { } for opt in value . split ( ',' ) : try : key , val = opt . split ( ':' ) except ValueError : raise ValueError ( "auth mechanism properties must be " "key:value pairs like SERVICE_NAME:" "mongodb, not %s." % ( opt , ) ) if key not in _MECHANISM_PROPS : raise ValueError ( "%s is not a supported auth " "mechanism property. Must be one of " "%s." % ( key , tuple ( _MECHANISM_PROPS ) ) ) if key == 'CANONICALIZE_HOST_NAME' : props [ key ] = validate_boolean_or_string ( key , val ) else : props [ key ] = val return props