18
18
import os
19
19
from pathlib import Path
20
20
import sys
21
- from typing import Callable , Dict , List , Optional
21
+ from typing import Callable , Dict , Optional
22
22
23
23
import nox
24
24
@@ -108,22 +108,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
108
108
#
109
109
110
110
111
- def _determine_local_import_names (start_dir : str ) -> List [str ]:
112
- """Determines all import names that should be considered "local".
113
-
114
- This is used when running the linter to insure that import order is
115
- properly checked.
116
- """
117
- file_ext_pairs = [os .path .splitext (path ) for path in os .listdir (start_dir )]
118
- return [
119
- basename
120
- for basename , extension in file_ext_pairs
121
- if extension == ".py"
122
- or os .path .isdir (os .path .join (start_dir , basename ))
123
- and basename not in ("__pycache__" )
124
- ]
125
-
126
-
127
111
# Linting with flake8.
128
112
#
129
113
# We ignore the following rules:
@@ -138,7 +122,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
138
122
"--show-source" ,
139
123
"--builtin=gettext" ,
140
124
"--max-complexity=20" ,
141
- "--import-order-style=google" ,
142
125
"--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py" ,
143
126
"--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202" ,
144
127
"--max-line-length=88" ,
@@ -148,14 +131,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
148
131
@nox .session
149
132
def lint (session : nox .sessions .Session ) -> None :
150
133
if not TEST_CONFIG ["enforce_type_hints" ]:
151
- session .install ("flake8" , "flake8-import-order" )
134
+ session .install ("flake8" )
152
135
else :
153
- session .install ("flake8" , "flake8-import-order" , "flake8- annotations" )
136
+ session .install ("flake8" , "flake8-annotations" )
154
137
155
- local_names = _determine_local_import_names ("." )
156
138
args = FLAKE8_COMMON_ARGS + [
157
- "--application-import-names" ,
158
- "," .join (local_names ),
159
139
"." ,
160
140
]
161
141
session .run ("flake8" , * args )
0 commit comments