Skip to content

Commit 2816d13

Browse files
drammocklarsoner
andcommitted
fixes for latest codespell release (#11047)
* fixes for latest codespell release * use URI ignore words in actions config * FIX: Work around pandas dep Co-authored-by: Eric Larson <[email protected]>
1 parent 896744e commit 2816d13

File tree

12 files changed

+30
-16
lines changed

12 files changed

+30
-16
lines changed

.github/workflows/codespell_and_flake.yml

+1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ jobs:
4141
quiet_level: '3'
4242
builtin: 'clear,rare,informal,names'
4343
ignore_words_file: 'ignore_words.txt'
44+
uri_ignore_words_list: 'bu'
4445
name: 'Run codespell'

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
PYTHON ?= python
44
PYTESTS ?= py.test
55
CTAGS ?= ctags
6-
CODESPELL_SKIPS ?= "doc/auto_*,*.fif,*.eve,*.gz,*.tgz,*.zip,*.mat,*.stc,*.label,*.w,*.bz2,*.annot,*.sulc,*.log,*.local-copy,*.orig_avg,*.inflated_avg,*.gii,*.pyc,*.doctree,*.pickle,*.inv,*.png,*.edf,*.touch,*.thickness,*.nofix,*.volume,*.defect_borders,*.mgh,lh.*,rh.*,COR-*,FreeSurferColorLUT.txt,*.examples,.xdebug_mris_calc,bad.segments,BadChannels,*.hist,empty_file,*.orig,*.js,*.map,*.ipynb,searchindex.dat,install_mne_c.rst,plot_*.rst,*.rst.txt,c_EULA.rst*,*.html,gdf_encodes.txt,*.svg,references.bib,*.css"
6+
CODESPELL_SKIPS ?= "doc/_build,doc/auto_*,*.fif,*.eve,*.gz,*.tgz,*.zip,*.mat,*.stc,*.label,*.w,*.bz2,*.annot,*.sulc,*.log,*.local-copy,*.orig_avg,*.inflated_avg,*.gii,*.pyc,*.doctree,*.pickle,*.inv,*.png,*.edf,*.touch,*.thickness,*.nofix,*.volume,*.defect_borders,*.mgh,lh.*,rh.*,COR-*,FreeSurferColorLUT.txt,*.examples,.xdebug_mris_calc,bad.segments,BadChannels,*.hist,empty_file,*.orig,*.js,*.map,*.ipynb,searchindex.dat,install_mne_c.rst,plot_*.rst,*.rst.txt,c_EULA.rst*,*.html,gdf_encodes.txt,*.svg,references.bib,*.css"
77
CODESPELL_DIRS ?= mne/ doc/ tutorials/ examples/
88
all: clean inplace test test-doc
99

@@ -103,10 +103,10 @@ flake:
103103
@echo "flake8 passed"
104104

105105
codespell: # running manually
106-
@codespell --builtin clear,rare,informal,names,usage -w -i 3 -q 3 -S $(CODESPELL_SKIPS) --ignore-words=ignore_words.txt $(CODESPELL_DIRS)
106+
@codespell --builtin clear,rare,informal,names,usage -w -i 3 -q 3 -S $(CODESPELL_SKIPS) --ignore-words=ignore_words.txt --uri-ignore-words-list=bu $(CODESPELL_DIRS)
107107

108108
codespell-error: # running on travis
109-
@codespell --builtin clear,rare,informal,names,usage -i 0 -q 7 -S $(CODESPELL_SKIPS) --ignore-words=ignore_words.txt $(CODESPELL_DIRS)
109+
@codespell --builtin clear,rare,informal,names,usage -i 0 -q 7 -S $(CODESPELL_SKIPS) --ignore-words=ignore_words.txt --uri-ignore-words-list=bu $(CODESPELL_DIRS)
110110

111111
pydocstyle:
112112
@echo "Running pydocstyle"

ignore_words.txt

+2
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ nin
3737
trough
3838
recuse
3939
ro
40+
nam
41+
bu

mne/coreg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ def fit_fiducials(self, lpa_weight=1., nasion_weight=10., rpa_weight=1.,
17641764
self._log_dig_mri_distance('Start')
17651765
n_scale_params = self._n_scale_params
17661766
if n_scale_params == 3:
1767-
# enfore 1 even for 3-axis here (3 points is not enough)
1767+
# enforce 1 even for 3-axis here (3 points is not enough)
17681768
logger.info("Enforcing 1 scaling parameter for fit "
17691769
"with fiducials.")
17701770
n_scale_params = 1

mne/decoding/ssd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def fit(self, X, y=None):
184184
self.filters_ = eigvects_[:, ix]
185185
self.patterns_ = np.linalg.pinv(self.filters_)
186186
# We assume that ordering by spectral ratio is more important
187-
# than the initial ordering. This ording should be also learned when
187+
# than the initial ordering. This ordering should be also learned when
188188
# fitting.
189189
X_ssd = self.filters_.T @ X[..., self.picks_, :]
190190
sorter_spec = Ellipsis

mne/evoked.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def apply_baseline(self, baseline=(None, 0), *, verbose=None):
269269
sfreq=self.info['sfreq'])
270270
if self.baseline is not None and baseline is None:
271271
raise ValueError('The data has already been baseline-corrected. '
272-
'Cannot remove existing basline correction.')
272+
'Cannot remove existing baseline correction.')
273273
elif baseline is None:
274274
# Do not rescale
275275
logger.info(_log_rescale(None))

