Skip to content
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

Use f-strings where sensible #783

Merged
merged 1 commit into from
Jan 1, 2024
Merged

Use f-strings where sensible #783

merged 1 commit into from
Jan 1, 2024

Conversation

akx
Copy link
Contributor

@akx akx commented Dec 25, 2023

This PR replaces various string formatting operations with Python 3.6+ f-strings, for performance and brevity.

Guided by Flynt and Ruff's relevant lints, checked by hand.

@cclauss
Copy link
Contributor

cclauss commented Dec 26, 2023

Do ruff EM rules object to some of these uses?

@akx
Copy link
Contributor Author

akx commented Dec 26, 2023

@cclauss Not any more than they would with other formatting. I don't really agree with the EM rules because they make the code longer and more cumbersome to read. Henry's point is

If this is longer or more complex, the duplication can be quite confusing for a user unaccustomed to reading tracebacks.

and I would assume people who use MQTT should be accustomed to reading tracebacks.

@cclauss
Copy link
Contributor

cclauss commented Dec 31, 2023

@akx git conflicts here.

@akx
Copy link
Contributor Author

akx commented Dec 31, 2023

@cclauss Thanks, rebased.

@PierreF PierreF merged commit 6be31e5 into eclipse-paho:master Jan 1, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants