Skip to content

Use TYPE_CHECKING for import in pruners/_hyperband.py - #6447

Merged
not522 merged 1 commit into
optuna:masterfrom
yasumorishima:type-checking-hyperband
Feb 16, 2026
Merged

not522 merged 1 commit into
optuna:masterfrom
yasumorishima:type-checking-hyperband

Conversation

@yasumorishima

Copy link
Copy Markdown
Contributor

Summary

Part of #6029

Move collections.abc.Container import under if TYPE_CHECKING: guard in optuna/pruners/_hyperband.py to prevent unnecessary runtime import.

Changes

  • Add from typing import TYPE_CHECKING
  • Move from collections.abc import Container under if TYPE_CHECKING: block
  • from __future__ import annotations was already present

yasumorishima added a commit to yasumorishima/oss-contributions that referenced this pull request Feb 14, 2026
- scripts/record_pr.py: Record individual PRs or --refresh all statuses
- config.json: Project metadata (language, description)
- .github/workflows/refresh-contributions.yml: Manual workflow_dispatch refresh
- Record new PR: optuna/optuna#6447 (TYPE_CHECKING for _hyperband.py)

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@not522 not522 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!

@not522 not522 added the code-fix Change that does not change the behavior, such as code refactoring. label Feb 16, 2026
@not522 not522 added this to the v4.8.0 milestone Feb 16, 2026
@not522
not522 merged commit 33ced97 into optuna:master Feb 16, 2026
13 checks passed
@yasumorishima
yasumorishima deleted the type-checking-hyperband branch February 18, 2026 08:02
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