(core) Simple Python 3 compatibility changes

Summary: Changes that move towards python 3 compatibility that are easy to review without much thought

Test Plan: The tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2873
This commit is contained in:
Alex Hall
2021-06-22 17:12:25 +02:00
parent cc04c6481a
commit 16f297a250
66 changed files with 551 additions and 437 deletions

View File

@@ -44,6 +44,7 @@ import itertools
import math
import struct
from six.moves import zip, xrange
from sortedcontainers import SortedList, SortedListWithKey
@@ -79,7 +80,7 @@ def prepare_inserts_dumb(sortedlist, keys):
ins_groups.append((len(sortedlist), 0))
for index, ins_count in ins_groups:
adj_count = index - prev_index
adjustments.extend(itertools.izip(xrange(prev_index, index),
adjustments.extend(zip(xrange(prev_index, index),
frange_from(next_key, adj_count)))
next_key += adj_count
insertions.extend(frange_from(next_key, ins_count))
@@ -233,7 +234,7 @@ class ListWithAdjustments(object):
prev_keys.sort()
new_keys = get_range(new_begin_key, new_end_key, count)
for (old_key, is_insert, i), new_key in itertools.izip(prev_keys, new_keys):
for (old_key, is_insert, i), new_key in zip(prev_keys, new_keys):
if is_insert:
self._insertions.remove(old_key)
self._insertions.add(new_key)
@@ -303,7 +304,7 @@ def all_distinct(iterable):
"""
a, b = itertools.tee(iterable)
next(b, None)
return all(x != y for x, y in itertools.izip(a, b))
return all(x != y for x, y in zip(a, b))
def range_around_float(x, i):