sphinx-contrib / spelling

A spelling checker for Sphinx-based documentation
https://sphinxcontrib-spelling.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
82 stars 48 forks source link

Minor code tweaks #150

Closed avylove closed 2 years ago

avylove commented 2 years ago

Just a little code cleanup, mostly around using f-strings over concatenation and using lazy evaluation for logging. Outside of string interpolation, there was an unused import, a couple unneeded return statements, and redefinition of a built-in (filter).

dhellmann commented 2 years ago

This looks good. I'm not sure the f-strings are more readable, but :shrug:. I'll take them. :-)

Needs a rebase.

avylove commented 2 years ago

Rebased. Main reason to use f-strings is they are more efficient. str.format() and concatenation are the slowest ways to do interpolation. Also switching to lazy %-strings for logging avoids interpolation unless the message is actually logged. Not that I think these make a huge difference the way this code is used, but I figured it doesn't hurt to catch them while I was already poking around.