/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Jelmer Vernooij
  • Date: 2017-02-05 22:51:57 UTC
  • mto: (6621.2.1 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: jelmer@jelmer.uk-20170205225157-jdk9ppega9c3my86
Run 2to3 idioms fixer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
397
397
                                    self.reference_lists)
398
398
            self._add_key(string_key, line, rows, allow_optimize=allow_optimize)
399
399
        for row in reversed(rows):
400
 
            pad = (type(row) != _LeafBuilderRow)
 
400
            pad = (not isinstance(row, _LeafBuilderRow))
401
401
            row.finish_node(pad=pad)
402
402
        lines = [_BTSIGNATURE]
403
403
        lines.append(_OPTION_NODE_REFS + str(self.reference_lists) + '\n')
430
430
            position = 0 # Only the root row actually has an offset
431
431
            copied_len = osutils.pumpfile(row.spool, result)
432
432
            if copied_len != (row.nodes - 1) * _PAGE_SIZE:
433
 
                if type(row) != _LeafBuilderRow:
 
433
                if not isinstance(row, _LeafBuilderRow):
434
434
                    raise AssertionError("Incorrect amount of data copied"
435
435
                        " expected: %d, got: %d"
436
436
                        % ((row.nodes - 1) * _PAGE_SIZE,
575
575
                    key_dict = dicts.pop(-1)
576
576
                    # can't be empty or would not exist
577
577
                    item, value = key_dict.iteritems().next()
578
 
                    if type(value) == dict:
 
578
                    if isinstance(value, dict):
579
579
                        # push keys
580
580
                        dicts.extend(key_dict.itervalues())
581
581
                    else:
635
635
 
636
636
    def all_items(self):
637
637
        """Return a sorted list of (key, (value, refs)) items"""
638
 
        items = self.items()
639
 
        items.sort()
 
638
        items = sorted(self.items())
640
639
        return items
641
640
 
642
641
    def all_keys(self):
643
642
        """Return a sorted list of all keys."""
644
 
        keys = self.keys()
645
 
        keys.sort()
 
643
        keys = sorted(self.keys())
646
644
        return keys
647
645
 
648
646
 
717
715
    def __eq__(self, other):
718
716
        """Equal when self and other were created with the same parameters."""
719
717
        return (
720
 
            type(self) == type(other) and
 
718
            isinstance(self, type(other)) and
721
719
            self._transport == other._transport and
722
720
            self._name == other._name and
723
721
            self._size == other._size)
1429
1427
                    key_dict = dicts.pop(-1)
1430
1428
                    # can't be empty or would not exist
1431
1429
                    item, value = key_dict.iteritems().next()
1432
 
                    if type(value) == dict:
 
1430
                    if isinstance(value, dict):
1433
1431
                        # push keys
1434
1432
                        dicts.extend(key_dict.itervalues())
1435
1433
                    else: