Skip to content

Use TYPE_CHECKING in samplers/_cmaes.py - #6516

Merged
c-bata merged 1 commit into
optuna:masterfrom
saivedant169:refactor/type-checking-cmaes-sampler
Mar 17, 2026
Merged

c-bata merged 1 commit into
optuna:masterfrom
saivedant169:refactor/type-checking-cmaes-sampler

Conversation

@saivedant169

Copy link
Copy Markdown
Contributor

Motivation

Part of #6029.

Description

  • Move collections.abc.Sequence into TYPE_CHECKING block — only used in type annotation at line 635 (TC003)
  • Add quotes to float in cast("float", t.value) expression (TC006)

ruff check --select TCH passes clean after the change.

- Move collections.abc.Sequence into TYPE_CHECKING block (TC003)
- Add quotes to float in cast() expression (TC006)

Part of optuna#6029
@c-bata c-bata added the code-fix Change that does not change the behavior, such as code refactoring. label Mar 17, 2026
@c-bata c-bata added this to the v4.9.0 milestone Mar 17, 2026

@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.

@c-bata
c-bata merged commit 4a73bad into optuna:master Mar 17, 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