Skip to content

DOC Remove defaults from parameter type descriptions#14100

Draft
viranovskaya wants to merge 3 commits into
mne-tools:mainfrom
viranovskaya:docs/remove-docstring-defaults
Draft

DOC Remove defaults from parameter type descriptions#14100
viranovskaya wants to merge 3 commits into
mne-tools:mainfrom
viranovskaya:docs/remove-docstring-defaults

Conversation

@viranovskaya

@viranovskaya viranovskaya commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Reference issue (if any)

Fixes #14095.

What does this implement/fix?

This moves default values out of parameter type descriptions and removes optional from the remaining public docstrings. Defaults remain in the parameter descriptions where needed.

I also added a docstring test so these forms are caught in future changes.

Additional information

Tests:

  • pytest mne/tests/test_docstring_parameters.py: 15 passed, 1 skipped
  • Ruff check and format check passed

AI assistance: I used OpenAI Codex to locate the affected docstrings, apply the mechanical edits, and draft the regression test. I reviewed the complete diff and ran the checks listed above.

@drammock drammock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! a few minor comments

Comment thread mne/decoding/_fixes.py Outdated
Comment on lines 35 to 36

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed this one. But: the default is in fact the string "no validation" so that should be added as a possible value

Comment thread mne/decoding/_fixes.py Outdated
`y_numeric`.

y : array-like of shape (n_samples,), default='no_validation'
y : array-like of shape (n_samples,)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default is "no validation" so that should be added as a Literal value

Comment thread mne/decoding/ssd.py Outdated
If return_filtered is True, data is bandpassed and projected onto the
SSD components.
n_fft : int (default None)
n_fft : int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
n_fft : int
n_fft : int | None

Comment thread mne/decoding/time_frequency.py Outdated
Number of cycles in the Morlet wavelet. Fixed number
or one per frequency.
time_bandwidth : float, default None
time_bandwidth : float

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
time_bandwidth : float
time_bandwidth : float | None

Comment thread mne/decoding/transformer.py Outdated
----------
%(info)s Only necessary if ``scalings`` is a dict or None.
scalings : dict, str, default None
scalings : dict, str

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scalings : dict, str
scalings : dict | str | None

Comment thread mne/forward/forward.py Outdated
The ``limit_depth_chs`` argument can take the following values:

* :data:`python:True` (default)
* : data:`python:True`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change (it's not the param description line, it's part of the Notes section)

module = inspect.getmodule(func)
if module is not None and module.__name__.startswith("mne."):
for param in FunctionDoc(func)["Parameters"]:
if bad_docstring_type.search(param.type):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this yielded one false positive at least (see comment above about Notes section); you may need to parse/decompose the docstring to only look at the first (logical) line of each param description.

Comment thread mne/time_frequency/tfr.py Outdated
Number of cycles. Can be a fixed number (float) or one per frequency
(array-like).
sigma : float, default None
sigma : float

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sigma : float
sigma : float | None

Comment thread mne/time_frequency/tfr.py Outdated
None means True for method='multitaper' and False for method='morlet'.
If True, make sure the wavelets have a mean of zero.
time_bandwidth : float, default None
time_bandwidth : float

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
time_bandwidth : float
time_bandwidth : float | None

@viranovskaya

Copy link
Copy Markdown
Contributor Author

Thanks, I’ve addressed all of these. I added the missing literal and None values, restored the line in the Notes section, and corrected the affected parameter types.

The checker already iterates over FunctionDoc(func)["Parameters"] and searches only param.type; the Notes edit came from the initial mechanical cleanup, not from the checker. I added a regression test with (default) in Notes to make that boundary explicit.

Local checks: 15 passed, 1 skipped; Ruff check and format check passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove ", default X" from docstrings

2 participants