enable flake8 testing
fix some minor flake8 errors like indentation mismatches, unused imports, etc.