-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix % in to f String #12405
fix % in to f String #12405
Conversation
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴 |
Thanks for taking a stab! There are several things that should be addressed:
|
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.
Looking at the 2 first files, I'm spotting several typos in capital letters or spacing. Could you go through your proposed changes again and fix those first?
# "Invalid parameter %s for estimator %s. " | ||
f"Invalid parameter{name}for estimator{self}" |
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.
# "Invalid parameter %s for estimator %s. " | |
f"Invalid parameter{name}for estimator{self}" | |
f"Invalid parameter {name} for estimator {self}. " |
# " %s with constructor %s doesn't " | ||
f"{cls} with constructor {init_signature} doesn't follow this convention." |
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.
# " %s with constructor %s doesn't " | |
f"{cls} with constructor {init_signature} doesn't follow this convention." | |
f" {cls} with constructor {init_signature} doesn't follow this convention." |
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.
There's also 2 spaces after "doesn't"
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.
fixed in the suggested change.
# warn("SVD error (%s), attempting to use GESVD instead of GESDD" % (exp,)) | ||
warn(f"SVD error ({exp}), attempting to use GESVD instend of GESDD") |
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.
# warn("SVD error (%s), attempting to use GESVD instead of GESDD" % (exp,)) | |
warn(f"SVD error ({exp}), attempting to use GESVD instend of GESDD") | |
warn(f"SVD error ({exp}), attempting to use GESVD instend of GESDD") |
# "Invalid parameter %s for estimator %s. " | ||
f"Invalid parameter {key}for estimator{self.__class__.__name__} for estimator" |
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.
# "Invalid parameter %s for estimator %s. " | |
f"Invalid parameter {key}for estimator{self.__class__.__name__} for estimator" | |
f"Invalid parameter {key} for estimator {self.__class__.__name__}. " |
# return "%s(%s)" % (class_name, self.__class__.__name__) | ||
return f"{class_name}({self.__class__.__name__})" |
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.
# return "%s(%s)" % (class_name, self.__class__.__name__) | |
return f"{class_name}({self.__class__.__name__})" | |
return f"{class_name}({params.read().strip()})" |
# msg = "Coil too close (dist = %g mm)" % (min_dist * 1000,) | ||
msg = f"coil too close (dist = {(min_dist * 1000,)}mm)" |
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.
This one does not remove the trailing zeroes as %g
does.
#12360
Summary:
This pull request addresses the conversion of "%" symbols into f-strings for improved readability and maintainability.
Changes Made:
Replaced "%" formatting with f-strings for string interpolation.
Updated relevant code blocks to adhere to the Python 3.6 and later syntax.
Benefits:
Enhanced code clarity: f-strings provide a more concise and readable syntax for string formatting.
Improved maintainability: The use of f-strings aligns with modern Python practices, making the codebase more up-to-date.
Testing:
Ensured that the changes do not introduce any functional issues.
Conducted thorough testing to validate the correctness of the converted f-strings.
Additional Notes:
No changes to the logic or functionality of the code, only a syntactic enhancement.
Compatible with Python 3.6 and later versions.
Please review the changes, and feel free to provide feedback or ask for further clarification if needed.