Skip to content

Move application import to TYPE_CHECKING in pruners/_successive_halving.py#6503

Merged
not522 merged 1 commit intooptuna:masterfrom
nightcityblade:fix/issue-6029-successive-halving
Mar 10, 2026
Merged

Move application import to TYPE_CHECKING in pruners/_successive_halving.py#6503
not522 merged 1 commit intooptuna:masterfrom
nightcityblade:fix/issue-6029-successive-halving

Conversation

@nightcityblade
Copy link
Copy Markdown

Motivation

Part of #6029. Moves the import optuna statement into a TYPE_CHECKING block in optuna/pruners/_successive_halving.py, since it is only used for type annotations.

Description of the changes

  • Moved import optuna into if TYPE_CHECKING: block
  • Added from typing import TYPE_CHECKING
  • Ran ruff check --select TCH to verify the fix
  • All 16 tests in tests/pruners_tests/test_successive_halving.py pass

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 Move application import to TYPE_CHECKING in pruners/_successive_halving.py Move application import to TYPE_CHECKING in pruners/_successive_halving.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 enabled auto-merge March 10, 2026 00:07
@not522 not522 merged commit e5cf46f 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