#NEWLINE# def MatchBestComponentName( self , component ) : #NEWLINE# #INDENT# 'Returns the name of the component which matches best our base listing.\n\n    In order to do the best case insensitive matching we list the files in the\n    base handler and return the base match for this component.\n\n    Args:\n      component: A component name which should be present in this directory.\n\n    Returns:\n      the best component name.\n    ' #NEWLINE# fd = self . OpenAsContainer ( ) #NEWLINE# file_listing = set ( fd . ListNames ( ) ) #NEWLINE# if ( component not in file_listing ) : #NEWLINE# #INDENT# lower_component = component . lower ( ) #NEWLINE# for x in file_listing : #NEWLINE# #INDENT# if ( lower_component == x . lower ( ) ) : #NEWLINE# #INDENT# component = x #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( fd . supported_pathtype != self . pathspec . pathtype ) : #NEWLINE# #INDENT# new_pathspec = rdf_paths . PathSpec ( path = component , pathtype = lower_component . supported_pathtype ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_pathspec = self . pathspec . last . Copy ( ) #NEWLINE# new_pathspec . path = component #NEWLINE# #UNINDENT# return new_pathspec