refactor: upgrade code to >=python3.7 (pre-commit)

Part-of: <!2189>
11 jobs for !2189 with pre_commit_pyupgrade in 18 minutes and 20 seconds (queued for 4 minutes and 30 seconds)
latest merge request