~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_chk_map_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-20 22:13:23 UTC
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091020221323-vvukgazqxkicb70n
A bit broken, but getting there.

Start being much stricter about requiring StaticTuples everywhere.
I may go back and loosen this restriction, but getting the code base
StaticTuple pure is probably a good idea. The main reason to be 'looser'
is so that things don't fail 'in the wild' just because someone
calls an api with a tuple rather than a StaticTuple.
However, I'd like the internals to be 'pure' if possible.
We'll see.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import zlib
20
20
import struct
21
21
 
 
22
from bzrlib.static_tuple import StaticTuple
 
23
 
22
24
_LeafNode = None
23
25
_InternalNode = None
24
26
_unknown = None
93
95
        value_lines = lines[pos:pos+num_value_lines]
94
96
        pos += num_value_lines
95
97
        value = '\n'.join(value_lines)
96
 
        items[tuple(elements[:-1])] = value
 
98
        items[StaticTuple(*elements[:-1])] = value
97
99
    if len(items) != length:
98
100
        raise AssertionError("item count (%d) mismatch for key %s,"
99
101
            " bytes %r" % (length, key, bytes))
141
143
    for line in lines[5:]:
142
144
        line = common_prefix + line
143
145
        prefix, flat_key = line.rsplit('\x00', 1)
144
 
        items[prefix] = (flat_key,)
 
146
        items[prefix] = StaticTuple(flat_key,)
145
147
    if len(items) == 0:
146
148
        raise AssertionError("We didn't find any item for %s" % key)
147
149
    result._items = items
155
157
    result._node_width = len(prefix)
156
158
    result._search_prefix = common_prefix
157
159
    return result
158
 
 
159
 
 
160
 
_key_type = tuple