azure-keyvault/azure/keyvault/key_vault_id.py
def _parse(self, uri, validation_args):
        """
        Parses  the specified uri, using _id_format as a format string, and sets the parsed format arguments as 
        attributes on the current id object.
        :param uri: The key vault identifier uri to be parsed
        :param validation_args: format arguments to be validated
        :return: None
        """
        def format_error():
            return ValueError('invalid id: The specified uri "{}", does to match the specified format "{}"'.format(uri, self._id_format))

        uri = _validate_string_argument(uri, 'uri')
        parsed_uri = _parse_uri_argument(uri)

        # split all the id segments from the uri path using and insert the host as the first segment
        id_segs = list(filter(None, parsed_uri.path.split('/')))
        id_segs.insert(0, '{}://{}'.format(parsed_uri.scheme, parsed_uri.hostname))

        # split the format segments from the classes format string
        fmt_segs = list(filter(None, self._id_format.split('/')))

        for ix in range(len(fmt_segs)):
            # get the format segment and the id segment
            fmt_seg = fmt_segs[ix]
            id_seg = id_segs.pop(0) if len(id_segs) > 0 else ''

            # if the segment is a substitution element
            if fmt_seg.startswith('{') and fmt_seg.endswith('}'):
                prop = fmt_seg[1:-1]
                prop_strip = prop.rstrip('?')
                # if the segment is not present in the specified uri and is not optional raise an error
                if not id_seg and not prop.endswith('?'):
                    raise format_error()
                # if the segment is in the segments to validate and doesn't match the expected vault raise an error
                if prop_strip in validation_args and validation_args[prop_strip] and validation_args[prop_strip] != id_seg:
                    if id_seg and not prop.endswith('?'):
                        raise ValueError('invalid id: The {} "{}" does not match the expected "{}"'.format(prop, id_seg, validation_args[prop_strip]))
                # set the attribute to the value parsed from the uri
                self.__dict__[prop_strip] = id_seg
            # otherwise the segment is a literal element
            else:
                # if the value parsed from the uri doesn't match the literal value from the format string raise an error
                if not fmt_seg == id_seg:
                    raise format_error()

        # if there are still segments left in the uri which were not accounted for in the format string raise an error
        if len(id_segs) > 0:
            raise format_error()
def _parse(self, uri, validation_args):
        """
        Parses  the specified uri, using _id_format as a format string, and sets the parsed format arguments as 
        attributes on the current id object.
        :param uri: The key vault identifier uri to be parsed
        :param validation_args: format arguments to be validated
        :return: None
        """
        def format_error():
            return ValueError('invalid id: The specified uri "{}", does to match the specified format "{}"'.format(uri, self._id_format))

        uri = _validate_string_argument(uri, 'uri')
        parsed_uri = _parse_uri_argument(uri)

        # split all the id segments from the uri path using and insert the host as the first segment
        id_segs = list(filter(None, parsed_uri.path.split('/')))
        id_segs.insert(0, '{}://{}'.format(parsed_uri.scheme, parsed_uri.hostname))

        # split the format segments from the classes format string
        fmt_segs = list(filter(None, self._id_format.split('/')))

        for ix in range(len(fmt_segs)):
            # get the format segment and the id segment
            fmt_seg = fmt_segs[ix]
            id_seg = id_segs.pop(0) if len(id_segs) > 0 else ''

            # if the segment is a substitution element
            if fmt_seg.startswith('{') and fmt_seg.endswith('}'):
                prop = fmt_seg[1:-1]
                prop_strip = prop.rstrip('?')
                # if the segment is not present in the specified uri and is not optional raise an error
                if not id_seg and not prop.endswith('?'):
                    raise format_error()
                # if the segment is in the segments to validate and doesn't match the expected vault raise an error
                if prop_strip in validation_args and validation_args[prop_strip] and validation_args[prop_strip] != id_seg:
                    if id_seg and not prop.endswith('?'):
                        raise ValueError('invalid id: The {} "{}" does not match the expected "{}"'.format(prop, id_seg, validation_args[prop_strip]))
                # set the attribute to the value parsed from the uri
                self.__dict__[prop_strip] = id_seg
            # otherwise the segment is a literal element
            else:
                # if the value parsed from the uri doesn't match the literal value from the format string raise an error
                if not fmt_seg == id_seg:
                    raise format_error()

        # if there are still segments left in the uri which were not accounted for in the format string raise an error
        if len(id_segs) > 0:
            raise format_error()
Parses  the specified uri, using _id_format as a format string, and sets the parsed format arguments as 
        attributes on the current id object.
        :param uri: The key vault identifier uri to be parsed
        :param validation_args: format arguments to be validated
        :return: None