Adopt various new language features throughout the codebase. These changes are all automated by pyupgrade, but I had to modify pyupgrade to disable a change that was incorrect (it wanted to remove a call to str.encode which was used for its side effect to avoid import deadlocks), and to split things up into multiple commits for easier review. The last commit, which converts to fstrings, required running pyupgrade in two passes.
Adopt various new language features throughout the codebase. These changes are all automated by pyupgrade, but I had to modify pyupgrade to disable a change that was incorrect (it wanted to remove a call to
str.encode
which was used for its side effect to avoid import deadlocks), and to split things up into multiple commits for easier review. The last commit, which converts to fstrings, required running pyupgrade in two passes.Closes #3391