Skip to content

Commit a0c075f

Browse files
committed
style(ci): reformat noxfile with black to fix lint errors
1 parent 8ccfb28 commit a0c075f

291 files changed

Lines changed: 2317 additions & 743 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/bigframes/noxfile.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,20 +1097,38 @@ def mypy(session):
10971097
@nox.session(python="3.15")
10981098
def import_profile(session):
10991099
"""Ensure import times remain below defined thresholds."""
1100-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1100+
profiler_script = (
1101+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1102+
)
11011103
if not profiler_script.exists():
11021104
session.skip("The import profiler script was not found.")
11031105

11041106
session.install(".")
1105-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
1107+
session.run(
1108+
"python",
1109+
str(profiler_script),
1110+
"--module",
1111+
"unknown_module",
1112+
"--iterations",
1113+
"10",
1114+
)
11061115

11071116

11081117
@nox.session(python="3.15")
11091118
def import_profile(session):
11101119
"""Ensure import times remain below defined thresholds."""
1111-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1120+
profiler_script = (
1121+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1122+
)
11121123
if not profiler_script.exists():
11131124
session.skip("The import profiler script was not found.")
11141125

11151126
session.install(".")
1116-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
1127+
session.run(
1128+
"python",
1129+
str(profiler_script),
1130+
"--module",
1131+
"unknown_module",
1132+
"--iterations",
1133+
"10",
1134+
)

packages/bigquery-magics/noxfile.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,20 +551,38 @@ def mypy(session):
551551
@nox.session(python="3.15")
552552
def import_profile(session):
553553
"""Ensure import times remain below defined thresholds."""
554-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
554+
profiler_script = (
555+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
556+
)
555557
if not profiler_script.exists():
556558
session.skip("The import profiler script was not found.")
557559

558560
session.install(".")
559-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
561+
session.run(
562+
"python",
563+
str(profiler_script),
564+
"--module",
565+
"unknown_module",
566+
"--iterations",
567+
"10",
568+
)
560569

561570

562571
@nox.session(python="3.15")
563572
def import_profile(session):
564573
"""Ensure import times remain below defined thresholds."""
565-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
574+
profiler_script = (
575+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
576+
)
566577
if not profiler_script.exists():
567578
session.skip("The import profiler script was not found.")
568579

569580
session.install(".")
570-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
581+
session.run(
582+
"python",
583+
str(profiler_script),
584+
"--module",
585+
"unknown_module",
586+
"--iterations",
587+
"10",
588+
)

packages/db-dtypes/noxfile.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,20 +552,28 @@ def mypy(session):
552552
@nox.session(python="3.15")
553553
def import_profile(session):
554554
"""Ensure import times remain below defined thresholds."""
555-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
555+
profiler_script = (
556+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
557+
)
556558
if not profiler_script.exists():
557559
session.skip("The import profiler script was not found.")
558560

559561
session.install(".")
560-
session.run("python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10")
562+
session.run(
563+
"python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10"
564+
)
561565

562566

563567
@nox.session(python="3.15")
564568
def import_profile(session):
565569
"""Ensure import times remain below defined thresholds."""
566-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
570+
profiler_script = (
571+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
572+
)
567573
if not profiler_script.exists():
568574
session.skip("The import profiler script was not found.")
569575

570576
session.install(".")
571-
session.run("python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10")
577+
session.run(
578+
"python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10"
579+
)

packages/django-google-spanner/noxfile.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,20 +496,38 @@ def format(session: nox.sessions.Session) -> None:
496496
@nox.session(python="3.15")
497497
def import_profile(session):
498498
"""Ensure import times remain below defined thresholds."""
499-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
499+
profiler_script = (
500+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
501+
)
500502
if not profiler_script.exists():
501503
session.skip("The import profiler script was not found.")
502504

503505
session.install(".")
504-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
506+
session.run(
507+
"python",
508+
str(profiler_script),
509+
"--module",
510+
"unknown_module",
511+
"--iterations",
512+
"10",
513+
)
505514

506515

