Skip to content

Commit

Permalink
Add comment, thanks @ericpre
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-dlp committed Jul 9, 2024
1 parent f87c6a5 commit 07a2db4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hyperspy/misc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,7 @@ def __getitem__(self, *args, **kwargs):
try:
return type(self)(item)
except TypeError:
# When indexing, the returned object is not a tuple
return item

def set(self, **kwargs):
Expand Down Expand Up @@ -1690,12 +1691,12 @@ def get(self, *args):
output = dict()
for key in args:
values = list()
for axis in self:
if not hasattr(axis, key):
for item in self:
if not hasattr(item, key):
raise AttributeError(
f"'The item {axis} has not attribute '{key}'")
f"'The item {item} has not attribute '{key}'")
else:
values.append(getattr(axis, key))
values.append(getattr(item, key))
output[key] = tuple(values)
return output

Expand Down

0 comments on commit 07a2db4

Please sign in to comment.