test my py

Python code posted
created at 23 Apr 06:31, updated at 23 Apr 06:33

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
import hashlib

class HashRing(object):

    def __init__(self, nodes=None, weights=None):
        self.ring = dict()
        self._sorted_keys = []
        self.nodes = nodes
        if not weights:
            weights = {}
        self.weights = weights
        self._generate_circle()
300 Bytes in 2 ms with coderay