~cjwatson/meliae/py3-obj-summary

« back to all changes in this revision

Viewing changes to meliae/loader.py

  • Committer: Colin Watson
  • Date: 2021-05-13 23:40:26 UTC
  • Revision ID: cjwatson@canonical.com-20210513234026-kxpbsb1lm8mawhpt
Fix some _ObjSummary methods for Python 3.

by_size and by_count tried to use the "itervalues" method on an ordinary
dict, which doesn't exist on Python 3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
        return '\n'.join(out)
196
196
 
197
197
    def by_size(self):
198
 
        summaries = sorted(self.type_summaries.itervalues(),
 
198
        summaries = sorted(six.itervalues(self.type_summaries),
199
199
                           key=lambda x: (x.total_size, x.count),
200
200
                           reverse=True)
201
201
        self.summaries = summaries
202
202
 
203
203
    def by_count(self):
204
 
        summaries = sorted(self.type_summaries.itervalues(),
 
204
        summaries = sorted(six.itervalues(self.type_summaries),
205
205
                           key=lambda x: (x.count, x.total_size),
206
206
                           reverse=True)
207
207
        self.summaries = summaries