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
@@ -107,22 +107,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
107107#
108108
109109
110- def _determine_local_import_names (start_dir : str ) -> List [str ]:
111- """Determines all import names that should be considered "local".
112-
113- This is used when running the linter to insure that import order is
114- properly checked.
115- """
116- file_ext_pairs = [os .path .splitext (path ) for path in os .listdir (start_dir )]
117- return [
118- basename
119- for basename , extension in file_ext_pairs
120- if extension == ".py"
121- or os .path .isdir (os .path .join (start_dir , basename ))
122- and basename not in ("__pycache__" )
123- ]
124-
125-
126110# Linting with flake8.
127111#
128112# We ignore the following rules:
@@ -137,7 +121,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
137121 "--show-source" ,
138122 "--builtin=gettext" ,
139123 "--max-complexity=20" ,
140- "--import-order-style=google" ,
141124 "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py" ,
142125 "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202" ,
143126 "--max-line-length=88" ,
@@ -147,14 +130,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
147130@nox .session
148131def lint (session : nox .sessions .Session ) -> None :
149132 if not TEST_CONFIG ["enforce_type_hints" ]:
150- session .install ("flake8" , "flake8-import-order" )
133+ session .install ("flake8" )
151134 else :
152- session .install ("flake8" , "flake8-import-order" , "flake8- annotations" )
135+ session .install ("flake8" , "flake8-annotations" )
153136
154- local_names = _determine_local_import_names ("." )
155137 args = FLAKE8_COMMON_ARGS + [
156- "--application-import-names" ,
157- "," .join (local_names ),
158138 "." ,
159139 ]
160140 session .run ("flake8" , * args )
0 commit comments