예제 #1
0
파일: logic.py 프로젝트: cy-fir/RecuperaBit
    def __repr__(self):
        elems = []
        prevk = 0
        if len(self.elements) > 0:
            k = self.keys[0]
            elems.append(str(k) + ' -> ' + tiny_repr(self.elements[k]))
            prevk = self.keys[0]
        for i in xrange(1, len(self.elements)):
            nextk = self.keys[i]
            if nextk <= prevk + 2:
                while prevk < nextk - 1:
                    elems.append('__')
                    prevk += 1
                elems.append(tiny_repr(self.elements[nextk]))
            else:
                elems.append('\n... ' + str(nextk) + ' -> ' +
                             tiny_repr(self.elements[nextk]))
            prevk = nextk

        return '[' + ', '.join(elems) + ']'
예제 #2
0
파일: logic.py 프로젝트: la-ci/RecuperaBit
    def __repr__(self):
        elems = []
        prevk = 0
        if len(self.elements) > 0:
            k = self.keys[0]
            elems.append(str(k) + ' -> ' + tiny_repr(self.elements[k]))
            prevk = self.keys[0]
        for i in xrange(1, len(self.elements)):
            nextk = self.keys[i]
            if nextk <= prevk + 2:
                while prevk < nextk - 1:
                    elems.append('__')
                    prevk += 1
                elems.append(tiny_repr(self.elements[nextk]))
            else:
                elems.append('\n... ' + str(nextk) + ' -> ' +
                             tiny_repr(self.elements[nextk]))
            prevk = nextk

        return '[' + ', '.join(elems) + ']'