#NEWLINE# def get_hosts( self , data , ignore_hosts = None ) : #NEWLINE# #INDENT# 'Get the list of hosts which the supplied data maps onto.\n\n        :param data: A string identifier to be mapped across the ring.\n        :param ignore_hosts: A list of hosts to skip when performing the hash.\n                             Useful to temporarily skip down hosts without\n                             performing a full rebalance.\n                             Default: None.\n        :returns: a list of hosts.\n                  The length of this list depends on the number of replicas\n                  this `HashRing` was created with. It may be less than this\n                  if ignore_hosts is not None.\n        ' #NEWLINE# hosts = [ ] #NEWLINE# if ( ignore_hosts is None ) : #NEWLINE# #INDENT# ignore_hosts = set ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ignore_hosts = set ( ignore_hosts ) #NEWLINE# ignore_hosts . intersection_update ( self . hosts ) #NEWLINE# #UNINDENT# partition = self . _get_partition ( data ) #NEWLINE# for replica in range ( 0 , self . replicas ) : #NEWLINE# #INDENT# if ( ( len ( hosts ) + len ( ignore_hosts ) ) == len ( self . hosts ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# host = self . _get_host ( partition ) #NEWLINE# while ( ( host in hosts ) or ( host in ignore_hosts ) ) : #NEWLINE# #INDENT# partition += 1 #NEWLINE# if ( partition >= len ( self . _partitions ) ) : #NEWLINE# #INDENT# partition = 0 #NEWLINE# #UNINDENT# host = self . _get_host ( partition ) #NEWLINE# #UNINDENT# hosts . append ( host ) #NEWLINE# #UNINDENT# return hosts