Skip to content

Commit 0f3d916

Browse files
author
shubhangiKishore
committed
Fixing test_db errors
1 parent 8e7e0f8 commit 0f3d916

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pattern/db/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from time import mktime, strftime
2626
from math import sqrt
2727
from types import GeneratorType
28+
from functools import cmp_to_key
2829

2930
try: # Python 2.x vs 3.x
3031
from cStringIO import StringIO
@@ -528,7 +529,7 @@ def order(list, cmp=None, key=None, reverse=False):
528529
f = lambda i, j: int(key(list[i]) >= key(list[j])) * 2 - 1
529530
else:
530531
f = lambda i, j: int(list[i] >= list[j]) * 2 - 1
531-
return sorted(range(len(list)), cmp=f, reverse=reverse)
532+
return sorted(range(len(list)), key=cmp_to_key(f), reverse=reverse)
532533

533534
_order = order
534535

@@ -2539,7 +2540,8 @@ def copy(self, rows=ALL, columns=ALL):
25392540
if columns == ALL:
25402541
return Datasheet(rows=(self.rows[i] for i in rows))
25412542
z = zip(*(self.columns[j] for j in columns))
2542-
return Datasheet(rows=(z[i] for i in rows))
2543+
z_list = list(z)
2544+
return Datasheet(rows=(z_list[i] for i in rows))
25432545

25442546
@property
25452547
def array(self):

0 commit comments

Comments
 (0)