#NEWLINE# def get( self , size = 1 , priority = 0 ) : #NEWLINE# #INDENT# size = max ( size , 1 ) #NEWLINE# addrs = list ( self . addrs ) #NEWLINE# shuffle ( addrs ) #NEWLINE# results = [ ] #NEWLINE# for addr in addrs : #NEWLINE# #INDENT# left = ( size - len ( results ) ) #NEWLINE# if ( left <= 0 ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# objs = pickle . loads ( client_call ( addr , ( self . prefix + 'get' ) , left , priority ) ) #NEWLINE# if ( objs is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( not isinstance ( objs , list ) ) : #NEWLINE# #INDENT# objs = [ objs ] #NEWLINE# #UNINDENT# results . extend ( objs ) #NEWLINE# #UNINDENT# if ( size == 1 ) : #NEWLINE# #INDENT# if ( len ( results ) == 0 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# return results [ 0 ] #NEWLINE# #UNINDENT# return results