Skip to content

Replace .format() with f-string in _fixed.py#6412

Merged
c-bata merged 1 commit intooptuna:masterfrom
VedantMadane:refactor/fstring-fixed-trial
Jan 16, 2026
Merged

Replace .format() with f-string in _fixed.py#6412
c-bata merged 1 commit intooptuna:masterfrom
VedantMadane:refactor/fstring-fixed-trial

Conversation

@VedantMadane
Copy link
Contributor

Summary

Part of #6305 - Replace .format() with f-string in optuna/trial/_fixed.py.

Changes

Converted string formatting in FixedTrial._suggest() method from .format() to f-strings:

  • Error message when parameter value is not found
  • Warning message when parameter value is out of distribution range

Test Plan

  • Existing tests should pass
  • No functional change, only formatting style

Convert string formatting to f-strings in the FixedTrial._suggest method.

Part of optuna#6305
Copy link
Member

@c-bata c-bata left a comment

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 Jan 16, 2026
@c-bata c-bata added this to the v4.7.0 milestone Jan 16, 2026
@c-bata c-bata merged commit d58b061 into optuna:master Jan 16, 2026
14 checks passed
@VedantMadane
Copy link
Contributor Author

There are still ~45 more files with .format() calls in the optuna codebase if you'd like me to continue with more?

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