Skip to content

Commit 8a7136c

Browse files
build: Run pre-commit everywhere
1 parent e14cd37 commit 8a7136c

File tree

10 files changed

+22
-17
lines changed

10 files changed

+22
-17
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, execute
66
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
7-
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
8-
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
7+
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
8+
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
99

1010
test --test_output=errors
1111

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
- --profile
3939
- black
4040
- repo: https://github.com/psf/black
41-
rev: 23.1.0
41+
rev: 25.1.0
4242
hooks:
4343
- id: black
4444
- repo: local

examples/bzlmod/py_proto_library/foo_external/py_binary_with_proto.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
if __name__ == "__main__":
44
import my_proto_pb2
5+
56
sys.exit(0)

examples/wheel/lib/module_with_type_annotations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def function():
1617
return "qux"

gazelle/python/testdata/dependency_resolution_order/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# we can still override "third_party.foo.bar"
2323
import third_party.foo.bar
2424

25-
from third_party import baz
26-
2725
import third_party
26+
from third_party import baz
2827

2928
_ = sys
3029
_ = bar

gazelle/python/testdata/py312_syntax/pep_695_type_parameter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ def search_one_more_level[T](
1717

1818
import _other_module
1919

20-
2120
if __name__ == "__main__":
2221
pass

python/private/pypi/dependency_resolver/dependency_resolver.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ def main(
185185
# and we should copy the updated requirements back to the source tree.
186186
if not absolute_output_file.samefile(requirements_file_tree):
187187
atexit.register(
188-
lambda: shutil.copy(
189-
absolute_output_file, requirements_file_tree
190-
)
188+
lambda: shutil.copy(absolute_output_file, requirements_file_tree)
191189
)
192-
cli(argv, standalone_mode = False)
190+
cli(argv, standalone_mode=False)
193191
requirements_file_relative_path = Path(requirements_file_relative)
194192
content = requirements_file_relative_path.read_text()
195193
content = content.replace(absolute_path_prefix, "")

tests/integration/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323

2424
_logger = logging.getLogger(__name__)
2525

26+
2627
class ExecuteError(Exception):
2728
def __init__(self, result):
2829
self.result = result
30+
2931
def __str__(self):
3032
return self.result.describe()
3133

34+
3235
class ExecuteResult:
3336
def __init__(
3437
self,
@@ -83,7 +86,7 @@ def setUp(self):
8386
"TMP": str(self.tmp_dir),
8487
# For some reason, this is necessary for Bazel 6.4 to work.
8588
# If not present, it can't find some bash helpers in @bazel_tools
86-
"RUNFILES_DIR": os.environ["TEST_SRCDIR"]
89+
"RUNFILES_DIR": os.environ["TEST_SRCDIR"],
8790
}
8891

8992
def run_bazel(self, *args: str, check: bool = True) -> ExecuteResult:

tests/no_unsafe_paths/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ def test_no_unsafe_paths_in_search_path(self):
4040
self.assertEqual(os.path.basename(sys.path[0]), archive)
4141

4242

43-
if __name__ == '__main__':
44-
unittest.main()
43+
if __name__ == "__main__":
44+
unittest.main()

tools/wheelmaker.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,11 @@ def add_recordfile(self):
217217
filename = filename.lstrip("/")
218218
writer.writerow(
219219
(
220-
c
221-
if isinstance(c, str)
222-
else c.decode("utf-8", "surrogateescape")
220+
(
221+
c
222+
if isinstance(c, str)
223+
else c.decode("utf-8", "surrogateescape")
224+
)
223225
for c in (filename, digest, size)
224226
)
225227
)
@@ -604,7 +606,9 @@ def get_new_requirement_line(reqs_text, extra):
604606
# File is empty
605607
# So replace the meta_line entirely, including removing newline chars
606608
else:
607-
metadata = re.sub(re.escape(meta_line) + r"(?:\r?\n)?", "", metadata, count=1)
609+
metadata = re.sub(
610+
re.escape(meta_line) + r"(?:\r?\n)?", "", metadata, count=1
611+
)
608612

609613
maker.add_metadata(
610614
metadata=metadata,

0 commit comments

Comments
 (0)