[refactor] moves the codebase to python3 and applies code quality tools
this massive commit moves the codebase to Python 3.7 and configures/applies flake8,black,mypy,pytypes. As a result, various bugs have been catched statically. The code passes pytype inference and is ready for type annotations. This corresponds to the addition of these tools to the CI.
Showing with 1352 additions and 1505 deletions