Skip to content

Commit af67adc

Browse files
chore(python): drop flake8-import-order in samples noxfile (#156)
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 612c8a8 commit af67adc

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

.github/.OwlBot.lock.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8
16+
digest: sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

samples/snippets/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

@@ -109,22 +109,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
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 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
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 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
149132
@nox.session
150133
def 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

Comments
 (0)