Commit 183fdd53 authored by Daniel Boeckenhoff's avatar Daniel Boeckenhoff
Browse files

keys() to list(dict)

parent 4b7ecefe
......@@ -173,7 +173,7 @@ class Node(object):
return self
if len(self.cut_expr) > 1:
raise ValueError("cut_expr is too long")
key = self.cut_expr.keys()[0]
key = list(self.cut_expr)[0]
value = locals()[key]
if value <= self.cut_expr[key]:
return self.left.find_leaf(point, _in_recursion=True)
......
......@@ -329,7 +329,7 @@ class AbstractNdarray(np.ndarray):
'''
De-Flatten the first layer of lists
'''
for key in sorted(d.keys()):
for key in sorted(list(d)):
if '::' in key:
splits = key.split('::')
attr, _, end = key.partition('::')
......@@ -349,10 +349,10 @@ class AbstractNdarray(np.ndarray):
'''
Build the lists (recursively)
'''
for key in list_dict.keys():
for key in list(list_dict):
sub_dict = list_dict[key]
list_dict[key] = []
for index in sorted(sub_dict.keys()):
for index in sorted(list(sub_dict)):
bulk_type = sub_dict[index].get('bulk_type').tolist()
if isinstance(bulk_type, bytes):
# asthonishingly, this is not necessary under linux. Found under nt. ???
......@@ -690,7 +690,7 @@ class Tensors(AbstractNdarray):
>>> assert np.array_equal(lins3[:, 1], [4, 9])
"""
cls_kwargs = {attr: kwargs.pop(attr) for attr in list(kwargs.keys()) if attr in cls.__slots__}
cls_kwargs = {attr: kwargs.pop(attr) for attr in list(kwargs) if attr in cls.__slots__}
inst = cls.__new__(cls,
tfields.lib.grid.igrid(*base_vectors, **kwargs),
**cls_kwargs)
......@@ -1563,7 +1563,7 @@ class TensorMaps(TensorFields):
item.maps = [mp.copy() for mp in item.maps]
indices = np.array(range(len(self)))
keep_indices = indices[index]
if isinstance(keep_indices, (int, np.int64)):
if isinstance(keep_indices, (int, np.int64, np.int32)):
keep_indices = [keep_indices]
delete_indices = set(indices).difference(set(keep_indices))
......
Supports Markdown
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