def __init__(self, conn, key, n_replicas=RING_REPLICAS):
        """
        Initializes a Redis hash ring node, given the Redis connection, a key
        and the number of replicas.
        """

        self.conn = conn
        self.key = key

        host = socket.gethostname()
        pid = os.getpid()
        # Create unique identifiers for the replicas
        self.replicas = [(
            random.randrange(2**32),
            '{host}:{pid}:{rand}'.format(
                host=host,
                pid=pid,
                rand=binascii.hexlify(os.urandom(4)).decode()
            )
        ) for n in range(n_replicas)]

        # List of tuples of ranges this node is responsible for, where a tuple
        # (a, b) includes any N matching a <= N < b.
        self.ranges = []

        self._select = select.select
def __init__ ( self , conn , key , n_replicas = RING_REPLICAS ) : self . conn = conn self . key = key host = socket . gethostname ( ) pid = os . getpid ( ) self . replicas = [ ( random . randrange ( 2 ** 32 ) , '{host}:{pid}:{rand}' . format ( host = host , pid = pid , rand = binascii . hexlify ( os . urandom ( 4 ) ) . decode ( ) ) ) for n in range ( n_replicas ) ] self . ranges = [ ] self . _select = select . select
Initializes a Redis hash ring node, given the Redis connection, a key
        and the number of replicas.