Show More
@@ -216,6 +216,12 b' def _to_int(hex_digit):' | |||
|
216 | 216 | return int(hex_digit, 16) |
|
217 | 217 | |
|
218 | 218 | |
|
219 | class Block(dict): | |
|
220 | """represent a block of the Trie | |
|
221 | ||
|
222 | contains up to 16 entry indexed from 0 to 15""" | |
|
223 | ||
|
224 | ||
|
219 | 225 | def _build_trie(index): |
|
220 | 226 | """build a nodemap trie |
|
221 | 227 | |
@@ -224,7 +230,7 b' def _build_trie(index):' | |||
|
224 | 230 | Each block is a dictionary with keys in `[0, 15]`. Values are either |
|
225 | 231 | another block or a revision number. |
|
226 | 232 | """ |
|
227 |
root = |
|
|
233 | root = Block() | |
|
228 | 234 | for rev in range(len(index)): |
|
229 | 235 | hex = nodemod.hex(index[rev][7]) |
|
230 | 236 | _insert_into_block(index, 0, root, rev, hex) |
@@ -253,7 +259,7 b' def _insert_into_block(index, level, blo' | |||
|
253 | 259 | # vertices to fit both entry. |
|
254 | 260 | other_hex = nodemod.hex(index[entry][7]) |
|
255 | 261 | other_rev = entry |
|
256 |
new = |
|
|
262 | new = Block() | |
|
257 | 263 | block[hex_digit] = new |
|
258 | 264 | _insert_into_block(index, level + 1, new, other_rev, other_hex) |
|
259 | 265 | _insert_into_block(index, level + 1, new, current_rev, current_hex) |
General Comments 0
You need to be logged in to leave comments.
Login now