Skip to content

Commit 25c34c0

Browse files
committed
pre-commit run ruff-format -a
1 parent c3925e3 commit 25c34c0

32 files changed

Lines changed: 203 additions & 154 deletions

File tree

.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ def fetch_buildkite_data(build_url):
8585
elif isinstance(jobs_data, dict) and "records" in jobs_data:
8686
data["jobs"] = jobs_data["records"]
8787
except Exception as e:
88-
print(f"Warning: Could not fetch detailed jobs from {jobs_url}: {e}", file=sys.stderr)
88+
print(
89+
f"Warning: Could not fetch detailed jobs from {jobs_url}: {e}",
90+
file=sys.stderr,
91+
)
8992

9093
return data
9194

@@ -165,15 +168,18 @@ def main():
165168

166169
build_state = data.get("state", "Unknown")
167170
print(f"Build State: {build_state}")
168-
171+
169172
jobs = data.get("jobs", [])
170173
jobs_count = data.get("statistics", {}).get("jobs_count", 0)
171-
174+
172175
print(f"Total jobs reported: {jobs_count}")
173176
print(f"Jobs found in data: {len(jobs)}")
174-
177+
175178
if jobs_count != len(jobs):
176-
print(f"WARNING: Reported job count ({jobs_count}) does not match jobs found ({len(jobs)}).", file=sys.stderr)
179+
print(
180+
f"WARNING: Reported job count ({jobs_count}) does not match jobs found ({len(jobs)}).",
181+
file=sys.stderr,
182+
)
177183

178184
print("-" * 40)
179185

examples/bzlmod/entry_points/tests/pylint_deps_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def __init__(self, *args, **kwargs):
2929

3030
def test_pylint_entry_point(self):
3131
rlocation_path = os.environ.get("ENTRY_POINT")
32-
assert (
33-
rlocation_path is not None
34-
), "expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
32+
assert rlocation_path is not None, (
33+
"expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
34+
)
3535

3636
entry_point = pathlib.Path(runfiles.Create().Rlocation(rlocation_path))
3737
self.assertTrue(entry_point.exists(), f"'{entry_point}' does not exist")
@@ -55,9 +55,9 @@ def test_pylint_entry_point(self):
5555

5656
def test_pylint_report_has_expected_warnings(self):
5757
rlocation_path = os.environ.get("PYLINT_REPORT")
58-
assert (
59-
rlocation_path is not None
60-
), "expected 'PYLINT_REPORT' env variable to be set to rlocation of the report"
58+
assert rlocation_path is not None, (
59+
"expected 'PYLINT_REPORT' env variable to be set to rlocation of the report"
60+
)
6161

6262
pylint_report = pathlib.Path(runfiles.Create().Rlocation(rlocation_path))
6363
self.assertTrue(pylint_report.exists(), f"'{pylint_report}' does not exist")

examples/bzlmod/entry_points/tests/pylint_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def __init__(self, *args, **kwargs):
2828

2929
def test_pylint_entry_point(self):
3030
rlocation_path = os.environ.get("ENTRY_POINT")
31-
assert (
32-
rlocation_path is not None
33-
), "expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
31+
assert rlocation_path is not None, (
32+
"expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
33+
)
3434

3535
entry_point = pathlib.Path(runfiles.Create().Rlocation(rlocation_path))
3636
self.assertTrue(entry_point.exists(), f"'{entry_point}' does not exist")

examples/bzlmod/entry_points/tests/yamllint_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def __init__(self, *args, **kwargs):
2828

2929
def test_yamllint_entry_point(self):
3030
rlocation_path = os.environ.get("ENTRY_POINT")
31-
assert (
32-
rlocation_path is not None
33-
), "expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
31+
assert rlocation_path is not None, (
32+
"expected 'ENTRY_POINT' env variable to be set to rlocation of the tool"
33+
)
3434

3535
entry_point = pathlib.Path(runfiles.Create().Rlocation(rlocation_path))
3636
self.assertTrue(entry_point.exists(), f"'{entry_point}' does not exist")

examples/bzlmod/tests/other_module/other_module_import_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"""Regression test for https://github.com/bazel-contrib/rules_python/issues/3563"""
2+
23
import os
34
import subprocess
45
import sys
56

7+
68
def main():
79
# The rlocation path for the bin_zipapp. It is in the "our_other_module" repository.
810
zipapp_path = os.environ.get("ZIPAPP_PATH")
@@ -18,5 +20,6 @@ def main():
1820
print(f"bin_zippapp failed with return code {result.returncode}")
1921
sys.exit(result.returncode)
2022

23+
2124
if __name__ == "__main__":
2225
main()

examples/wheel/wheel_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ def test_extra_requires(self):
566566
)
567567

568568
def test_requires_dist_depends_on_extras(self):
569-
filename = self._get_path("requires_dist_depends_on_extras-0.0.1-py3-none-any.whl")
569+
filename = self._get_path(
570+
"requires_dist_depends_on_extras-0.0.1-py3-none-any.whl"
571+
)
570572

571573
with zipfile.ZipFile(filename) as zf:
572574
self.assertAllEntriesHasReproducibleMetadata(zf)
@@ -591,7 +593,9 @@ def test_requires_dist_depends_on_extras(self):
591593
)
592594

