Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Larson <[email protected]>
  • Loading branch information
withmywoessner and larsoner authored Jan 10, 2024
1 parent 65778d1 commit 3ece314
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ def drop(self, indices, reason="USER", verbose=None):
mask to apply (where True values get removed). Events are
correspondingly modified.
reason : list | tuple | str
Reason for dropping the epochs ('ECG', 'timeout', 'blink' etc).
Reason(s) for dropping the epochs ('ECG', 'timeout', 'blink' etc).
Default: 'USER'.
%(verbose)s
Expand Down Expand Up @@ -3714,7 +3714,7 @@ def _is_good(
# Check if criterion is a function and apply it
if callable(criterion):
result = criterion(e_idx)
_validate_type(result, tuple, result, "tuple")
_validate_type(result, tuple, "reject/flat output")
if len(result) != 2:
raise TypeError(
"Function criterion must return a tuple of length 2"
Expand All @@ -3738,12 +3738,11 @@ def _is_good(
# (bool, reason). Reason must be a str/list/tuple.
# If using tuple
if callable(refl):
if isinstance(reasons, (tuple, list)):
for idx, reason in enumerate(reasons):
_validate_type(reason, str, reason, "str")
bad_tuple += tuple(reasons)
if isinstance(reasons, str):
bad_tuple += (reasons,)
reasons = (reasons,)
for idx, reason in enumerate(reasons):
_validate_type(reason, str, f"reasons[{idx}]")
bad_tuple += tuple(reasons)
else:
bad_names = [ch_names[idx[i]] for i in idx_deltas]
if not has_printed:
Expand Down

0 comments on commit 3ece314

Please sign in to comment.