mne-tools / mne-tools/mne-python
Type hints for `mne.preprocessing.ICA()` are narrower than their runtime behavior and documented usage.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Description of the problem
The runtime behavior and documentation allow a wider range of inputs than the current type annotations.
This causes false positives in static type checkers. Updating the type hints would align them with existing runtime behavior and documentation only, without modifying any runtime logic.
Steps to reproduce
from mne.preprocessing import ICA
ica = ICA(n_components=3, max_iter=1000)
Link to data
No response
Expected results
No type checker error, since the documentation specifies that max_iter accepts int | 'auto'.
Actual results
Static type checker reports:
Argument of type Literal[1000] cannot be assigned to parameter max_iter of type str
Additional information
This issue affects type checking only. Runtime behavior is correct.
I’d be happy to work on a fix for this if it’s confirmed as a bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the mne.preprocessing.ICA() signature and its type annotation for max_iter, then compare it with the documented accepted values and the runtime behavior described here. Update only the annotation so the provided ICA(n_components=3, max_iter=1000) example passes static type checking without changing runtime logic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100