Skip to content

Commit

Permalink
linted
Browse files Browse the repository at this point in the history
  • Loading branch information
BalzaniEdoardo committed Feb 21, 2025
1 parent efa4fa0 commit e4cf3b0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/nemos/basis/_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ def __getitem__(self, index: str) -> Basis:

if isinstance(index, (int, slice)):
string = "Slicing" if isinstance(index, slice) else "Indexing with integer"
raise IndexError(f"You can index basis only using labels. {string} is invalid.")
raise IndexError(
f"You can index basis only using labels. {string} is invalid."
)

search = next(
(bas for lab, bas in generate_basis_label_pair(self) if lab == index), None
Expand Down
6 changes: 4 additions & 2 deletions src/nemos/basis/_basis_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,10 @@ def basis2(self):
@basis2.setter
def basis2(self, basis):
if not hasattr(basis, "compute_features"):
raise TypeError("`basis2` does not implement `compute_features`. "
"The method is required for the correct behavior of the basis." )
raise TypeError(
"`basis2` does not implement `compute_features`. "
"The method is required for the correct behavior of the basis."
)
if self._basis1:
self._set_labels(self._basis1, basis)
if self._basis2:
Expand Down
10 changes: 8 additions & 2 deletions src/nemos/basis/_transformer_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@ class TransformerBasis:
)

def __init__(self, basis: Basis):
if not hasattr(basis, "get_params") or not hasattr(basis, "set_params") or not hasattr(basis, "compute_features"):
if (
not hasattr(basis, "get_params")
or not hasattr(basis, "set_params")
or not hasattr(basis, "compute_features")
):
missing_attrs = [
attr for attr in ("get_params", "set_params", "compute_features") if not hasattr(basis, attr)
attr
for attr in ("get_params", "set_params", "compute_features")
if not hasattr(basis, attr)
]
raise TypeError(
"TransformerBasis accepts only object implementing `get_params`, `set_params`, and `compute_features`."
Expand Down

0 comments on commit e4cf3b0

Please sign in to comment.