-
Notifications
You must be signed in to change notification settings - Fork 1.5k
make the default value of first_key hashable #5214
Copy link
Copy link
Closed
Description
Is your feature request related to a problem? Please describe.
the default of first_key is an empty list which is not hashable:
MONAI/monai/transforms/transform.py
Lines 415 to 424 in a3f3504
| def first_key(self, data: Dict[Hashable, Any]): | |
| """ | |
| Get the first available key of `self.keys` in the input `data` dictionary. | |
| If no available key, return an empty list `[]`. | |
| Args: | |
| data: data that the transform will be applied to. | |
| """ | |
| return first(self.key_iterator(data), []) |
this makes the regular usage: data_dict[first_key(d)] always raises a static type checking error about not hashable.
Revising the default value might resolve this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels