From 5cfdedbf49d705ab333fafb35ab47e62f5e70c8a Mon Sep 17 00:00:00 2001 From: c-bata Date: Thu, 26 Jan 2023 18:43:16 +0900 Subject: [PATCH] Fix lint errors --- optuna_dashboard/_objective_form_widget.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/optuna_dashboard/_objective_form_widget.py b/optuna_dashboard/_objective_form_widget.py index 9b0d0df4..0b89e618 100644 --- a/optuna_dashboard/_objective_form_widget.py +++ b/optuna_dashboard/_objective_form_widget.py @@ -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(