Skip to content

Commit 1266d71

Browse files
authored
fix linting (#454)
* fix linting * please pyright * remove wrong optional
1 parent f94668c commit 1266d71

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

bofire/data_models/dataframes/dataframes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ExperimentOutputValue(OutputValue):
3636

3737

3838
class CandidateOutputValue(OutputValue):
39-
value: Optional[Value] = Field(description="The predicted value.")
39+
value: Value = Field(description="The predicted value.")
4040
standard_deviation: float
4141
objective_value: float
4242

bofire/data_models/surrogates/shape.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232

3333
class PiecewiseLinearGPSurrogateHyperconfig(Hyperconfig):
34-
type: Literal[
34+
type: Literal["PiecewiseLinearGPSurrogateHyperconfig"] = ( # type: ignore
3535
"PiecewiseLinearGPSurrogateHyperconfig"
36-
] = "PiecewiseLinearGPSurrogateHyperconfig"
36+
)
3737
inputs: Inputs = Inputs(
3838
features=[
3939
CategoricalInput(
@@ -44,9 +44,9 @@ class PiecewiseLinearGPSurrogateHyperconfig(Hyperconfig):
4444
]
4545
)
4646
target_metric: RegressionMetricsEnum = RegressionMetricsEnum.MAE
47-
hyperstrategy: Literal[
48-
"FactorialStrategy", "SoboStrategy", "RandomStrategy"
49-
] = "FactorialStrategy"
47+
hyperstrategy: Literal["FactorialStrategy", "SoboStrategy", "RandomStrategy"] = (
48+
"FactorialStrategy"
49+
)
5050

5151
@staticmethod
5252
def _update_hyperparameters(
@@ -112,7 +112,7 @@ class PiecewiseLinearGPSurrogate(TrainableBotorchSurrogate):
112112
hyperconfig: The hyperconfig that is used for training the GP.
113113
"""
114114

115-
type: Literal["PiecewiseLinearGPSurrogate"] = "PiecewiseLinearGPSurrogate"
115+
type: Literal["PiecewiseLinearGPSurrogate"] = "PiecewiseLinearGPSurrogate" # type: ignore
116116
interpolation_range: Bounds
117117
n_interpolation_points: PositiveInt = 1000
118118
x_keys: list[str]
@@ -122,7 +122,7 @@ class PiecewiseLinearGPSurrogate(TrainableBotorchSurrogate):
122122
append_x: Annotated[List[float], AfterValidator(validate_monotonically_increasing)]
123123
prepend_y: Annotated[List[float], AfterValidator(validate_monotonically_increasing)]
124124
append_y: Annotated[List[float], AfterValidator(validate_monotonically_increasing)]
125-
hyperconfig: Optional[PiecewiseLinearGPSurrogateHyperconfig] = Field(
125+
hyperconfig: Optional[PiecewiseLinearGPSurrogateHyperconfig] = Field( # type: ignore
126126
default_factory=lambda: PiecewiseLinearGPSurrogateHyperconfig()
127127
)
128128

bofire/utils/torch_tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def generator(n: int, q: int, seed: int) -> Tensor:
638638
return generator
639639

640640

641-
@torch.jit.script
641+
@torch.jit.script # type: ignore
642642
def interp1d(
643643
x: torch.Tensor,
644644
y: torch.Tensor,

0 commit comments

Comments
 (0)