Commit 60b62fc0 authored by dieter's avatar dieter

fix more PY3 incompatibilities in `fsstats`

parent 7d061726
...@@ -31,8 +31,7 @@ class Histogram(dict): ...@@ -31,8 +31,7 @@ class Histogram(dict):
def median(self): def median(self):
# close enough? # close enough?
n = self.size() / 2 n = self.size() / 2
L = self.keys() L = sorted(self.keys())
L.sort()
L.reverse() L.reverse()
while 1: while 1:
k = L.pop() k = L.pop()
...@@ -55,9 +54,9 @@ class Histogram(dict): ...@@ -55,9 +54,9 @@ class Histogram(dict):
except ValueError: except ValueError:
maxkey = 0 maxkey = 0
self.binsize = binsize self.binsize = binsize
self.bins = [0] * (1 + maxkey / binsize) self.bins = [0] * (1 + maxkey // binsize)
for k, v in six.iteritems(self): for k, v in six.iteritems(self):
b = k / binsize b = k // binsize
self.bins[b] += v self.bins[b] += v
def report(self, name, binsize=50, usebins=False, gaps=True, skip=True): def report(self, name, binsize=50, usebins=False, gaps=True, skip=True):
...@@ -91,7 +90,7 @@ class Histogram(dict): ...@@ -91,7 +90,7 @@ class Histogram(dict):
cum += n cum += n
pc = 100 * cum / tot pc = 100 * cum / tot
print("%6d %6d %3d%% %3d%% %s" % ( print("%6d %6d %3d%% %3d%% %s" % (
i * binsize, n, p, pc, "*" * (n / dot))) i * binsize, n, p, pc, "*" * (n // dot)))
print() print()
def class_detail(class_size): def class_detail(class_size):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment