From 3a592feb0ec5bafe4d657a24017ce262d498ccc1 Mon Sep 17 00:00:00 2001 From: bruAristimunha Date: Wed, 8 Feb 2023 14:33:08 +0100 Subject: [PATCH 1/2] Updating the .pre-commit-yaml to fix CI. --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 index 5be1a6377..9da68e947 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,12 @@ repos: - id: mixed-line-ending - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort From b239f7a6f6ea8cba98af9a33e06083a6acd5df84 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 13:35:41 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- moabb/analysis/results.py | 1 - moabb/datasets/epfl.py | 3 --- moabb/datasets/fake.py | 1 - moabb/datasets/huebner_llp.py | 1 - moabb/datasets/sosulski2019.py | 1 - moabb/datasets/ssvep_exo.py | 1 - moabb/evaluations/evaluations.py | 3 --- moabb/pipelines/utils.py | 4 ---- moabb/tests/datasets.py | 1 - 9 files changed, 16 deletions(-) diff --git a/moabb/analysis/results.py b/moabb/analysis/results.py index eb1178654..fa281a0db 100644 --- a/moabb/analysis/results.py +++ b/moabb/analysis/results.py @@ -176,7 +176,6 @@ def to_dataframe(self, pipelines=None): with h5py.File(self.filepath, "r") as f: for digest, p_group in f.items(): - # skip if not in pipeline list if (pipelines is not None) & (digest not in digests): continue diff --git a/moabb/datasets/epfl.py b/moabb/datasets/epfl.py index fea26bd78..3685b67ef 100644 --- a/moabb/datasets/epfl.py +++ b/moabb/datasets/epfl.py @@ -82,7 +82,6 @@ def __init__(self): ) def _get_single_run_data(self, file_path): - # data from the .mat data = loadmat(file_path) signals = data["data"] @@ -157,7 +156,6 @@ def _get_single_subject_data(self, subject): sessions = {} for file_path in sorted(file_path_list): - session_name = "session_" + file_path.split(os.sep)[-2].replace("session", "") if session_name not in sessions.keys(): @@ -171,7 +169,6 @@ def _get_single_subject_data(self, subject): def data_path( self, subject, path=None, force_update=False, update_path=None, verbose=None ): - if subject not in self.subject_list: raise (ValueError("Invalid subject number")) diff --git a/moabb/datasets/fake.py b/moabb/datasets/fake.py index 96c91cea6..0a9977ee7 100644 --- a/moabb/datasets/fake.py +++ b/moabb/datasets/fake.py @@ -52,7 +52,6 @@ def __init__( ) def _get_single_subject_data(self, subject): - data = dict() for session in range(self.n_sessions): data[f"session_{session}"] = { diff --git a/moabb/datasets/huebner_llp.py b/moabb/datasets/huebner_llp.py index 7f68302f4..ae241dc1c 100644 --- a/moabb/datasets/huebner_llp.py +++ b/moabb/datasets/huebner_llp.py @@ -20,7 +20,6 @@ class _BaseVisualMatrixSpellerDataset(BaseDataset, ABC): def __init__( self, src_url, n_subjects, raw_slice_offset, use_blocks_as_sessions=True, **kwargs ): - self.n_channels = 31 # all channels except 5 times x_* CH and EOGvu if kwargs["interval"] is None: # "Epochs were windowed to [−200, 700] ms relative to the stimulus onset [...]." diff --git a/moabb/datasets/sosulski2019.py b/moabb/datasets/sosulski2019.py index d6c0f540e..ab0db28bf 100644 --- a/moabb/datasets/sosulski2019.py +++ b/moabb/datasets/sosulski2019.py @@ -163,7 +163,6 @@ def _get_single_subject_data(self, subject): def data_path( self, subject, path=None, force_update=False, update_path=None, verbose=None ): - if subject not in self.subject_list: raise (ValueError("Invalid subject number")) diff --git a/moabb/datasets/ssvep_exo.py b/moabb/datasets/ssvep_exo.py index 3698a2f68..7ab0a4907 100644 --- a/moabb/datasets/ssvep_exo.py +++ b/moabb/datasets/ssvep_exo.py @@ -81,7 +81,6 @@ def _get_single_subject_data(self, subject): def data_path( self, subject, path=None, force_update=False, update_path=None, verbose=None ): - runs = {s + 1: n for s, n in enumerate([2] * 6 + [3] + [2] * 2 + [4, 2, 5])} if subject not in self.subject_list: diff --git a/moabb/evaluations/evaluations.py b/moabb/evaluations/evaluations.py index 7ff29b98a..56bb22cf6 100644 --- a/moabb/evaluations/evaluations.py +++ b/moabb/evaluations/evaluations.py @@ -603,7 +603,6 @@ def _grid_search(self, param_grid, name_grid, name, clf, pipelines, X, y, cv, gr return pipelines[name] elif param_grid is not None and os.path.isdir(name_grid): - search = joblib.load(os.path.join(name_grid, "Grid_Search_CrossSubject.pkl")) pipelines[name].set_params(**search.best_params_) @@ -645,7 +644,6 @@ def evaluate(self, dataset, pipelines, param_grid): # Implement Grid Search for name, clf in pipelines.items(): - name_grid = os.path.join( str(self.hdf5_path), "GridSearch_CrossSubject", dataset.code, name ) @@ -660,7 +658,6 @@ def evaluate(self, dataset, pipelines, param_grid): total=n_subjects, desc=f"{dataset.code}-CrossSubject", ): - subject = groups[test[0]] # now we can check if this subject has results run_pipes = self.results.not_yet_computed(pipelines, dataset, subject) diff --git a/moabb/pipelines/utils.py b/moabb/pipelines/utils.py index 6649ecc44..52f54a94a 100644 --- a/moabb/pipelines/utils.py +++ b/moabb/pipelines/utils.py @@ -137,7 +137,6 @@ def generate_paradigms(pipeline_configs, context=None, logger=log): context = context or {} paradigms = OrderedDict() for config in pipeline_configs: - if "paradigms" not in config.keys(): logger.error("{} must have a 'paradigms' key.".format(config)) continue @@ -145,7 +144,6 @@ def generate_paradigms(pipeline_configs, context=None, logger=log): # iterate over paradigms for paradigm in config["paradigms"]: - # check if it is in the context parameters file if len(context) > 0: if paradigm not in context.keys(): @@ -174,11 +172,9 @@ def generate_paradigms(pipeline_configs, context=None, logger=log): def generate_param_grid(pipeline_configs, context=None, logger=log): - context = context or {} param_grid = {} for config in pipeline_configs: - if "paradigms" not in config: logger.error("{} must have a 'paradigms' key.".format(config)) continue diff --git a/moabb/tests/datasets.py b/moabb/tests/datasets.py index d86da15de..9b9505a13 100644 --- a/moabb/tests/datasets.py +++ b/moabb/tests/datasets.py @@ -33,7 +33,6 @@ def test_fake_dataset(self): n_runs = 2 for paradigm in ["imagery", "p300", "ssvep"]: - ds = FakeDataset( n_sessions=n_sessions, n_runs=n_runs,