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

Fix / consistent usage of f-strings #538

Merged

Conversation

riccardoporreca
Copy link
Contributor

Follow-up from #526

  • Fix missing f for massage strings with placeholders otherwise unresolved.
  • Favor f-strings over .format() when sensible to do so.
  • Replace %-formatting with f-strings.

* Fix missing `f` for massage strings with placeholders otherwise unresolved.
* Favor f-strings over `.format()` when sensible to do so.
* Follow-up from mamba-org#526.
quetz/jobs/runner.py Outdated Show resolved Hide resolved
@baszalmstra
Copy link
Contributor

You could also consider running: https://github.com/asottile/pyupgrade

But that won't catch the many errors you fixed as well! :)

Co-authored-by: Bas Zalmstra <[email protected]>
@wolfv wolfv added the enhancement New feature or request label Jun 1, 2022
@riccardoporreca
Copy link
Contributor Author

I have actually found and used a flake8 plugin https://pypi.org/project/flake8-use-fstring/ to easily spot % and .format().

@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2022

Codecov Report

Merging #538 (bf69d64) into main (d63e2f1) will decrease coverage by 1.10%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
- Coverage   83.11%   82.01%   -1.11%     
==========================================
  Files          78       78              
  Lines        5936     5977      +41     
==========================================
- Hits         4934     4902      -32     
- Misses       1002     1075      +73     
Impacted Files Coverage Δ
quetz/authentication/auth_dao.py 90.00% <ø> (ø)
quetz/database_extensions.py 60.00% <ø> (ø)
quetz/db_models.py 96.89% <ø> (ø)
quetz/main.py 86.70% <ø> (-2.29%) ⬇️
quetz/tasks/reindexing.py 83.67% <ø> (ø)
quetz/versionorder.py 95.49% <0.00%> (ø)
quetz/authentication/jupyterhub.py 91.93% <100.00%> (ø)
quetz/dao.py 91.08% <100.00%> (ø)
quetz/jobs/runner.py 90.47% <100.00%> (ø)
quetz/tasks/indexing.py 92.10% <100.00%> (+0.32%) ⬆️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@riccardoporreca
Copy link
Contributor Author

@wolfv, @baszalmstra, I am coming back to this: I have included the flake8-use-fstring plugin and changed an additional occurrence of .format.
I have checked whether the main branch might have introduced meanwhile similar issue with unresolved placeholders (not detectable by the plugin) and could not find any such instance.

@wolfv wolfv merged commit 41a5ec2 into mamba-org:main Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants