Skip to content

Commit

Permalink
Merge pull request #3602 from harupy/enable-warn-redundant-casts
Browse files Browse the repository at this point in the history
Enable `warn_redundant_casts` for `mypy`
  • Loading branch information
toshihikoyanase committed May 31, 2022
2 parents 71d3a79 + 074b1d9 commit f56cea8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions optuna/storages/_in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from datetime import datetime
import threading
from typing import Any
from typing import cast
from typing import Container
from typing import Dict
from typing import Iterator
Expand Down Expand Up @@ -166,7 +165,7 @@ def _build_study_summary(self, study_id: int, include_best_trial: bool = True) -
n_trials=len(study.trials),
datetime_start=min(
[
cast(datetime, trial.datetime_start)
trial.datetime_start
for trial in self.get_all_trials(study_id, deepcopy=False)
if trial.datetime_start is not None
],
Expand Down
2 changes: 1 addition & 1 deletion optuna/storages/_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def _create_new_trial(
study_summary.n_trials = len(self._get_study_trials(study_id))
min_datetime_start = min(
[
cast(datetime, t.datetime_start)
t.datetime_start
for t in self.get_all_trials(study_id)
if t.datetime_start is not None
],
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ exclude = venv,build,tutorial,.tox,.asv
disallow_untyped_defs = True
ignore_missing_imports = True
no_implicit_optional = True
warn_redundant_casts = True
exclude = venv|build|docs|tutorial|optuna/storages/_rdb/alembic

0 comments on commit f56cea8

Please sign in to comment.