mne/io/brainvision/brainvision.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ def _parse_impedance(settings, recording_date=None):
931931
Parameters
932932
----------
933933
settings : list
934-
The header settings lines fom the VHDR/AHDR file.
934+
The header settings lines from the VHDR/AHDR file.
935935
recording_date : datetime.datetime | None
936936
The date of the recording as extracted from the VMRK/AMRK file.
937937
@@ -993,7 +993,7 @@ def _parse_impedance_ranges(settings):
993993
Parameters
994994
----------
995995
settings : list
996-
The header settings lines fom the VHDR/AHDR file.
996+
The header settings lines from the VHDR/AHDR file.
997997
998998
Returns
999999
-------

mne/io/curry/curry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def _first_hpi(fname):
393393
break
394394
else:
395395
raise RuntimeError('Could not find valid HPI in %s' % (fname,))
396-
# t is the first enttry
396+
# t is the first entry
397397
assert hpi.ndim == 1
398398
hpi = hpi[1:]
399399
hpi.shape = (-1, 5)

mne/io/nihon/nihon.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def __init__(self, fname, preload=False, verbose=None):
392392
# Get annotations from LOG file
393393
annots = _read_nihon_annotations(fname)
394394

395-
# Annotate acqusition skips
395+
# Annotate acquisition skips
396396
controlblock = self._header['controlblocks'][0]
397397
cur_sample = 0
398398
if controlblock['n_datablocks'] > 1:

mne/preprocessing/tests/test_eeglab_infomax.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_mne_python_vs_eeglab():
7676
% (method,
7777
dict(eeg='eeg', mag='meg')[ch_type]))
7878

79-
# For comparasion against eeglab, make sure the following
79+
# For comparison against eeglab, make sure the following
8080
# parameters have the same value in mne_python and eeglab:
8181
#
8282
# - starting point

mne/utils/dataframe.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ._logging import logger, verbose
1010
from ..defaults import _handle_default
11+
from ..fixes import _get_args
1112

1213

1314
@verbose
@@ -47,6 +48,16 @@ def _convert_times(inst, times, time_format):
4748
return times
4849

4950

51+
def _inplace(df, method, **kwargs):
52+
"""Handle transition: inplace=True (pandas <1.5) → copy=False (>=1.5)."""
53+
_meth = getattr(df, method) # used for set_index() and rename()
54+
if 'copy' in _get_args(_meth):
55+
return _meth(**kwargs, copy=False)
56+
else:
57+
_meth(**kwargs, inplace=True)
58+
return df
59+
60+
5061
@verbose
5162
def _build_data_frame(inst, data, picks, long_format, mindex, index,
5263
default_index, col_names=None, col_kind='channel',
@@ -63,16 +74,16 @@ def _build_data_frame(inst, data, picks, long_format, mindex, index,
6374
df.insert(i, k, v)
6475
# build Index
6576
if long_format:
66-
df.set_index(default_index, inplace=True)
77+
df = _inplace(df, 'set_index', keys=default_index)
6778
df.columns.name = col_kind
6879
elif index is not None:
69-
df.set_index(index, inplace=True)
80+
df = _inplace(df, 'set_index', keys=index)
7081
if set(index) == set(default_index):
7182
df.columns.name = col_kind
7283
# long format
7384
if long_format:
7485
df = df.stack().reset_index()
75-
df.rename(columns={0: 'value'}, inplace=True)
86+
df = _inplace(df, 'rename', columns={0: 'value'})
7687
# add column for channel types (as appropriate)
7788
ch_map = (None if isinstance(inst, _BaseSourceEstimate) else
7889
dict(zip(np.array(inst.ch_names)[picks],
@@ -83,7 +94,7 @@ def _build_data_frame(inst, data, picks, long_format, mindex, index,
8394
df.insert(col_index, 'ch_type', ch_type)
8495
# restore index
8596
if index is not None:
86-
df.set_index(index, inplace=True)
97+
df = _inplace(df, 'set_index', keys=index)
8798
# convert channel/vertex/ch_type columns to factors
8899
to_factor = [c for c in df.columns.tolist()
89100
if c not in ('time', 'value')]

tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
# an adjacency for time points was automatically taken into
142142
# account. That is, at time point N, the time points N - 1 and
143143
# N + 1 were considered as adjacent (this is also called "lattice
144-
# adjacency"). This is only possbile because we ran the analysis on
144+
# adjacency"). This is only possible because we ran the analysis on
145145
# 2D data (times × channels) per observation ... for 3D data per
146146
# observation (e.g., times × frequencies × channels), we will need
147147
# to use :func:`mne.stats.combine_adjacency`, as shown further

0 commit comments

Comments
 (0)