507516
@nox.session(python="3.15")
508517
def import_profile(session):
509518
"""Ensure import times remain below defined thresholds."""
510-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
519+
profiler_script = (
520+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
521+
)
511522
if not profiler_script.exists():
512523
session.skip("The import profiler script was not found.")
513524

514525
session.install(".")
515-
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
526+
session.run(
527+
"python",
528+
str(profiler_script),
529+
"--module",
530+
"unknown_module",
531+
"--iterations",
532+
"10",
533+
)

packages/gapic-generator/gapic/templates/noxfile.py.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,20 @@ def core_deps_from_source(session, protobuf_implementation):
647647
@nox.session(python="3.15")
648648
def import_profile(session):
649649
"""Ensure import times remain below defined thresholds."""
650-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
650+
profiler_script = (
651+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
652+
)
651653
if not profiler_script.exists():
652654
session.skip("The import profiler script was not found.")
653655

654656
session.install(".")
655657
{% if api.naming.module_namespace %}
656-
session.run("python", str(profiler_script), "--module", "{{ api.naming.module_namespace[0] }}", "--iterations", "10")
658+
session.run(
659+
"python", str(profiler_script), "--module", "{{ api.naming.module_namespace[0] }}", "--iterations", "10"
660+
)
657661
{% else %}
658-
session.run("python", str(profiler_script), "--module", "{{ api.naming.versioned_module_name }}", "--iterations", "10")
662+
session.run(
663+
"python", str(profiler_script), "--module", "{{ api.naming.versioned_module_name }}", "--iterations", "10"
664+
)
659665
{% endif %}
660666
{% endblock %}

