diff --git a/docker/optuna_example.py b/docker/optuna_example.py index 3b75e90c..66cda2df 100644 --- a/docker/optuna_example.py +++ b/docker/optuna_example.py @@ -6,7 +6,7 @@ import optuna def objective(trial): x = trial.suggest_float("x", -100, 100) y = trial.suggest_categorical("y", [-1, 0, 1]) - return x ** 2 + y + return x**2 + y if __name__ == "__main__": diff --git a/optuna_dashboard/app.py b/optuna_dashboard/app.py index a320de63..70094be5 100644 --- a/optuna_dashboard/app.py +++ b/optuna_dashboard/app.py @@ -27,8 +27,8 @@ from bottle import static_file import optuna from optuna.exceptions import DuplicatedStudyError from optuna.storages import BaseStorage -from optuna.storages import RedisStorage from optuna.storages import RDBStorage +from optuna.storages import RedisStorage from optuna.study import Study from optuna.study import StudyDirection from optuna.study import StudySummary @@ -38,6 +38,7 @@ from optuna.trial import TrialState from . import serializer from .search_space import get_search_space + if typing.TYPE_CHECKING: from _typeshed.wsgi import WSGIApplication diff --git a/python_tests/wsgi_client.py b/python_tests/wsgi_client.py index d3170e6a..2a0a860a 100644 --- a/python_tests/wsgi_client.py +++ b/python_tests/wsgi_client.py @@ -8,6 +8,7 @@ from typing import Union from bottle import Bottle + if typing.TYPE_CHECKING: from _typeshed.wsgi import WSGIEnvironment diff --git a/visual_regression_test.py b/visual_regression_test.py index 6e01881b..2da2ab31 100644 --- a/visual_regression_test.py +++ b/visual_regression_test.py @@ -94,7 +94,7 @@ def create_dummy_storage() -> optuna.storages.InMemoryStorage: def objective_multi(trial: optuna.Trial) -> Tuple[float, float]: x = trial.suggest_float("x", 0, 5) y = trial.suggest_float("y", 0, 3) - v0 = 4 * x ** 2 + 4 * y ** 2 + v0 = 4 * x**2 + 4 * y**2 v1 = (x - 5) ** 2 + (y - 5) ** 2 return v0, v1 @@ -110,13 +110,13 @@ def create_dummy_storage() -> optuna.storages.InMemoryStorage: if category == "foo": x = trial.suggest_float("x1", 0, 5) y = trial.suggest_float("y1", 0, 3) - v0 = 4 * x ** 2 + 4 * y ** 2 + v0 = 4 * x**2 + 4 * y**2 v1 = (x - 5) ** 2 + (y - 5) ** 2 return v0, v1 else: x = trial.suggest_float("x2", 0, 5) y = trial.suggest_float("y2", 0, 3) - v0 = 2 * x ** 2 + 2 * y ** 2 + v0 = 2 * x**2 + 2 * y**2 v1 = (x - 2) ** 2 + (y - 3) ** 2 return v0, v1 @@ -130,7 +130,7 @@ def create_dummy_storage() -> optuna.storages.InMemoryStorage: def objective_prune_without_report(trial: optuna.Trial) -> float: x = trial.suggest_float("x", -15, 30) y = trial.suggest_float("y", -15, 30) - v = x ** 2 + y ** 2 + v = x**2 + y**2 if v > 100: raise optuna.TrialPruned() return v