def _generate_circle(self):
total_weight = <NUM_LIT:0><EOL>for node in self.nodes:<EOL><INDENT>total_weight += self.weights.get(node, <NUM_LIT:1>)<EOL><DEDENT>for node in self.nodes:<EOL><INDENT>weight = <NUM_LIT:1><EOL>if node in self.weights:<EOL><INDENT>weight = self.weights.get(node)<EOL><DEDENT>factor = math.floor((<NUM_LIT> * len(self.nodes) * weight) / total_weight)<EOL>for j in range(<NUM_LIT:0>, int(factor)):<EOL><INDENT>b_key = bytearray(self._hash_digest('<STR_LIT>' % (node, j)))<EOL>for i in range(<NUM_LIT:0>, <NUM_LIT:3>):<EOL><INDENT>key = self._hash_val(b_key, lambda x: x + i * <NUM_LIT:4>)<EOL>self.ring[key] = node<EOL>self._sorted_keys.append(key)<EOL><DEDENT><DEDENT><DEDENT>self._sorted_keys.sort()<EOL>
Generates the circle.