Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python] Migrate to f-strings in python-package/lightgbm/sklearn.py #4188
[python] Migrate to f-strings in python-package/lightgbm/sklearn.py #4188
Changes from 1 commit
76c51de
14f2b7e
dadcd8a
66ea376
3a449e5
3795edc
7c5836c
70c677d
968825b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the following lines within this PR as well
LightGBM/python-package/lightgbm/sklearn.py
Lines 535 to 536 in 211ef78
LightGBM/python-package/lightgbm/sklearn.py
Lines 997 to 998 in 211ef78
' ' * x
)LightGBM/python-package/lightgbm/sklearn.py
Line 655 in 211ef78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StrikerRUS do I only change the
' '*x
part or do I also modify the concatenation taking place there into an f-string as below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I thought about only
' '*x
part, but just saw that @jameslamb would prefer modifying concatenation as well: #4144 (comment). So, please modify it with concatenation.BTW, there are some other places where concatenation can be eliminated with f-strings:
LightGBM/python-package/lightgbm/sklearn.py
Lines 705 to 711 in 211ef78
LightGBM/python-package/lightgbm/sklearn.py
Lines 825 to 831 in 211ef78
LightGBM/python-package/lightgbm/sklearn.py
Lines 898 to 902 in 211ef78
LightGBM/python-package/lightgbm/sklearn.py
Lines 990 to 992 in 211ef78
But I don't think we should replace concatenation with f-strings there because concatenation is more readable in those cases in my opinion. @jameslamb WDYT?
Also, please check the following comment about padding #4144 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I infer that no concatenations be migrated then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, cases like the ones @StrikerRUS mentioned (where
.format()
was used to replace a shared template like_lgbmmodel_doc_fit
or where there are just variables being added to each other but not string literals) do not need to be changed for this pull request