Use f-strings in optuna/samplers/_cmaes.py#6331
Conversation
c-bata
left a comment
There was a problem hiding this comment.
Thank you for your pull requests. I have two requests:
- Could you write the description?
- Please do not replace
_deprecated._DEPRECATION_WARNING_TEMPLATEand_INDEPENDENT_SAMPLING_WARNING_TEMPLATEwith f-strings.
Thank you for the feedback! |
optuna/samplers/_cmaes.py
optuna/samplers/_cmaes.py
Outdated
| ) -> bool: | ||
| intersection_size = len(set(trans._search_space.keys()).intersection(search_space.keys())) | ||
| return intersection_size == len(trans._search_space) == len(search_space) | ||
| return intersection_size == len(trans._search_space) == len(search_space) No newline at end of file |
There was a problem hiding this comment.
Thank you for update! Could you revert the final newline in the file?
There was a problem hiding this comment.
Thank you for the feedback! I have restored the final newline at the end of the file. Please let me know if any further changes are needed.
c-bata
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the update!
Motivation
Description of the changes
Summary:
This PR refactors parts of optuna/samplers/_cmaes.py to use f-strings for improved readability and consistency.
Changes:
Replaced .format() calls with f-strings.
Used {var_name=} style where applicable for clearer variable output.
Updated _logger.warning calls to use f-strings with intermediate variable (ind_sampler_name).