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