Skip to content

Refactor/fstring storage rdb#6336

Merged
not522 merged 6 commits intooptuna:masterfrom
gadmin7:refactor/fstring-storage-rdb
Nov 12, 2025
Merged

Refactor/fstring storage rdb#6336
not522 merged 6 commits intooptuna:masterfrom
gadmin7:refactor/fstring-storage-rdb

Conversation

@gadmin7
Copy link
Copy Markdown
Contributor

@gadmin7 gadmin7 commented Nov 11, 2025

Motivation

This PR addresses Issue #6305 by refactoring string formatting in optuna/storages/_rdb/storage.py.

Description of the changes

This PR implements the following changes in optuna/storages/_rdb/storage.py: Replaced all instances of the .format(...) method with modern f-strings. Utilized the {variable!r} and {variable!s} conversion flags for exception objects (e) in logging messages to maintain the behavior of repr(e) and str(e). Utilized the {variable=} syntax where appropriate for cleaner variable name/value logging in messages.

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.

Thank you for your PR!
Triple double quotes include indexing whitespace into the string, so please use regular strings instead.

@not522 not522 self-assigned this Nov 12, 2025
gadmin7 and others added 4 commits November 12, 2025 10:48
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
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 added the code-fix Change that does not change the behavior, such as code refactoring. label Nov 12, 2025
@not522 not522 added this to the v4.7.0 milestone Nov 12, 2025
@not522 not522 merged commit df6fb3c into optuna:master Nov 12, 2025
12 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