Update from pyupgrade to --py37-plus
At DebConf, @cjwatson made the excellent suggestion of using pyupgrade
to see what could be incrementally and safely improved in this codebase. The current minimum Python version declared is 3.7, so this uses pyupgrade --py37-plus
and then a little manual tidying of now-unneeded imports from typing
.
The main changes that pyupgrade is pushing are:
- using builtin types for typing (e.g.
dict
rather thantyping.Dict
) - using
|
instead oftyping.Union
- using
| None
instead oftyping.Optional
- using f-strings in a few places
- using
.format
rather than%