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

Convert to f-strings #188

Closed
csatt opened this issue Jan 25, 2023 · 1 comment
Closed

Convert to f-strings #188

csatt opened this issue Jan 25, 2023 · 1 comment
Assignees
Labels
cosmetic Code cleanup, etc.

Comments

@csatt
Copy link
Owner

csatt commented Jan 25, 2023

The current version of pylint generates many warnings like the following:

/Users/csatt/j/IV_Swinger.py:469:19: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)

f-strings were introduced in Python 3.6 and are the currently preferred way to format strings. They are easier to read and shorter than using the older .format() string method.

All Python 3 files except the Adafruit files and myTkSimpleDialog.py should be converted to use f-strings.

csatt added a commit that referenced this issue Jan 25, 2023
All formatted strings in the six files included in this commit were converted to f-strings. Pylint now doesn't generate any "consider-using-f-string" warnings.

The conversion was assisted with the "flynt" tool. Nearly all were converted with "flynt -ll 999". Then flake8 was used to identify the lines that were >79 characters, and those were manually split onto multiple lines using string literal concatenation. There were a very small number that flynt couldn't comvert, and those were done manually.
@csatt csatt closed this as completed Jan 25, 2023
@csatt csatt reopened this Feb 5, 2023
@csatt
Copy link
Owner Author

csatt commented Feb 5, 2023

Re-opening this issue for following reasons:

  • IV_Swinger2_sim.py is broken (fails pylint and doesn't run)
  • IV_Swinger_PV_model.py and IV_Swinger2_PV_model.py have not been converted to use f-strings

csatt added a commit that referenced this issue Feb 5, 2023
Don't know how this happened. I thought I ran pylint on all the changed files. And I also thought I ran the app! Apparently not.
csatt added a commit that referenced this issue Feb 5, 2023
Somehow missed the two PV_model files in the other commit for Issue #188. Also converting a few more strings that pylint didn't catch because the .format was used after the string template was assigned to a variable.
@csatt csatt closed this as completed Feb 5, 2023
@csatt csatt self-assigned this Apr 15, 2023
@csatt csatt added the cosmetic Code cleanup, etc. label Apr 15, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmetic Code cleanup, etc.
Projects
None yet
Development

No branches or pull requests

1 participant