Skip to content

Use TYPE_CHECKING in pruners/_percentile.py - #6520

Merged
c-bata merged 1 commit into
optuna:masterfrom
saivedant169:refactor/type-checking-percentile-pruner
Mar 18, 2026
Merged

c-bata merged 1 commit into
optuna:masterfrom
saivedant169:refactor/type-checking-percentile-pruner

Conversation

@saivedant169

Copy link
Copy Markdown
Contributor

Part of #6029.

Moved KeysView and optuna into the TYPE_CHECKING block. Both are only used in type annotations and docstring examples, not at runtime. StudyDirection and TrialState stay at module level since they're used as values.

ruff check --select TCH passes clean.

Move KeysView and optuna into TYPE_CHECKING block. Both are only
used in type annotations and docstring examples, not at runtime.
StudyDirection and TrialState stay at module level since they are
used as values.

Part of optuna#6029

@c-bata c-bata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your contribution.

@c-bata c-bata added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 18, 2026
@c-bata c-bata added this to the v4.9.0 milestone Mar 18, 2026
@c-bata
c-bata merged commit 2c6efd8 into optuna:master Mar 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-fix Change that does not change the behavior, such as code refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants