mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-23 13:30:25 +08:00
Fix lint errors
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
@@ -44,7 +43,9 @@ if TYPE_CHECKING:
|
||||
{"type": Literal["text"], "description": Optional[str]},
|
||||
)
|
||||
UserAttrRefJSON = TypedDict("UserAttrRefJSON", {"type": Literal["user_attr"], "key": str})
|
||||
ObjectiveFormWidgetJSON = Union[ChoiceWidgetJSON, SliderWidgetJSON, TextInputWidgetJSON, UserAttrRefJSON]
|
||||
ObjectiveFormWidgetJSON = Union[
|
||||
ChoiceWidgetJSON, SliderWidgetJSON, TextInputWidgetJSON, UserAttrRefJSON
|
||||
]
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -103,8 +104,9 @@ class ObjectiveUserAttrRef:
|
||||
}
|
||||
|
||||
|
||||
|
||||
ObjectiveFormWidget = Union[ObjectiveChoiceWidget, ObjectiveSliderWidget, ObjectiveTextInputWidget, ObjectiveUserAttrRef]
|
||||
ObjectiveFormWidget = Union[
|
||||
ObjectiveChoiceWidget, ObjectiveSliderWidget, ObjectiveTextInputWidget, ObjectiveUserAttrRef
|
||||
]
|
||||
SYSTEM_ATTR_KEY = "dashboard:objective_form_widgets"
|
||||
|
||||
|
||||
@@ -112,7 +114,9 @@ def register_objective_form_widgets(study: optuna.Study, widgets: list[Objective
|
||||
if len(study.directions) != len(widgets):
|
||||
raise ValueError("The length of actions must be the same with the number of objectives.")
|
||||
widget_dicts = [w.to_dict() for w in widgets]
|
||||
study._storage.set_study_system_attr(study._study_id, SYSTEM_ATTR_KEY, json.dumps(widget_dicts))
|
||||
study._storage.set_study_system_attr(
|
||||
study._study_id, SYSTEM_ATTR_KEY, json.dumps(widget_dicts)
|
||||
)
|
||||
|
||||
|
||||
def get_objective_form_widgets_json(
|
||||
|
||||
Reference in New Issue
Block a user