Skip to content

Commit

Permalink
ENH: Annotate optimizer attribute type DiffusionGPR
Browse files Browse the repository at this point in the history
Annotate the `optimizer` attribute type in the DiffusionGPR GPR child
class.

Fixes:
```
src/nifreeze/model/gpr.py:234: error:
 "DiffusionGPR" has no attribute "optimizer"  [attr-defined]
```

raised for example in:
https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:82
  • Loading branch information
jhlegarreta committed Dec 22, 2024
1 parent d364e62 commit 363c6e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nifreeze/model/gpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from __future__ import annotations

from numbers import Integral, Real
from typing import Callable, ClassVar, Mapping, Sequence
from typing import Callable, ClassVar, Mapping, Optional, Sequence, Union

import numpy as np
from scipy import optimize
Expand Down Expand Up @@ -153,6 +153,8 @@ class DiffusionGPR(GaussianProcessRegressor):
"""

optimizer: Optional[Union[StrOptions, Callable, None]] = None

_parameter_constraints: ClassVar[dict] = {
"kernel": [None, Kernel],
"alpha": [Interval(Real, 0, None, closed="left"), np.ndarray],
Expand Down

0 comments on commit 363c6e8

Please sign in to comment.