packages/gapic-generator/noxfile.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def lint(session):
726726
"""
727727

728728
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
729-
# SKIP: This session was not enforced in the standalone (split) repo
729+
# SKIP: This session was not enforced in the standalone (split) repo
730730
# and is disabled here to ensure a "move-only" migration.
731731
session.skip(
732732
"Linting was not enforced in the split repo. "
@@ -756,9 +756,11 @@ def lint(session):
756756
@nox.session(python=NEWEST_PYTHON)
757757
def lint_setup_py(session):
758758
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
759-
# SKIP: This session was not enforced in the standalone (split) repo
759+
# SKIP: This session was not enforced in the standalone (split) repo
760760
# and is disabled here to ensure a "move-only" migration.
761-
session.skip("Skipping now to avoid changing code during migration. See Issue #16186")
761+
session.skip(
762+
"Skipping now to avoid changing code during migration. See Issue #16186"
763+
)
762764

763765

764766
@nox.session(python="3.10")
@@ -833,9 +835,11 @@ def prerelease_deps(session, protobuf_implementation):
833835
"""
834836
Run all tests with pre-release versions of dependencies installed.
835837
"""
836-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
838+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
837839
# Implement pre-release dependency logic to test against upcoming runtime changes.
838-
session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.")
840+
session.skip(
841+
"prerelease_deps session is not yet implemented for gapic-generator-python."
842+
)
839843

840844

841845
@nox.session(python=NEWEST_PYTHON)
@@ -845,27 +849,38 @@ def prerelease_deps(session, protobuf_implementation):
845849
)
846850
def core_deps_from_source(session, protobuf_implementation):
847851
"""Run all tests with core dependencies installed from source."""
848-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
852+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
849853
# Implement logic to install core packages directly from the mono-repo directories.
850-
session.skip("core_deps_from_source session is not yet implemented for gapic-generator-python.")
854+
session.skip(
855+
"core_deps_from_source session is not yet implemented for gapic-generator-python."
856+
)
857+
851858

852859
@nox.session(python="3.15")
853860
def import_profile(session):
854861
"""Ensure import times remain below defined thresholds."""
855-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
862+
profiler_script = (
863+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
864+
)
856865
if not profiler_script.exists():
857866
session.skip("The import profiler script was not found.")
858867

859868
session.install(".")
860-
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")
869+
session.run(
870+
"python", str(profiler_script), "--module", "google", "--iterations", "10"
871+
)
861872

862873

863874
@nox.session(python="3.15")
864875
def import_profile(session):
865876
"""Ensure import times remain below defined thresholds."""
866-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
877+
profiler_script = (
878+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
879+
)
867880
if not profiler_script.exists():
868881
session.skip("The import profiler script was not found.")
869882

870883
session.install(".")
871-
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")
884+
session.run(
885+
"python", str(profiler_script), "--module", "google", "--iterations", "10"
886+
)

packages/gapic-generator/tests/integration/goldens/asset/noxfile.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@
4848
# Path to the centralized mypy configuration file at the repository root.
4949
# Search upwards to support running nox from both monorepo packages and integration test goldens.
5050
MYPY_CONFIG_FILE = next(
51-
(str(p / "mypy.ini") for p in CURRENT_DIRECTORY.parents if (p / "mypy.ini").exists()),
51+
(
52+
str(p / "mypy.ini")
53+
for p in CURRENT_DIRECTORY.parents
54+
if (p / "mypy.ini").exists()
55+
),
5256
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
5357
)
5458

@@ -164,7 +168,8 @@ def lint(session):
164168

165169
# 2. Check formatting
166170
session.run(
167-
"ruff", "format",
171+
"ruff",
172+
"format",
168173
"--check",
169174
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
170175
"--line-length=88",
@@ -177,12 +182,15 @@ def lint(session):
177182
@nox.session(python=DEFAULT_PYTHON_VERSION)
178183
def blacken(session):
179184
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
180-
session.log("WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future.")
185+
session.log(
186+
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
187+
)
181188

182189
# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
183190
session.install(RUFF_VERSION)
184191
session.run(
185-
"ruff", "format",
192+
"ruff",
193+
"format",
186194
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
187195
"--line-length=88",
188196
*LINT_PATHS,
@@ -201,8 +209,10 @@ def format(session):
201209
# check --select I: Enables strict import sorting
202210
# --fix: Applies the changes automatically
203211
session.run(
204-
"ruff", "check",
205-
"--select", "I",
212+
"ruff",
213+
"check",
214+
"--select",
215+
"I",
206216
"--fix",
207217
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
208218
"--line-length=88", # Standard Black line length
@@ -211,7 +221,8 @@ def format(session):
211221

212222
# 3. Run Ruff to format code
213223
session.run(
214-
"ruff", "format",
224+
"ruff",
225+
"format",
215226
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
216227
"--line-length=88", # Standard Black line length
217228
*LINT_PATHS,
@@ -396,8 +407,10 @@ def docs(session):
396407
"sphinx-build",
397408
"-T", # show full traceback on exception
398409
"-N", # no colors
399-
"-b", "html", # builder
400-
"-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory
410+
"-b",
411+
"html", # builder
412+
"-d",
413+
os.path.join("docs", "_build", "doctrees", ""), # cache directory
401414
# paths to build:
402415
os.path.join("docs", ""),
403416
os.path.join("docs", "_build", "html", ""),
@@ -511,8 +524,7 @@ def prerelease_deps(session, protobuf_implementation):
511524
# Extract the base package name, safely ignoring version bounds and spaces
512525
# (e.g., "grpcio>=1.75.1" becomes "grpcio")
513526
parsed_deps = {
514-
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1)
515-
for dep in prerel_deps
527+
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1) for dep in prerel_deps
516528
}
517529

518530
# Dynamically sort local packages vs PyPI dependencies
@@ -625,7 +637,9 @@ def core_deps_from_source(session, protobuf_implementation):
625637
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]
626638

627639
session.install(*dep_paths, "--no-deps", "--ignore-installed")
628-
print(f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}")
640+
print(
641+
f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}"
642+
)
629643

630644
session.run(
631645
"py.test",
@@ -639,9 +653,13 @@ def core_deps_from_source(session, protobuf_implementation):
639653
@nox.session(python="3.15")
640654
def import_profile(session):
641655
"""Ensure import times remain below defined thresholds."""
642-
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
656+
profiler_script = (
657+
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
658+
)
643659
if not profiler_script.exists():
644660
session.skip("The import profiler script was not found.")
645661

646662
session.install(".")
647-
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")
663+
session.run(
664+
"python", str(profiler_script), "--module", "google", "--iterations", "10"
665+
)

0 commit comments

Comments
 (0)