Skip to content

Commit e1b7cc7

Browse files
committed
apply ruff auto-fixes
1 parent f6aa2e6 commit e1b7cc7

39 files changed

+91
-205
lines changed

cebra/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from cebra.integrations.sklearn.decoder import L1LinearRegressor
3434

3535
is_sklearn_available = True
36-
except ImportError as e:
36+
except ImportError:
3737
# silently fail for now
3838
pass
3939

@@ -42,7 +42,7 @@
4242
from cebra.integrations.matplotlib import *
4343

4444
is_matplotlib_available = True
45-
except ImportError as e:
45+
except ImportError:
4646
# silently fail for now
4747
pass
4848

@@ -51,7 +51,7 @@
5151
from cebra.integrations.plotly import *
5252

5353
is_plotly_available = True
54-
except ImportError as e:
54+
except ImportError:
5555
# silently fail for now
5656
pass
5757

cebra/__main__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@
2727
import argparse
2828
import sys
2929

30-
import numpy as np
31-
import torch
32-
3330
import cebra
34-
import cebra.distributions as cebra_distr
3531

3632

3733
def train(parser, kwargs):

cebra/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#
2222
import argparse
2323
import json
24-
from dataclasses import MISSING
2524
from typing import Literal, Optional
2625

2726
import literate_dataclasses as dataclasses

cebra/data/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@
2222
"""Base classes for datasets and loaders."""
2323

2424
import abc
25-
import collections
26-
from typing import List
2725

2826
import literate_dataclasses as dataclasses
29-
import numpy as np
3027
import torch
3128

3229
import cebra.data.assets as cebra_data_assets

cebra/data/datasets.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,14 @@
2121
#
2222
"""Pre-defined datasets."""
2323

24-
import abc
25-
import collections
2624
import types
2725
from typing import List, Tuple, Union
2826

29-
import literate_dataclasses as dataclasses
3027
import numpy as np
3128
import numpy.typing as npt
3229
import torch
33-
from numpy.typing import NDArray
3430

3531
import cebra.data as cebra_data
36-
import cebra.distributions
37-
from cebra.data.datatypes import Batch
38-
from cebra.data.datatypes import BatchIndex
3932

4033

4134
class TensorDataset(cebra_data.SingleSessionDataset):

cebra/data/datatypes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
# limitations under the License.
2121
#
2222
import collections
23-
from typing import Tuple
24-
25-
import torch
2623

2724
__all__ = ["Batch", "BatchIndex", "Offset"]
2825

cebra/data/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ def fit(
181181
elif ref_data.shape[0] == data.shape[0] and (ref_label is None or
182182
label is None):
183183
raise ValueError(
184-
f"Missing labels: the data to align are the same shape but you provided only "
185-
f"one of the sets of labels. Either provide both the reference and alignment "
186-
f"labels or none.")
184+
"Missing labels: the data to align are the same shape but you provided only "
185+
"one of the sets of labels. Either provide both the reference and alignment "
186+
"labels or none.")
187187
else:
188188
if ref_label is None or label is None:
189189
raise ValueError(
190-
f"Missing labels: the data to align are not the same shape, "
191-
f"provide labels to align the data and reference data.")
190+
"Missing labels: the data to align are not the same shape, "
191+
"provide labels to align the data and reference data.")
192192

193193
if len(ref_label.shape) == 1:
194194
ref_label = np.expand_dims(ref_label, axis=1)

cebra/data/multi_session.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
"""Datasets and loaders for multi-session training."""
2323

2424
import abc
25-
import collections
2625
from typing import List
2726

2827
import literate_dataclasses as dataclasses
29-
import numpy as np
3028
import torch
3129

3230
import cebra.data as cebra_data

cebra/data/single_session.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@
2626
"""
2727

2828
import abc
29-
import collections
3029
import warnings
31-
from typing import List
3230

3331
import literate_dataclasses as dataclasses
34-
import numpy as np
3532
import torch
3633

3734
import cebra.data as cebra_data
@@ -365,8 +362,8 @@ def __post_init__(self):
365362

366363
if self.conditional != "time_delta":
367364
raise NotImplementedError(
368-
f"Hybrid training is currently only implemented using the ``time_delta`` "
369-
f"continual distribution.")
365+
"Hybrid training is currently only implemented using the ``time_delta`` "
366+
"continual distribution.")
370367

371368
self.time_distribution = cebra.distributions.TimeContrastive(
372369
time_offset=self.time_offset,

cebra/datasets/allen/ca_movie.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
3030
"""
3131

32-
import glob
33-
import hashlib
3432
import pathlib
3533

36-
import h5py
3734
import joblib
3835
import numpy as np
3936
import pandas as pd
@@ -46,7 +43,6 @@
4643
import cebra.data
4744
from cebra.datasets import get_datapath
4845
from cebra.datasets import parametrize
49-
from cebra.datasets import register
5046
from cebra.datasets.allen import NUM_NEURONS
5147
from cebra.datasets.allen import SEEDS
5248

0 commit comments

Comments
 (0)