Skip to content

Commit 5a07ac1

Browse files
committed
fixed bug: reset changes in call to Adapter.set_data()
1 parent a090443 commit 5a07ac1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

larray_editor/arrayadapter.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def set_data(self, data, bg_gradient=None, bg_value=None, current_filter=None):
9191
data = la.LArray([])
9292
if current_filter is None:
9393
self.current_filter = {}
94+
self.changes = {}
9495
self.la_data = la.aslarray(data)
9596
self.update_filtered_data(current_filter)
9697
self.data_model.set_background(bg_gradient, bg_value)
@@ -175,7 +176,11 @@ def _map_global_to_filtered(self, k):
175176
tuple
176177
Positional index (row, column) of the modified data cell.
177178
"""
178-
assert isinstance(k, tuple) and len(k) == self.la_data.ndim
179+
if not isinstance(k, tuple):
180+
raise ValueError("Expected tuple argument. Passed argument is of type {}".format(type(k).__name__))
181+
if len(k) != self.la_data.ndim:
182+
raise ValueError("Length of passed tuple k ({}) must be equal to the number of dimensions "
183+
"of current array ({}).\nPassed argument is: {}".format(len(k), self.la_data.ndim, k))
179184
dkey = {axis_id: axis_key for axis_key, axis_id in zip(k, self.la_data.axes.ids)}
180185
# transform global dictionary key to "local" (filtered) key by removing
181186
# the parts of the key which are redundant with the filter

0 commit comments

Comments
 (0)