1818import os
1919from pathlib import Path
2020import sys
21- from typing import Callable , Dict , List , Optional
21+ from typing import Callable , Dict , Optional
2222
2323import nox
2424
@@ -108,22 +108,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
108108#
109109
110110
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-
127111# Linting with flake8.
128112#
129113# We ignore the following rules:
@@ -138,7 +122,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
138122 "--show-source" ,
139123 "--builtin=gettext" ,
140124 "--max-complexity=20" ,
141- "--import-order-style=google" ,
142125 "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py" ,
143126 "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202" ,
144127 "--max-line-length=88" ,
@@ -148,14 +131,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
148131@nox .session
149132def lint (session : nox .sessions .Session ) -> None :
150133 if not TEST_CONFIG ["enforce_type_hints" ]:
151- session .install ("flake8" , "flake8-import-order" )
134+ session .install ("flake8" )
152135 else :
153- session .install ("flake8" , "flake8-import-order" , "flake8- annotations" )
136+ session .install ("flake8" , "flake8-annotations" )
154137
155- local_names = _determine_local_import_names ("." )
156138 args = FLAKE8_COMMON_ARGS + [
157- "--application-import-names" ,
158- "," .join (local_names ),
159139 "." ,
160140 ]
161141 session .run ("flake8" , * args )
0 commit comments