#NEWLINE# @ classmethod #NEWLINE# def name_matches_object( cls , name , task_id = None , exact = True ) : #NEWLINE# #INDENT# "Determine if a resource name could have been created by this class.\n\n        :param name: The resource name to check against this class's\n                     RESOURCE_NAME_FORMAT.\n        :param task_id: The task ID that must match the task portion of\n                        the random name\n        :param exact: If False, then additional information may follow\n                      the expected name. (For instance, this is useful\n                      when bulk creating instances, since Nova\n                      automatically appends a UUID to each instance\n                      created thusly.)\n        :returns: bool\n        " #NEWLINE# match = cls . _resource_name_placeholder_re . match ( cls . RESOURCE_NAME_FORMAT ) #NEWLINE# parts = match . groupdict ( ) #NEWLINE# subst = { #NEWLINE# #INDENT# 'prefix' : re . escape ( parts [ 'prefix' ] ) , #NEWLINE# 'sep' : re . escape ( parts [ 'sep' ] ) , #NEWLINE# 'suffix' : re . escape ( parts [ 'suffix' ] ) , #NEWLINE# 'chars' : re . escape ( cls . RESOURCE_NAME_ALLOWED_CHARACTERS ) , #NEWLINE# 'rand_length' : len ( parts [ 'rand' ] ) , #NEWLINE# #UNINDENT# } #NEWLINE# if task_id : #NEWLINE# #INDENT# subst [ 'task_id' ] = cls . _generate_task_id_part ( task_id , len ( parts [ 'task' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# subst [ 'task_id' ] = ( '[%s]{%s}' % ( subst [ 'chars' ] , len ( parts [ 'task' ] ) ) ) #NEWLINE# #UNINDENT# subst [ 'extra' ] = ( '' if exact else '.*' ) #NEWLINE# name_re = re . compile ( ( '%(prefix)s%(task_id)s%(sep)s[%(chars)s]{%(rand_length)s}%(suffix)s%(extra)s$' % subst ) ) #NEWLINE# return bool ( name_re . match ( name ) )