diff --git a/.github/workflows/stubs.yaml b/.github/workflows/stubs.yaml index f19268f7c..eb131785e 100644 --- a/.github/workflows/stubs.yaml +++ b/.github/workflows/stubs.yaml @@ -3,6 +3,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} cancel-in-progress: true on: # yamllint disable-line rule:truthy + pull_request: schedule: - cron: '0 3 * * *' workflow_dispatch: @@ -35,6 +36,7 @@ jobs: - name: Generate stub files run: python tools/stubgen.py - name: Push stub files + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' diff --git a/mne_icalabel/annotation/bids.pyi b/mne_icalabel/annotation/bids.pyi index 884d78eb2..7910dacc7 100644 --- a/mne_icalabel/annotation/bids.pyi +++ b/mne_icalabel/annotation/bids.pyi @@ -33,7 +33,14 @@ def write_components_tsv(ica: ICA, fname: Union[str, Path]): as the community converges on the specification of BIDS-Derivatives. """ -def mark_component(component: int, fname: Union[str, Path], method: str, label: str, author: str, strict_label: bool=True): +def mark_component( + component: int, + fname: Union[str, Path], + method: str, + label: str, + author: str, + strict_label: bool = True, +): """Mark a component with a label. Parameters @@ -59,4 +66,4 @@ def mark_component(component: int, fname: Union[str, Path], method: str, label: Storage of ICA annotations as a ``.tsv`` file is currently experimental in the context of BIDS-EEG Derivatives. The API and functionality is subject to change as the community converges on the specification of BIDS-Derivatives. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/config.pyi b/mne_icalabel/config.pyi index e725baf7f..7dd18c7cb 100644 --- a/mne_icalabel/config.pyi +++ b/mne_icalabel/config.pyi @@ -3,4 +3,4 @@ from typing import Callable, Optional from .iclabel import iclabel_label_components as iclabel_label_components ICALABEL_METHODS: dict[str, Optional[Callable]] -ICA_LABELS_TO_MNE: dict[str, str] \ No newline at end of file +ICA_LABELS_TO_MNE: dict[str, str] diff --git a/mne_icalabel/datasets/__init__.pyi b/mne_icalabel/datasets/__init__.pyi index 4578cad16..803d8460d 100644 --- a/mne_icalabel/datasets/__init__.pyi +++ b/mne_icalabel/datasets/__init__.pyi @@ -1 +1 @@ -from . import icalabel as icalabel \ No newline at end of file +from . import icalabel as icalabel diff --git a/mne_icalabel/datasets/icalabel/icalabel.pyi b/mne_icalabel/datasets/icalabel/icalabel.pyi index f8068a03f..2763403c5 100644 --- a/mne_icalabel/datasets/icalabel/icalabel.pyi +++ b/mne_icalabel/datasets/icalabel/icalabel.pyi @@ -5,7 +5,13 @@ from _typeshed import Incomplete has_icalabel_testing_data: Incomplete -def data_path(path: Optional[str]=None, force_update: bool=False, update_path: bool=True, download: bool=True, verbose: Incomplete | None=None) -> Path: +def data_path( + path: Optional[str] = None, + force_update: bool = False, + update_path: bool = True, + download: bool = True, + verbose: Incomplete | None = None, +) -> Path: """ICA label testing data generated in conjunction with EEGLab. Parameters @@ -26,7 +32,7 @@ def data_path(path: Optional[str]=None, force_update: bool=False, update_path: b it will not be downloaded and the path will be returned as ‘’ (empty string). This is mostly used for debugging purposes and can be safely ignored by most users. - + verbose : bool | str | int | None Control verbosity of the logging output. If ``None``, use the default verbosity level. See the :ref:`logging documentation ` and @@ -37,4 +43,4 @@ def data_path(path: Optional[str]=None, force_update: bool=False, update_path: b ------- path : Path Path to dataset directory. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/features/__init__.pyi b/mne_icalabel/features/__init__.pyi index 332f1cadb..b06f19e68 100644 --- a/mne_icalabel/features/__init__.pyi +++ b/mne_icalabel/features/__init__.pyi @@ -1 +1 @@ -from .topomap import get_topomaps as get_topomaps \ No newline at end of file +from .topomap import get_topomaps as get_topomaps diff --git a/mne_icalabel/features/topomap.pyi b/mne_icalabel/features/topomap.pyi index 7c2d6e6c1..d373beaf7 100644 --- a/mne_icalabel/features/topomap.pyi +++ b/mne_icalabel/features/topomap.pyi @@ -8,7 +8,14 @@ from numpy.typing import NDArray from ..utils._checks import _validate_ica as _validate_ica from ..utils._docs import fill_doc as fill_doc -def get_topomaps(ica: ICA, picks: Incomplete | None=None, res: int=64, image_interp: str=..., border: Union[float, str]=..., extrapolate: str=...) -> dict[str, NDArray[float]]: +def get_topomaps( + ica: ICA, + picks: Incomplete | None = None, + res: int = 64, + image_interp: str = ..., + border: Union[float, str] = ..., + extrapolate: str = ..., +) -> dict[str, NDArray[float]]: """Generate an array of scalp topographies for the picked components. Parameters @@ -31,7 +38,7 @@ def get_topomaps(ica: ICA, picks: Incomplete | None=None, res: int=64, image_int then each extrapolated point has the average value of its neighbours. extrapolate : str Options: - + - ``'box'`` Extrapolate to four points placed to form a square encompassing all data points, where each side of the square is three times the range @@ -52,7 +59,14 @@ def get_topomaps(ica: ICA, picks: Incomplete | None=None, res: int=64, image_int Dictionary of ICs topographic maps for each channel type. """ -def _get_topomap_array(data: NDArray[float], info: Info, res: int=64, image_interp: str=..., border: Union[float, str]=..., extrapolate: str=...) -> NDArray[float]: +def _get_topomap_array( + data: NDArray[float], + info: Info, + res: int = 64, + image_interp: str = ..., + border: Union[float, str] = ..., + extrapolate: str = ..., +) -> NDArray[float]: """Generate a scalp topographic map (n_pixels, n_pixels). Parameters @@ -72,7 +86,7 @@ def _get_topomap_array(data: NDArray[float], info: Info, res: int=64, image_inte then each extrapolated point has the average value of its neighbours. extrapolate : str Options: - + - ``'box'`` Extrapolate to four points placed to form a square encompassing all data points, where each side of the square is three times the range @@ -91,4 +105,4 @@ def _get_topomap_array(data: NDArray[float], info: Info, res: int=64, image_inte ------- topomap : array of shape (n_pixels, n_pixels) Topographic map array. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/gui/__init__.pyi b/mne_icalabel/gui/__init__.pyi index 1d8d2df6e..c5865b9dc 100644 --- a/mne_icalabel/gui/__init__.pyi +++ b/mne_icalabel/gui/__init__.pyi @@ -1,6 +1,6 @@ from mne.preprocessing import ICA -def label_ica_components(inst, ica: ICA, show: bool=True, block: bool=False): +def label_ica_components(inst, ica: ICA, show: bool = True, block: bool = False): """Launch the IC labelling GUI. Parameters @@ -19,4 +19,4 @@ def label_ica_components(inst, ica: ICA, show: bool=True, block: bool=False): ------- gui : instance of ICAComponentLabeler The graphical user interface (GUI) window. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/gui/_label_components.pyi b/mne_icalabel/gui/_label_components.pyi index 12e9e3919..1a906d7a8 100644 --- a/mne_icalabel/gui/_label_components.pyi +++ b/mne_icalabel/gui/_label_components.pyi @@ -17,15 +17,16 @@ class ICAComponentLabeler(QMainWindow): ica : ICA show : bool """ + _inst: Incomplete _ica: Incomplete _labels: Incomplete selected_labels: Incomplete _selected_component: int - def __init__(self, inst: Union[BaseRaw, BaseEpochs], ica: ICA, show: bool=True) -> None: - ... - + def __init__( + self, inst: Union[BaseRaw, BaseEpochs], ica: ICA, show: bool = True + ) -> None: ... def _save_labels(self) -> None: """Save the selected labels to the ICA instance.""" _central_widget: Incomplete @@ -98,4 +99,4 @@ class ICAComponentLabeler(QMainWindow): Update the labels since the user might have selected one for the currently being displayed IC. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/iclabel/__init__.pyi b/mne_icalabel/iclabel/__init__.pyi index 8ec7fda1d..8af3ef1f9 100644 --- a/mne_icalabel/iclabel/__init__.pyi +++ b/mne_icalabel/iclabel/__init__.pyi @@ -1,3 +1,3 @@ from .features import get_iclabel_features as get_iclabel_features from .label_components import iclabel_label_components as iclabel_label_components -from .network import run_iclabel as run_iclabel \ No newline at end of file +from .network import run_iclabel as run_iclabel diff --git a/mne_icalabel/iclabel/_config.pyi b/mne_icalabel/iclabel/_config.pyi index 616f49282..dae4be061 100644 --- a/mne_icalabel/iclabel/_config.pyi +++ b/mne_icalabel/iclabel/_config.pyi @@ -1,2 +1,2 @@ ICLABEL_NUMERICAL_TO_STRING: dict[int, str] -ICLABEL_STRING_TO_NUMERICAL: dict[str, int] \ No newline at end of file +ICLABEL_STRING_TO_NUMERICAL: dict[str, int] diff --git a/mne_icalabel/iclabel/_utils.pyi b/mne_icalabel/iclabel/_utils.pyi index 2208cad8e..d5e05b3ab 100644 --- a/mne_icalabel/iclabel/_utils.pyi +++ b/mne_icalabel/iclabel/_utils.pyi @@ -1,7 +1,9 @@ from mne.io import BaseRaw from numpy.typing import ArrayLike, NDArray -def _mne_to_eeglab_locs(raw: BaseRaw, picks: list[str]) -> tuple[NDArray[float], NDArray[float]]: +def _mne_to_eeglab_locs( + raw: BaseRaw, picks: list[str] +) -> tuple[NDArray[float], NDArray[float]]: """Obtain EEGLab-like spherical coordinate from EEG channel positions. TODO: @JACOB: @@ -25,7 +27,9 @@ def _mne_to_eeglab_locs(raw: BaseRaw, picks: list[str]) -> tuple[NDArray[float], Degree in spherical coordinates of each EEG channel. """ -def _pol2cart(theta: NDArray[float], rho: NDArray[float]) -> tuple[NDArray[float], NDArray[float]]: +def _pol2cart( + theta: NDArray[float], rho: NDArray[float] +) -> tuple[NDArray[float], NDArray[float]]: """Convert polar coordinates to cartesian coordinates. Parameters @@ -39,7 +43,9 @@ def _pol2cart(theta: NDArray[float], rho: NDArray[float]) -> tuple[NDArray[float def _next_power_of_2(x) -> int: """Equivalent to 2^nextpow2 in MATLAB.""" -def _gdatav4(x: ArrayLike, y: ArrayLike, v: ArrayLike, xq: ArrayLike, yq: ArrayLike) -> tuple[ArrayLike, ArrayLike, ArrayLike]: +def _gdatav4( + x: ArrayLike, y: ArrayLike, v: ArrayLike, xq: ArrayLike, yq: ArrayLike +) -> tuple[ArrayLike, ArrayLike, ArrayLike]: """GDATAV4 MATLAB 4 GRIDDATA interpolation. Parameters @@ -69,7 +75,9 @@ def _gdatav4(x: ArrayLike, y: ArrayLike, v: ArrayLike, xq: ArrayLike, yq: ArrayL Describes interpolation using value of gradient of value in any dimension. """ -def _mergepoints2D(x: ArrayLike, y: ArrayLike, v: ArrayLike) -> tuple[ArrayLike, ArrayLike, ArrayLike]: +def _mergepoints2D( + x: ArrayLike, y: ArrayLike, v: ArrayLike +) -> tuple[ArrayLike, ArrayLike, ArrayLike]: """Averages values for points that are close to each other. Parameters @@ -88,7 +96,9 @@ def _mergepoints2D(x: ArrayLike, y: ArrayLike, v: ArrayLike) -> tuple[ArrayLike, v : array """ -def _mergesimpts(data: ArrayLike, tols: list[ArrayLike], mode: str='average') -> ArrayLike: +def _mergesimpts( + data: ArrayLike, tols: list[ArrayLike], mode: str = "average" +) -> ArrayLike: """ Parameters ---------- @@ -99,4 +109,4 @@ def _mergesimpts(data: ArrayLike, tols: list[ArrayLike], mode: str='average') -> Returns ------- array - """ \ No newline at end of file + """ diff --git a/mne_icalabel/iclabel/features.pyi b/mne_icalabel/iclabel/features.pyi index 3cf2881f0..dba66dc72 100644 --- a/mne_icalabel/iclabel/features.pyi +++ b/mne_icalabel/iclabel/features.pyi @@ -52,7 +52,9 @@ def _retrieve_eeglab_icawinv(ica: ICA) -> tuple[NDArray[float], NDArray[float]]: weights : array """ -def _compute_ica_activations(inst: Union[BaseRaw, BaseEpochs], ica: ICA) -> NDArray[float]: +def _compute_ica_activations( + inst: Union[BaseRaw, BaseEpochs], ica: ICA +) -> NDArray[float]: """Compute the ICA activations 'icaact' variable from an MNE ICA instance. Parameters @@ -83,25 +85,45 @@ def _compute_ica_activations(inst: Union[BaseRaw, BaseEpochs], ica: ICA) -> NDAr average reference. """ -def _eeg_topoplot(inst: Union[BaseRaw, BaseEpochs], icawinv: NDArray[float], picks: list[str]) -> NDArray[float]: +def _eeg_topoplot( + inst: Union[BaseRaw, BaseEpochs], icawinv: NDArray[float], picks: list[str] +) -> NDArray[float]: """Topoplot feature.""" -def _topoplotFast(values: NDArray[float], rd: NDArray[float], th: NDArray[float]) -> NDArray[float]: +def _topoplotFast( + values: NDArray[float], rd: NDArray[float], th: NDArray[float] +) -> NDArray[float]: """Implement topoplotFast.m from MATLAB. Each topographic map is a 32x32 images.""" -def _eeg_rpsd(inst: Union[BaseRaw, BaseEpochs], ica: ICA, icaact: NDArray[float]) -> NDArray[float]: +def _eeg_rpsd( + inst: Union[BaseRaw, BaseEpochs], ica: ICA, icaact: NDArray[float] +) -> NDArray[float]: """PSD feature.""" -def _eeg_rpsd_constants(inst: Union[BaseRaw, BaseEpochs], ica: ICA) -> tuple[int, int, int, int, NDArray[int], NDArray[float], NDArray[int]]: +def _eeg_rpsd_constants( + inst: Union[BaseRaw, BaseEpochs], ica: ICA +) -> tuple[int, int, int, int, NDArray[int], NDArray[float], NDArray[int]]: """Compute the constants before ``randperm`` is used to compute the subset.""" -def _eeg_rpsd_compute_psdmed(inst: Union[BaseRaw, BaseEpochs], icaact: NDArray[float], ncomp: int, nfreqs: int, n_points: int, nyquist: int, index: NDArray[int], window: NDArray[float], subset: NDArray[int]) -> NDArray[float]: +def _eeg_rpsd_compute_psdmed( + inst: Union[BaseRaw, BaseEpochs], + icaact: NDArray[float], + ncomp: int, + nfreqs: int, + n_points: int, + nyquist: int, + index: NDArray[int], + window: NDArray[float], + subset: NDArray[int], +) -> NDArray[float]: """Compute the variable 'psdmed', annotated as windowed spectrums.""" def _eeg_rpsd_format(psd: NDArray[float]) -> NDArray[float]: """Apply the formatting steps after 'eeg_rpsd.m'.""" -def _eeg_autocorr_welch(raw: BaseRaw, ica: ICA, icaact: NDArray[float]) -> NDArray[float]: +def _eeg_autocorr_welch( + raw: BaseRaw, ica: ICA, icaact: NDArray[float] +) -> NDArray[float]: """Autocorrelation feature applied on raw object with at least 5 * fs samples. MATLAB: 'eeg_autocorr_welch.m'. @@ -113,7 +135,9 @@ def _eeg_autocorr(raw: BaseRaw, ica: ICA, icaact: NDArray[float]) -> NDArray[flo MATLAB: 'eeg_autocorr.m'. """ -def _eeg_autocorr_fftw(epochs: BaseEpochs, ica: ICA, icaact: NDArray[float]) -> NDArray[float]: +def _eeg_autocorr_fftw( + epochs: BaseEpochs, ica: ICA, icaact: NDArray[float] +) -> NDArray[float]: """Autocorrelation feature applied on epoch object. MATLAB: 'eeg_autocorr_fftw.m'. @@ -137,4 +161,4 @@ def _resample(ac: NDArray[float], fs: Union[int, float]) -> NDArray[float]: Array of shape (n_comp, samples). fs : int | float Sampling frequency of the MNE instance. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/iclabel/label_components.pyi b/mne_icalabel/iclabel/label_components.pyi index 2331beea2..c8d7c4e90 100644 --- a/mne_icalabel/iclabel/label_components.pyi +++ b/mne_icalabel/iclabel/label_components.pyi @@ -7,7 +7,12 @@ from mne.preprocessing import ICA from .features import get_iclabel_features as get_iclabel_features from .network import run_iclabel as run_iclabel -def iclabel_label_components(inst: Union[BaseRaw, BaseEpochs], ica: ICA, inplace: bool=True, backend: Optional[str]=None): +def iclabel_label_components( + inst: Union[BaseRaw, BaseEpochs], + ica: ICA, + inplace: bool = True, + backend: Optional[str] = None, +): """Label the provided ICA components with the ICLabel neural network. ICLabel is designed to classify ICs fitted with an extended infomax ICA @@ -54,4 +59,4 @@ def iclabel_label_components(inst: Union[BaseRaw, BaseEpochs], ica: ICA, inplace References ---------- .. footbibliography:: - """ \ No newline at end of file + """ diff --git a/mne_icalabel/iclabel/network/__init__.pyi b/mne_icalabel/iclabel/network/__init__.pyi index 0fb2ce732..b88963422 100644 --- a/mne_icalabel/iclabel/network/__init__.pyi +++ b/mne_icalabel/iclabel/network/__init__.pyi @@ -2,7 +2,12 @@ from typing import Optional from numpy.typing import ArrayLike, NDArray -def run_iclabel(images: ArrayLike, psds: ArrayLike, autocorr: ArrayLike, backend: Optional[str]='pytorch') -> NDArray: +def run_iclabel( + images: ArrayLike, + psds: ArrayLike, + autocorr: ArrayLike, + backend: Optional[str] = "pytorch", +) -> NDArray: """Run the ICLabel network on the provided set of features. The features are un-formatted and are as-returned by @@ -26,4 +31,4 @@ def run_iclabel(images: ArrayLike, psds: ArrayLike, autocorr: ArrayLike, backend The predicted numerical probability values for all labels in ICLabel output. Columns are ordered with ``'Brain'``, ``'Muscle'``, ``'Eye'``, ``'Heart'``, ``'Line Noise'``, ``'Channel Noise'``, and ``'Other'``. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/iclabel/network/onnx.pyi b/mne_icalabel/iclabel/network/onnx.pyi index f6c5d448c..1183d343e 100644 --- a/mne_icalabel/iclabel/network/onnx.pyi +++ b/mne_icalabel/iclabel/network/onnx.pyi @@ -6,4 +6,4 @@ def _format_input_for_onnx(topo: ArrayLike, psd: ArrayLike, autocorr: ArrayLike) """Format the features to the correct shape and type for ONNX.""" def _run_iclabel(images: ArrayLike, psds: ArrayLike, autocorr: ArrayLike) -> NDArray: - """Run ICLabel using onnx.""" \ No newline at end of file + """Run ICLabel using onnx.""" diff --git a/mne_icalabel/iclabel/network/torch.pyi b/mne_icalabel/iclabel/network/torch.pyi index a61945bc3..9c1b6bd77 100644 --- a/mne_icalabel/iclabel/network/torch.pyi +++ b/mne_icalabel/iclabel/network/torch.pyi @@ -14,11 +14,8 @@ class _ICLabelNetImg(nn.Module): relu3: Incomplete sequential: Incomplete - def __init__(self) -> None: - ... - - def forward(self, x): - ... + def __init__(self) -> None: ... + def forward(self, x): ... class _ICLabelNetPSDS(nn.Module): conv1: Incomplete @@ -29,11 +26,8 @@ class _ICLabelNetPSDS(nn.Module): relu3: Incomplete sequential: Incomplete - def __init__(self) -> None: - ... - - def forward(self, x): - ... + def __init__(self) -> None: ... + def forward(self, x): ... class _ICLabelNetAutocorr(nn.Module): conv1: Incomplete @@ -44,14 +38,12 @@ class _ICLabelNetAutocorr(nn.Module): relu3: Incomplete sequential: Incomplete - def __init__(self) -> None: - ... - - def forward(self, x): - ... + def __init__(self) -> None: ... + def forward(self, x): ... class ICLabelNet(nn.Module): """The ICLabel neural network.""" + img_conv: Incomplete psds_conv: Incomplete autocorr_conv: Incomplete @@ -59,21 +51,16 @@ class ICLabelNet(nn.Module): softmax: Incomplete seq: Incomplete - def __init__(self) -> None: - ... - + def __init__(self) -> None: ... @staticmethod - def reshape_fortran(x: torch.Tensor, shape) -> torch.Tensor: - ... - - def reshape_concat(self, tensor: torch.Tensor) -> torch.Tensor: - ... - - def forward(self, images: torch.Tensor, psds: torch.Tensor, autocorr: torch.Tensor) -> torch.Tensor: - ... + def reshape_fortran(x: torch.Tensor, shape) -> torch.Tensor: ... + def reshape_concat(self, tensor: torch.Tensor) -> torch.Tensor: ... + def forward( + self, images: torch.Tensor, psds: torch.Tensor, autocorr: torch.Tensor + ) -> torch.Tensor: ... def _format_input_for_torch(topo: ArrayLike, psd: ArrayLike, autocorr: ArrayLike): """Format the features to the correct shape and type for pytorch.""" def _run_iclabel(images: ArrayLike, psds: ArrayLike, autocorr: ArrayLike) -> NDArray: - """Run ICLabel using onnx.""" \ No newline at end of file + """Run ICLabel using onnx.""" diff --git a/mne_icalabel/iclabel/network/utils.pyi b/mne_icalabel/iclabel/network/utils.pyi index 58bbc6642..a871ccd5e 100644 --- a/mne_icalabel/iclabel/network/utils.pyi +++ b/mne_icalabel/iclabel/network/utils.pyi @@ -1,7 +1,9 @@ from numpy.typing import ArrayLike from numpy.typing import NDArray as NDArray -def _format_input(topo: ArrayLike, psd: ArrayLike, autocorr: ArrayLike) -> tuple[NDArray, NDArray, NDArray]: +def _format_input( + topo: ArrayLike, psd: ArrayLike, autocorr: ArrayLike +) -> tuple[NDArray, NDArray, NDArray]: """Replicate the input formatting in EEGLAB -ICLabel. .. code-block:: matlab @@ -10,4 +12,4 @@ def _format_input(topo: ArrayLike, psd: ArrayLike, autocorr: ArrayLike) -> tuple -images(:, end:-1:1, :, :)); psds = repmat(psds, [1 1 1 4]); autocorrs = repmat(autocorrs, [1 1 1 4]); - """ \ No newline at end of file + """ diff --git a/mne_icalabel/label_components.pyi b/mne_icalabel/label_components.pyi index 78d9f2405..bcf1632e1 100644 --- a/mne_icalabel/label_components.pyi +++ b/mne_icalabel/label_components.pyi @@ -38,4 +38,4 @@ def label_components(inst: Union[BaseRaw, BaseEpochs], ica: ICA, method: str): method: - ``'iclabel'``: `~mne_icalabel.iclabel.iclabel_label_components` - """ \ No newline at end of file + """ diff --git a/mne_icalabel/utils/__init__.pyi b/mne_icalabel/utils/__init__.pyi index cd4f1e36d..4715794c2 100644 --- a/mne_icalabel/utils/__init__.pyi +++ b/mne_icalabel/utils/__init__.pyi @@ -1 +1 @@ -from . import config as config \ No newline at end of file +from . import config as config diff --git a/mne_icalabel/utils/_checks.pyi b/mne_icalabel/utils/_checks.pyi index 5d0550fc5..8c7d48263 100644 --- a/mne_icalabel/utils/_checks.pyi +++ b/mne_icalabel/utils/_checks.pyi @@ -8,4 +8,4 @@ def _validate_inst_and_ica(inst: Union[BaseRaw, BaseEpochs], ica: ICA): """Make sure that the provided instance and ICA are valid.""" def _validate_ica(ica: ICA): - """Make sure that the provided ICA is valid.""" \ No newline at end of file + """Make sure that the provided ICA is valid.""" diff --git a/mne_icalabel/utils/_docs.pyi b/mne_icalabel/utils/_docs.pyi index 58ebeb88e..34dd542a5 100644 --- a/mne_icalabel/utils/_docs.pyi +++ b/mne_icalabel/utils/_docs.pyi @@ -67,4 +67,4 @@ def copy_doc(source: Callable[..., Any]) -> Callable[..., Any]: ... pass >>> print(B.m1.__doc__) Docstring for m1 this gets appended - """ \ No newline at end of file + """ diff --git a/mne_icalabel/utils/_fixes.pyi b/mne_icalabel/utils/_fixes.pyi index 4fc75cd31..3ed4a60ac 100644 --- a/mne_icalabel/utils/_fixes.pyi +++ b/mne_icalabel/utils/_fixes.pyi @@ -7,5 +7,4 @@ class WrapStdOut: properly. """ - def __getattr__(self, name: str) -> Any: - ... \ No newline at end of file + def __getattr__(self, name: str) -> Any: ... diff --git a/mne_icalabel/utils/_imports.pyi b/mne_icalabel/utils/_imports.pyi index 0be3d8ca6..a2b9c32af 100644 --- a/mne_icalabel/utils/_imports.pyi +++ b/mne_icalabel/utils/_imports.pyi @@ -3,7 +3,9 @@ from typing import Optional _INSTALL_MAPPING: dict[str, str] -def import_optional_dependency(name: str, extra: str='', raise_error: bool=True) -> Optional[ModuleType]: +def import_optional_dependency( + name: str, extra: str = "", raise_error: bool = True +) -> Optional[ModuleType]: """Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be @@ -25,4 +27,4 @@ def import_optional_dependency(name: str, extra: str='', raise_error: bool=True) module : Module | None The imported module when found. None is returned when the package is not found and raise_error is False. - """ \ No newline at end of file + """ diff --git a/mne_icalabel/utils/config.pyi b/mne_icalabel/utils/config.pyi index 927f509ee..895294b25 100644 --- a/mne_icalabel/utils/config.pyi +++ b/mne_icalabel/utils/config.pyi @@ -2,7 +2,7 @@ from typing import IO, Callable, Optional from packaging.requirements import Requirement -def sys_info(fid: Optional[IO]=None, developer: bool=False): +def sys_info(fid: Optional[IO] = None, developer: bool = False): """Print the system information for debugging. Parameters @@ -14,5 +14,7 @@ def sys_info(fid: Optional[IO]=None, developer: bool=False): If True, display information about optional dependencies. """ -def _list_dependencies_info(out: Callable, ljust: int, package: str, dependencies: list[Requirement]) -> None: - """List dependencies names and versions.""" \ No newline at end of file +def _list_dependencies_info( + out: Callable, ljust: int, package: str, dependencies: list[Requirement] +) -> None: + """List dependencies names and versions.""" diff --git a/pyproject.toml b/pyproject.toml index d206ddec8..3d3349129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -189,13 +189,10 @@ minversion = '6.0' [tool.ruff] extend-exclude = [ - '*.pyi', 'doc', 'setup.py', ] -ignore = [ - "UP007", # 'Use `X | Y` for type annotations', requires python 3.10 -] +ignore = [] line-length = 88 select = ["E", "F", "UP", "W"] target-version = 'py39' @@ -204,6 +201,10 @@ target-version = 'py39' docstring-code-format = true [tool.ruff.per-file-ignores] +'*' = [ + "UP007", # 'Use `X | Y` for type annotations', requires python 3.10 +] +'*.pyi' = ['E501'] '__init__.py' = ['F401'] [tool.setuptools]