593595
def test_requires_dist_depends_on_extras_file(self):
594-
filename = self._get_path("requires_dist_depends_on_extras_using_file-0.0.1-py3-none-any.whl")
596+
filename = self._get_path(
597+
"requires_dist_depends_on_extras_using_file-0.0.1-py3-none-any.whl"
598+
)
595599

596600
with zipfile.ZipFile(filename) as zf:
597601
self.assertAllEntriesHasReproducibleMetadata(zf)

gazelle/manifest/copy_to_source.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def copy_to_source(generated_relative_path: Path, target_relative_path: Path) ->
2020
generated_absolute_path = Path.cwd() / generated_relative_path
2121

2222
# Similarly, the target is relative to the source directory.
23-
target_absolute_path = os.environ["BUILD_WORKSPACE_DIRECTORY"] / target_relative_path
23+
target_absolute_path = (
24+
os.environ["BUILD_WORKSPACE_DIRECTORY"] / target_relative_path
25+
)
2426

2527
print(f"Copying {generated_absolute_path} to {target_absolute_path}")
2628
target_absolute_path.parent.mkdir(parents=True, exist_ok=True)

python/bin/repl_stub.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ def complete(self, text, state):
6262
elif "GNU readline" in readline.__doc__: # type: ignore
6363
readline.parse_and_bind("tab: complete")
6464
else:
65-
print(
66-
"Could not enable tab completion: "
67-
"unable to determine readline backend"
68-
)
65+
print("Could not enable tab completion: unable to determine readline backend")
6966
except ImportError:
7067
print(
7168
"Could not enable tab completion: "

python/private/get_local_runtime_info.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def _search_directories(get_config, base_executable) -> list[str]:
4848
# On MacOS, the LDLIBRARY may be a relative path under /Library/Frameworks,
4949
# such as "Python.framework/Versions/3.12/Python", not a file under the
5050
# LIBDIR/LIBPL directory, so include PYTHONFRAMEWORKPREFIX.
51-
lib_dirs = [
52-
get_config(x) for x in ("PYTHONFRAMEWORKPREFIX", "LIBPL", "LIBDIR")
53-
]
51+
lib_dirs = [get_config(x) for x in ("PYTHONFRAMEWORKPREFIX", "LIBPL", "LIBDIR")]
5452

5553
# On Debian, with multiarch enabled, prior to Python 3.10, `LIBDIR` didn't
5654
# tell the location of the libs, just the base directory. The `MULTIARCH`
@@ -67,8 +65,8 @@ def _search_directories(get_config, base_executable) -> list[str]:
6765

6866
if not _IS_DARWIN:
6967
for exec_dir in (
70-
os.path.dirname(base_executable) if base_executable else None,
71-
get_config("BINDIR"),
68+
os.path.dirname(base_executable) if base_executable else None,
69+
get_config("BINDIR"),
7270
):
7371
if not exec_dir:
7472
continue
@@ -122,7 +120,8 @@ def _search_library_names(get_config, version, abi_flags) -> list[str]:
122120
#
123121
# A typical LIBRARY is 'libpythonX.Y.a' on Linux.
124122
lib_names = [
125-
get_config(x) for x in (
123+
get_config(x)
124+
for x in (
126125
"LDLIBRARY",
127126
"INSTSONAME",
128127
"PY3LIBRARY",
@@ -167,8 +166,7 @@ def _get_python_library_info(base_executable) -> dict[str, Any]:
167166
abi_flags = _get_abi_flags(config_vars.get)
168167

169168
search_directories = _search_directories(config_vars.get, base_executable)
170-
search_libnames = _search_library_names(config_vars.get, version,
171-
abi_flags)
169+
search_libnames = _search_library_names(config_vars.get, version, abi_flags)
172170

173171
# Used to test whether the library is an abi3 library or a full api library.
174172
abi3_libraries = _default_library_names(sys.version_info.major, abi_flags)
@@ -221,10 +219,10 @@ def _get_python_library_info(base_executable) -> dict[str, Any]:
221219
# Additional DLLs are needed on Windows to link properly.
222220
dlls = []
223221
if _IS_WINDOWS:
224-
dlls.extend(
225-
glob.glob(os.path.join(os.path.dirname(base_executable), "*.dll")))
222+
dlls.extend(glob.glob(os.path.join(os.path.dirname(base_executable), "*.dll")))
226223
dlls = [
227-
x for x in dlls
224+
x
225+
for x in dlls
228226
if x not in dynamic_libraries and x not in abi_dynamic_libraries
229227
]
230228

python/private/pypi/dependency_resolver/dependency_resolver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ def main(
159159
# Further, shutil.copy preserves the source file's mode, and so if
160160
# our source file is read-only (the default under Perforce Helix),
161161
# this scratch file will also be read-only, defeating its purpose.
162-
with open(resolved_requirements_file, "rb") as fsrc, open(requirements_out, "wb") as fdst:
162+
with (
163+
open(resolved_requirements_file, "rb") as fsrc,
164+
open(requirements_out, "wb") as fdst,
165+
):
163166
shutil.copyfileobj(fsrc, fdst)
164167

165168
update_command = (

0 commit comments

Comments
 (0)