Here's the diff of the file git is specifically complaining about: diff --git a/flat_tree/mix_indices.py b/flat_tree/mix_indices.py index d49ec94..6742218 100644 --- a/flat_tree/mix_indices.py +++ b/flat_tree/mix_indices.py @@ -19,35 +19,30 @@ class append_indices(list): assert spliced_out_start == self.size # until testing truncation appends assert spliced_out_stop == self.size - running_size = 0 - running_leaf_count = 0 + balanced_size = 0 + balanced_leaf_count = 0 #leaf_count_of_partial_index_at_end_tmp = 0 #proposed_leaf_count = self.leaf_count - leaf_count_of_partial_index_at_end_tmp #new_node_leaf_count = self.leaf_count # + 1 - - new_leaf_count = self.leaf_count - new_size = self.size for idx, (branch_leaf_count, branch_offset, branch_size, branch_id) in enumerate( self): - if branch_leaf_count * self.degree <= new_leaf_count: #proposed_leaf_count + if branch_leaf_count * self.degree <= self.leaf_count - balanced_leaf_count: #proposed_leaf_count break #if new_node_offset + branch_size > spliced_out_start: # break - running_size += branch_size - running_leaf_count += branch_leaf_count + balanced_size += branch_size + balanced_leaf_count += branch_leaf_count #proposed_leaf_count -= branch_leaf_count #new_node_leaf_count -= branch_leaf_count #new_total_leaf_count += branch_leaf_count - new_leaf_count -= branch_leaf_count - new_size -= branch_size else: idx = len(self) - assert new_size == sum((size for leaf_count, offset, size, value in self[idx:])) + assert self.size - balanced_size == sum((size for leaf_count, offset, size, value in self[idx:])) self[idx:] = ( - #(leaf_count_of_partial_index_at_end_tmp, running_size, spliced_out_start - running_size, last_publish), - (new_leaf_count, running_size, new_size, last_publish), + #(leaf_count_of_partial_index_at_end_tmp, balanced_size, spliced_out_start - balanced_size, last_publish), + (self.leaf_count - balanced_leaf_count, balanced_size, self.size - balanced_size, last_publish), (-1, 0, spliced_in_size, spliced_in_data) )