Skip to content

Move optuna import to TYPE_CHECKING in pruners/_patient.py#6501

Merged
not522 merged 2 commits intooptuna:masterfrom
yasumorishima:fix/tch-pruners-patient-py
Mar 10, 2026
Merged

Move optuna import to TYPE_CHECKING in pruners/_patient.py#6501
not522 merged 2 commits intooptuna:masterfrom
yasumorishima:fix/tch-pruners-patient-py

Conversation

@yasumorishima
Copy link
Copy Markdown
Contributor

Part of #6029

Moves import optuna (used only in type annotations) under if TYPE_CHECKING: in optuna/pruners/_patient.py.

Also removes redundant string quotes from the prune() method signature since from __future__ import annotations is already present.

yasumorishima and others added 2 commits March 9, 2026 21:26
Part of optuna#6029

`import optuna` is only used in type annotations on the `prune()`
method signature. Move it under TYPE_CHECKING and remove redundant
string quotes (already guarded by `from __future__ import annotations`).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@not522 not522 left a comment

Choose a reason for hiding this comment

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

LGTM!

@not522 not522 changed the title fix: move optuna import to TYPE_CHECKING in pruners/_patient.py Move optuna import to TYPE_CHECKING in pruners/_patient.py Mar 10, 2026
@not522 not522 added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 10, 2026
@not522 not522 added this to the v4.8.0 milestone Mar 10, 2026
@not522 not522 merged commit d459fc0 into optuna:master Mar 10, 2026
14 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