Skip to content

Commit

Permalink
Merge pull request #268 from piotr1212/Python3_resize
Browse files Browse the repository at this point in the history
whisper-resize.py: Python3 fixes
  • Loading branch information
deniszh authored Dec 21, 2018
2 parents c2ef993 + e92c6d4 commit f71df67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/whisper-resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
for archive in old_archives:
# Loading all datapoints into memory for fast querying
timeinfo, values = archive['data']
new_datapoints = zip(range(*timeinfo), values)
new_datapoints = list(zip(range(*timeinfo), values))
if all_datapoints:
last_timestamp = all_datapoints[-1][0]
slice_end = 0
Expand All @@ -122,8 +122,8 @@
else:
all_datapoints += new_datapoints

oldtimestamps = map(lambda p: p[0], all_datapoints)
oldvalues = map(lambda p: p[1], all_datapoints)
oldtimestamps = list(map(lambda p: p[0], all_datapoints))
oldvalues = list(map(lambda p: p[1], all_datapoints))

print("oldtimestamps: %s" % oldtimestamps)
# Simply cleaning up some used memory
Expand All @@ -148,7 +148,7 @@
righti = bisect.bisect_left(oldtimestamps, tinterval[1], lo=lefti)
newvalues = oldvalues[lefti:righti]
if newvalues:
non_none = filter(lambda x: x is not None, newvalues)
non_none = list(filter(lambda x: x is not None, newvalues))
if non_none and 1.0 * len(non_none) / len(newvalues) >= xff:
newdatapoints.append([tinterval[0],
whisper.aggregate(aggregationMethod,
Expand Down

0 comments on commit f71df67

Please sign in to comment.