beets icon indicating copy to clipboard operation
beets copied to clipboard

Replace most `str.format()` uses with f-strings

Open bal-e opened this issue 1 year ago • 6 comments

Fixes #5293.

Along the way, I've made some small code improvements beyond just the use of f-strings; I don't think these will conflict with others' work. In particular, I've avoided modifying the formatting of paths; there is work to greatly simplify that using 'pathlib', at which point a second commit can clean them up.

bal-e avatar Jun 26 '24 20:06 bal-e

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

github-actions[bot] avatar Jun 26 '24 20:06 github-actions[bot]

Thank you for the monster commit. Hopefully you had automation to aid you. I only looked at the first few chunks (about as far as my final comment) but it passes the smell test.

I would prefer having the SQL changes in their own commit. Anything with SQL should probably have more attention on it than an f-string.

RollingStar avatar Jun 26 '24 21:06 RollingStar

Thank you for the monster commit. Hopefully you had automation to aid you. I only looked at the first few chunks (about as far as my final comment) but it passes the smell test.

Thanks for reviewing! This is a pretty big change and I am worried I slipped up somewhere, so I'm happy to hang on to the PR until somebody can look at the full diff. PyCharm helped me find the usages of str.format() but I modified them by hand.

I would prefer having the SQL changes in their own commit. Anything with SQL should probably have more attention on it than an f-string.

That's understandable, messing with SQL can be dangerous. The tests pass, which I hope adds some degree of confidence to these changes. I haven't fundamentally changed any SQL statements, though -- they should operate exactly the same as before. I can refactor them out to a separate commit, but I think that should wait until somebody reviews the entire diff.

bal-e avatar Jun 26 '24 22:06 bal-e

I'll review the entire diff and get back to you.

Serene-Arc avatar Jun 27 '24 03:06 Serene-Arc

@Serene-Arc, I think the primary remaining blocker is a thorough review of the SQL function change. I've fixed the URL formatting and the "title, article" implementation as well. Don't worry if you're on vacation, but I hope you're able to get to it soon.

bal-e avatar Jul 26 '24 23:07 bal-e

@bal-e I'll try and do it over the next day or two! The PR is looking pretty good though.

Serene-Arc avatar Jul 27 '24 00:07 Serene-Arc

Accidentally stumbled upon something relevant: https://github.com/beetbox/beets/issues/1044

snejus avatar Jan 26 '25 21:01 snejus

Superseded by #5890

snejus avatar Aug 30 '25 22:08 snejus