@@ -18,7 +18,7 @@ import glob
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
@@ -109,22 +109,6 @@ nox.options.error_on_missing_interpreters = True
109109#
110110
111111
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-
128112# Linting with flake8.
129113#
130114# We ignore the following rules:
@@ -139,7 +123,6 @@ FLAKE8_COMMON_ARGS = [
139123 "--show-source",
140124 "--builtin=gettext",
141125 "--max-complexity=20",
142- "--import-order-style=google",
143126 "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
144127 "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
145128 "--max-line-length=88",
@@ -149,14 +132,11 @@ FLAKE8_COMMON_ARGS = [
149132@nox.session
150133def lint(session: nox.sessions.Session) -> None:
151134 if not TEST_CONFIG["enforce_type_hints"]:
152- session.install("flake8", "flake8-import-order" )
135+ session.install("flake8")
153136 else:
154- session.install("flake8", "flake8-import-order", "flake8- annotations")
137+ session.install("flake8", "flake8-annotations")
155138
156- local_names = _determine_local_import_names(".")
157139 args = FLAKE8_COMMON_ARGS + [
158- "--application-import-names",
159- ",".join(local_names),
160140 ".",
161141 ]
162142 session.run("flake8", *args)
0 commit comments