#NEWLINE# def property( self , name ) : #NEWLINE# #INDENT# result = Gaffer . Path . property ( self , name ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# return result #NEWLINE# #UNINDENT# def average( values ) : #NEWLINE# #INDENT# return ( sum ( values ) / len ( values ) ) #NEWLINE# #UNINDENT# def mostCommon( values ) : #NEWLINE# #INDENT# return collections . Counter ( values ) . most_common ( 1 ) [ 0 ] [ 0 ] #NEWLINE# #UNINDENT# combiners = { #NEWLINE# #INDENT# 'fileSystem:owner' : mostCommon , #NEWLINE# 'fileSystem:group' : mostCommon , #NEWLINE# 'fileSystem:modificationTime' : max , #NEWLINE# 'fileSystem:accessTime' : max , #NEWLINE# 'fileSystem:size' : sum , #NEWLINE# #UNINDENT# } #NEWLINE# values = [ path . property ( name ) for path in self . __basePaths ( ) ] #NEWLINE# combiner = combiners . get ( name , None ) #NEWLINE# if ( mostCommon is None ) : #NEWLINE# #INDENT# if isinstance ( values [ 0 ] , ( int , float ) ) : #NEWLINE# #INDENT# combiner = average #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( values [ 0 ] , basestring ) : #NEWLINE# #INDENT# combiner = mostCommon #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( combiner is not None ) : #NEWLINE# #INDENT# return combiner ( values ) #NEWLINE# #UNINDENT# return None