Skip to content

Commit cc900ef

Browse files
chore(python): drop flake8-import-order in samples noxfile (#256)
Source-Link: googleapis/synthtool@6ed3a83 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 24017e5 commit cc900ef

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

video/transcoder/noxfile.py

+3-23
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import os
1919
from pathlib import Path
2020
import sys
21-
from typing import Callable, Dict, List, Optional
21+
from typing import Callable, Dict, Optional
2222

2323
import 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
149132
def 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

Comments
 (0)