-
Notifications
You must be signed in to change notification settings - Fork 98
[MRG] Switch to mne python verbose decorator #1449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sappelhoff
merged 19 commits into
mne-tools:main
from
bruAristimunha:switch-to-mne-python-verbose-decorator
Oct 10, 2025
Merged
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
10f78fc
Ensure verbose decorator applied consistently
bruAristimunha a7760ba
pre-commit for now
bruAristimunha 0509e68
verbose
bruAristimunha 59220c5
updating some verbosity
bruAristimunha 08d3265
updating the whats new file
bruAristimunha cf73d64
pre-commit
bruAristimunha 420cd98
updating the docstring
bruAristimunha dad2243
header
bruAristimunha e38ad42
Update mne_bids/read.py
bruAristimunha ea7213b
verbose here
bruAristimunha 771f709
Merge branch 'switch-to-mne-python-verbose-decorator' of https://gith…
bruAristimunha 6ecbeca
pre-commit
bruAristimunha 0f88b13
Update mne_bids/conftest.py
bruAristimunha 3c079db
Merge branch 'main' into switch-to-mne-python-verbose-decorator
sappelhoff cd60593
updating the authors rst
bruAristimunha 54ae106
updating the whats new
bruAristimunha 2fa9c5f
email map
bruAristimunha 602afe8
typo in my name
bruAristimunha df13845
Apply suggestions from code review
bruAristimunha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """Testing utilities for the MNE BIDS verbosity.""" | ||
|
|
||
| # Authors: The MNE-BIDS developers | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| import importlib | ||
| import inspect | ||
| import pkgutil | ||
|
|
||
| import mne_bids | ||
|
|
||
|
|
||
| def _iter_modules(): | ||
| # include top-level package module | ||
| yield importlib.import_module("mne_bids") | ||
| for module_info in pkgutil.walk_packages( | ||
| mne_bids.__path__, mne_bids.__name__ + "." | ||
| ): | ||
| yield importlib.import_module(module_info.name) | ||
|
|
||
|
|
||
| def _has_verbose_param(obj): | ||
| try: | ||
| signature = inspect.signature(obj) | ||
| except (TypeError, ValueError): | ||
| return False | ||
| return "verbose" in signature.parameters | ||
|
|
||
|
|
||
| def _is_verbose_decorated(obj): | ||
| source = getattr(obj, "__source__", "") | ||
| return "_use_log_level_" in source | ||
|
|
||
|
|
||
| def _iter_functions_and_methods(module): | ||
| for name, obj in inspect.getmembers(module, inspect.isfunction): | ||
| if obj.__module__ != module.__name__: | ||
| continue | ||
| yield f"{module.__name__}.{name}", obj | ||
| for name, cls in inspect.getmembers(module, inspect.isclass): | ||
| if cls.__module__ != module.__name__: | ||
| continue | ||
| for method_name, method in inspect.getmembers(cls, inspect.isfunction): | ||
| if method.__module__ != module.__name__: | ||
| continue | ||
| yield f"{module.__name__}.{cls.__name__}.{method_name}", method | ||
|
|
||
|
|
||
| def test_functions_with_verbose_are_decorated(): | ||
| """Test that all functions with a verbose parameter are decorated.""" | ||
| missing = [] | ||
| for module in _iter_modules(): | ||
| for qualname, obj in _iter_functions_and_methods(module): | ||
| if _has_verbose_param(obj) and not _is_verbose_decorated(obj): | ||
| missing.append(qualname) | ||
| assert not missing, f"Missing @verbose decorator: {missing}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.