Skip to content

Commit a5b0032

Browse files
Merge branch 'pre-commit-and-warning' of https://github.com/neurotechx/moabb into pre-commit-and-warning
2 parents 31f015f + 7ed594b commit a5b0032

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

moabb/evaluations/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class BaseEvaluation(ABC):
7070
Cut off time for the optuna search expressed in seconds, the default value is 15 minutes.
7171
Only used with optuna equal to True.
7272
verbose: bool, str, int, default=None
73-
If not None, override default verbose level (see :func:`mne.verbose`
74-
and :func:`mne.set_log_level` for more info).
73+
If not None, override the default MOABB logging level used by this evaluation
74+
(see :func:`moabb.utils.verbose` for more information on how this is handled).
7575
If used, it should be passed as a keyword-argument only.
7676
7777
Notes

moabb/utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,12 @@ def wrapper(*args, **kwargs):
109109
bound.apply_defaults()
110110
if "verbose" in bound.arguments:
111111
verbose_val = bound.arguments["verbose"]
112-
except Exception:
113-
pass
112+
except TypeError as exc:
113+
log.debug(
114+
"Failed to bind 'verbose' argument for %s: %s",
115+
function.__name__,
116+
exc,
117+
)
114118

115119
# Check self.verbose
116120
if verbose_val is None and len(args) > 0:
@@ -131,8 +135,8 @@ def wrapper(*args, **kwargs):
131135
if level is not None:
132136
try:
133137
logger.setLevel(level)
134-
except Exception:
135-
pass
138+
except (TypeError, ValueError) as exc:
139+
logger.warning("Failed to set log level %r: %s", level, exc)
136140

137141
try:
138142
return function(*args, **kwargs)

0 commit comments

Comments
 (0)