refactor: Run `isort` and `black` on all python files (#1859)

Run `isort` and `black` on all python files so that the pre-commit
hooks do not fail anymore.

It seems like most of the issues were quotation marks and vertical
whitespace.

Fixes #1674.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f0c2e0..1f577f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,8 @@
   `pip.parse` extension is now possible, see the
   `examples/pip_parse/MODULE.bazel` for how to do it.
   See [#1371](https://github.com/bazelbuild/rules_python/issues/1371).
+* (refactor) The pre-commit developer workflow should now pass `isort` and `black`
+  checks (see [#1674](https://github.com/bazelbuild/rules_python/issues/1674)).
 
 ### Added
 
diff --git a/examples/build_file_generation/__init__.py b/examples/build_file_generation/__init__.py
index 37dea1b..22e4221 100644
--- a/examples/build_file_generation/__init__.py
+++ b/examples/build_file_generation/__init__.py
@@ -12,16 +12,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import sphinx  # noqa
 from flask import Flask, jsonify
 from random_number_generator import generate_random_number
-import sphinx  # noqa
 
 app = Flask(__name__)
 
-@app.route('/random-number', methods=['GET'])
-def get_random_number():
-    return jsonify({'number': generate_random_number.generate_random_number()})
 
-"""Start the python web server"""
+@app.route("/random-number", methods=["GET"])
+def get_random_number():
+    return jsonify({"number": generate_random_number.generate_random_number()})
+
+
 def main():
+    """Start the python web server"""
     app.run()
diff --git a/examples/build_file_generation/__main__.py b/examples/build_file_generation/__main__.py
index 8f8efba..a77055f 100644
--- a/examples/build_file_generation/__main__.py
+++ b/examples/build_file_generation/__main__.py
@@ -14,5 +14,5 @@
 
 from __init__ import main
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     main()
diff --git a/examples/build_file_generation/__test__.py b/examples/build_file_generation/__test__.py
index c4fa5ef..45e127b 100644
--- a/examples/build_file_generation/__test__.py
+++ b/examples/build_file_generation/__test__.py
@@ -13,16 +13,19 @@
 # limitations under the License.
 
 import unittest
+
 from __init__ import app
 
+
 class TestServer(unittest.TestCase):
     def setUp(self):
         self.app = app.test_client()
-        
+
     def test_get_random_number(self):
-        response = self.app.get('/random-number')
+        response = self.app.get("/random-number")
         self.assertEqual(response.status_code, 200)
-        self.assertIn('number', response.json)
-        
-if __name__ == '__main__':
+        self.assertIn("number", response.json)
+
+
+if __name__ == "__main__":
     unittest.main()
diff --git a/examples/build_file_generation/random_number_generator/__init__.py b/examples/build_file_generation/random_number_generator/__init__.py
index bbdfb4c..4101095 100644
--- a/examples/build_file_generation/random_number_generator/__init__.py
+++ b/examples/build_file_generation/random_number_generator/__init__.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/examples/build_file_generation/random_number_generator/__test__.py b/examples/build_file_generation/random_number_generator/__test__.py
index 8cfb235..5facfee 100644
--- a/examples/build_file_generation/random_number_generator/__test__.py
+++ b/examples/build_file_generation/random_number_generator/__test__.py
@@ -13,13 +13,16 @@
 # limitations under the License.
 
 import unittest
+
 import random_number_generator.generate_random_number as generate_random_number
 
+
 class TestRandomNumberGenerator(unittest.TestCase):
     def test_generate_random_number(self):
         number = generate_random_number.generate_random_number()
         self.assertGreaterEqual(number, 1)
         self.assertLessEqual(number, 10)
-        
-if __name__ == '__main__':
+
+
+if __name__ == "__main__":
     unittest.main()
diff --git a/examples/build_file_generation/random_number_generator/generate_random_number.py b/examples/build_file_generation/random_number_generator/generate_random_number.py
index e198b5b..d551e33 100644
--- a/examples/build_file_generation/random_number_generator/generate_random_number.py
+++ b/examples/build_file_generation/random_number_generator/generate_random_number.py
@@ -14,6 +14,7 @@
 
 import random
 
-"""Generate a random number"""
+
 def generate_random_number():
+    """Generate a random number"""
     return random.randint(1, 10)
diff --git a/examples/bzlmod/__main__.py b/examples/bzlmod/__main__.py
index daf1749..2dd322a 100644
--- a/examples/bzlmod/__main__.py
+++ b/examples/bzlmod/__main__.py
@@ -12,9 +12,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from lib import main
 import sys
 
+from lib import main
+
 if __name__ == "__main__":
     print(main([["A", 1], ["B", 2]]))
     print(sys.version)
diff --git a/examples/bzlmod/lib.py b/examples/bzlmod/lib.py
index 5f0167f..e76042d 100644
--- a/examples/bzlmod/lib.py
+++ b/examples/bzlmod/lib.py
@@ -12,8 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from tabulate import tabulate
 import sphinx  # noqa
+from tabulate import tabulate
+
 
 def main(table):
     return tabulate(table)
diff --git a/examples/bzlmod_build_file_generation/runfiles/runfiles_test.py b/examples/bzlmod_build_file_generation/runfiles/runfiles_test.py
index a588040..5bfa530 100644
--- a/examples/bzlmod_build_file_generation/runfiles/runfiles_test.py
+++ b/examples/bzlmod_build_file_generation/runfiles/runfiles_test.py
@@ -26,7 +26,9 @@
         self.assertEqual(runfiles.Create().CurrentRepository(), "")
 
     def testRunfilesWithRepoMapping(self):
-        data_path = runfiles.Create().Rlocation("example_bzlmod_build_file_generation/runfiles/data/data.txt")
+        data_path = runfiles.Create().Rlocation(
+            "example_bzlmod_build_file_generation/runfiles/data/data.txt"
+        )
         with open(data_path) as f:
             self.assertEqual(f.read().strip(), "Hello, example_bzlmod!")
 
diff --git a/examples/multi_python_versions/tests/my_lib_test.py b/examples/multi_python_versions/tests/my_lib_test.py
index 3f334f5..449cb84 100644
--- a/examples/multi_python_versions/tests/my_lib_test.py
+++ b/examples/multi_python_versions/tests/my_lib_test.py
@@ -23,7 +23,9 @@
 if not my_lib.websockets_is_for_python_version(
     workspace_version
 ) and not my_lib.websockets_is_for_python_version(bzlmod_version):
-    print("expected package for Python version is different than returned\n"
-          f"expected either {workspace_version} or {bzlmod_version}\n"
-          f"but got {my_lib.websockets.__file__}")
+    print(
+        "expected package for Python version is different than returned\n"
+        f"expected either {workspace_version} or {bzlmod_version}\n"
+        f"but got {my_lib.websockets.__file__}"
+    )
     sys.exit(1)
diff --git a/examples/pip_parse/pip_parse_test.py b/examples/pip_parse/pip_parse_test.py
index 79e1a75..2fdd454 100644
--- a/examples/pip_parse/pip_parse_test.py
+++ b/examples/pip_parse/pip_parse_test.py
@@ -28,10 +28,7 @@
     def _remove_leading_dirs(self, paths):
         # Removes the first two directories (external/<reponame>)
         # to normalize what workspace and bzlmod produce.
-        return [
-            '/'.join(v.split('/')[2:])
-            for v in paths
-        ]
+        return ["/".join(v.split("/")[2:]) for v in paths]
 
     def test_entry_point(self):
         entry_point_path = os.environ.get("YAMLLINT_ENTRY_POINT")
diff --git a/examples/py_proto_library/message_test.py b/examples/py_proto_library/message_test.py
index 3aee1ee..b1a6942 100644
--- a/examples/py_proto_library/message_test.py
+++ b/examples/py_proto_library/message_test.py
@@ -3,13 +3,14 @@
 
 from another_proto import message_pb2
 
+
 class TestCase(unittest.TestCase):
     def test_message(self):
         got = message_pb2.TestMessage(
-            index = 5,
+            index=5,
         )
         self.assertIsNotNone(got)
 
 
 if __name__ == "__main__":
-  sys.exit(unittest.main())
+    sys.exit(unittest.main())
diff --git a/examples/wheel/private/directory_writer.py b/examples/wheel/private/directory_writer.py
index 7d9a93e..4b69f3a 100644
--- a/examples/wheel/private/directory_writer.py
+++ b/examples/wheel/private/directory_writer.py
@@ -48,7 +48,7 @@
 
     args.output.mkdir(parents=True, exist_ok=True)
 
-    for (path, content) in args.files:
+    for path, content in args.files:
         new_file = args.output / path
         new_file.parent.mkdir(parents=True, exist_ok=True)
         new_file.write_text(content)
diff --git a/examples/wheel/wheel_test.py b/examples/wheel/wheel_test.py
index e135eaa..66ebd50 100644
--- a/examples/wheel/wheel_test.py
+++ b/examples/wheel/wheel_test.py
@@ -62,7 +62,7 @@
             self.assertEqual(
                 zinfo.external_attr,
                 (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO | stat.S_IFREG) << 16,
-                msg=zinfo.filename
+                msg=zinfo.filename,
             )
             self.assertEqual(
                 zinfo.compress_type, zipfile.ZIP_DEFLATED, msg=zinfo.filename
@@ -486,7 +486,7 @@
                     "minimal_data_files-0.0.1.data/data/target/path/README.md",
                     "minimal_data_files-0.0.1.data/scripts/NOTICE",
                     "minimal_data_files-0.0.1.dist-info/RECORD",
-                ]
+                ],
             )
 
 
diff --git a/gazelle/manifest/copy_to_source.py b/gazelle/manifest/copy_to_source.py
index 6854192..4ebb958 100644
--- a/gazelle/manifest/copy_to_source.py
+++ b/gazelle/manifest/copy_to_source.py
@@ -26,7 +26,7 @@
     target_absolute_path.parent.mkdir(parents=True, exist_ok=True)
     shutil.copy(generated_absolute_path, target_absolute_path)
 
-    target_absolute_path.chmod(0O664)
+    target_absolute_path.chmod(0o664)
 
 
 if __name__ == "__main__":
diff --git a/gazelle/python/parse.py b/gazelle/python/parse.py
index ae9ce87..ea331bc 100644
--- a/gazelle/python/parse.py
+++ b/gazelle/python/parse.py
@@ -73,7 +73,7 @@
             if token_type != OP or token_val != "==":
                 continue
             token_type, token_val, start, _, _ = next(g)
-            if token_type != STRING or token_val.strip("\"'") != '__main__':
+            if token_type != STRING or token_val.strip("\"'") != "__main__":
                 continue
             token_type, token_val, start, _, _ = next(g)
             if token_type != OP or token_val != ":":
diff --git a/gazelle/python/parse_test.py b/gazelle/python/parse_test.py
index 3ebded4..6d1fa49 100644
--- a/gazelle/python/parse_test.py
+++ b/gazelle/python/parse_test.py
@@ -1,6 +1,8 @@
 import unittest
+
 import parse
 
+
 class TestParse(unittest.TestCase):
     def test_not_has_main(self):
         content = "a = 1\nb = 2"
diff --git a/gazelle/python/testdata/binary_without_entrypoint/collided_main.py b/gazelle/python/testdata/binary_without_entrypoint/collided_main.py
index 3bf59c7..ba73251 100644
--- a/gazelle/python/testdata/binary_without_entrypoint/collided_main.py
+++ b/gazelle/python/testdata/binary_without_entrypoint/collided_main.py
@@ -1,4 +1,4 @@
 import numpy
 
 if __name__ == "__main__":
-    run()
\ No newline at end of file
+    run()
diff --git a/gazelle/python/testdata/binary_without_entrypoint/main.py b/gazelle/python/testdata/binary_without_entrypoint/main.py
index f7b3170..49f1049 100644
--- a/gazelle/python/testdata/binary_without_entrypoint/main.py
+++ b/gazelle/python/testdata/binary_without_entrypoint/main.py
@@ -2,4 +2,4 @@
 import pandas
 
 if __name__ == "__main__":
-    run()
\ No newline at end of file
+    run()
diff --git a/gazelle/python/testdata/binary_without_entrypoint/main_test.py b/gazelle/python/testdata/binary_without_entrypoint/main_test.py
index 505a766..a010fe7 100644
--- a/gazelle/python/testdata/binary_without_entrypoint/main_test.py
+++ b/gazelle/python/testdata/binary_without_entrypoint/main_test.py
@@ -1,7 +1,9 @@
 import unittest
 
+
 class TestMain(unittest.unittest):
     pass
 
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/gazelle/python/testdata/dont_rename_target/__init__.py b/gazelle/python/testdata/dont_rename_target/__init__.py
index bbdfb4c..4101095 100644
--- a/gazelle/python/testdata/dont_rename_target/__init__.py
+++ b/gazelle/python/testdata/dont_rename_target/__init__.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/gazelle/python/testdata/first_party_file_and_directory_modules/baz.py b/gazelle/python/testdata/first_party_file_and_directory_modules/baz.py
index e03a9ec..8f8820d 100644
--- a/gazelle/python/testdata/first_party_file_and_directory_modules/baz.py
+++ b/gazelle/python/testdata/first_party_file_and_directory_modules/baz.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def baz():
     return "baz from baz.py"
diff --git a/gazelle/python/testdata/first_party_file_and_directory_modules/foo.py b/gazelle/python/testdata/first_party_file_and_directory_modules/foo.py
index 04474d8..be6d7dd 100644
--- a/gazelle/python/testdata/first_party_file_and_directory_modules/foo.py
+++ b/gazelle/python/testdata/first_party_file_and_directory_modules/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def foo():
     print("foo")
diff --git a/gazelle/python/testdata/first_party_file_and_directory_modules/one/two.py b/gazelle/python/testdata/first_party_file_and_directory_modules/one/two.py
index 94cca3d..d1909b1 100644
--- a/gazelle/python/testdata/first_party_file_and_directory_modules/one/two.py
+++ b/gazelle/python/testdata/first_party_file_and_directory_modules/one/two.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def two():
     return "two"
diff --git a/gazelle/python/testdata/first_party_file_and_directory_modules/undiscoverable/package1/subpackage1/module1.py b/gazelle/python/testdata/first_party_file_and_directory_modules/undiscoverable/package1/subpackage1/module1.py
index 76c7227..c5ccb87 100644
--- a/gazelle/python/testdata/first_party_file_and_directory_modules/undiscoverable/package1/subpackage1/module1.py
+++ b/gazelle/python/testdata/first_party_file_and_directory_modules/undiscoverable/package1/subpackage1/module1.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def find_me():
     return "found"
diff --git a/gazelle/python/testdata/generated_test_entrypoint/foo.py b/gazelle/python/testdata/generated_test_entrypoint/foo.py
index 932de45..3f049df 100644
--- a/gazelle/python/testdata/generated_test_entrypoint/foo.py
+++ b/gazelle/python/testdata/generated_test_entrypoint/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def foo():
     return "foo"
diff --git a/gazelle/python/testdata/monorepo/coarse_grained/_boundary/__init__.py b/gazelle/python/testdata/monorepo/coarse_grained/_boundary/__init__.py
index bbdfb4c..4101095 100644
--- a/gazelle/python/testdata/monorepo/coarse_grained/_boundary/__init__.py
+++ b/gazelle/python/testdata/monorepo/coarse_grained/_boundary/__init__.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/gazelle/python/testdata/naming_convention/__main__.py b/gazelle/python/testdata/naming_convention/__main__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/__main__.py
+++ b/gazelle/python/testdata/naming_convention/__main__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/naming_convention/__test__.py b/gazelle/python/testdata/naming_convention/__test__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/__test__.py
+++ b/gazelle/python/testdata/naming_convention/__test__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/naming_convention/dont_rename/__main__.py b/gazelle/python/testdata/naming_convention/dont_rename/__main__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/dont_rename/__main__.py
+++ b/gazelle/python/testdata/naming_convention/dont_rename/__main__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/naming_convention/dont_rename/__test__.py b/gazelle/python/testdata/naming_convention/dont_rename/__test__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/dont_rename/__test__.py
+++ b/gazelle/python/testdata/naming_convention/dont_rename/__test__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py b/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py
+++ b/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py b/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py
+++ b/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/per_file_subdirs/bar/foo.py b/gazelle/python/testdata/per_file_subdirs/bar/foo.py
index 59eb08c..506f028 100644
--- a/gazelle/python/testdata/per_file_subdirs/bar/foo.py
+++ b/gazelle/python/testdata/per_file_subdirs/bar/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def func():
     pass
diff --git a/gazelle/python/testdata/python_target_with_test_in_name/real_test.py b/gazelle/python/testdata/python_target_with_test_in_name/real_test.py
index e390866..b25d5bd 100644
--- a/gazelle/python/testdata/python_target_with_test_in_name/real_test.py
+++ b/gazelle/python/testdata/python_target_with_test_in_name/real_test.py
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import boto3
 import __init__
+import boto3
 
 _ = boto3
diff --git a/gazelle/python/testdata/python_target_with_test_in_name/test_reality.py b/gazelle/python/testdata/python_target_with_test_in_name/test_reality.py
index a3afc79..9795589 100644
--- a/gazelle/python/testdata/python_target_with_test_in_name/test_reality.py
+++ b/gazelle/python/testdata/python_target_with_test_in_name/test_reality.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import __init__
\ No newline at end of file
+import __init__
diff --git a/gazelle/python/testdata/relative_imports/package1/module2.py b/gazelle/python/testdata/relative_imports/package1/module2.py
index f8893b2..0cbc5f0 100644
--- a/gazelle/python/testdata/relative_imports/package1/module2.py
+++ b/gazelle/python/testdata/relative_imports/package1/module2.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def function2():
     return "function2"
diff --git a/gazelle/python/testdata/relative_imports/package2/__init__.py b/gazelle/python/testdata/relative_imports/package2/__init__.py
index 0f59568..fcaa330 100644
--- a/gazelle/python/testdata/relative_imports/package2/__init__.py
+++ b/gazelle/python/testdata/relative_imports/package2/__init__.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 class Class1:
     def method1(self):
         return "method1"
diff --git a/gazelle/python/testdata/relative_imports/package2/module3.py b/gazelle/python/testdata/relative_imports/package2/module3.py
index 478dea9..29bb571 100644
--- a/gazelle/python/testdata/relative_imports/package2/module3.py
+++ b/gazelle/python/testdata/relative_imports/package2/module3.py
@@ -12,10 +12,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import resolved_package
+
 from . import Class1
 from .subpackage1.module5 import function5
 
-import resolved_package
 
 def function3():
     c1 = Class1()
diff --git a/gazelle/python/testdata/relative_imports/package2/module4.py b/gazelle/python/testdata/relative_imports/package2/module4.py
index b7509dc..28cdc13 100644
--- a/gazelle/python/testdata/relative_imports/package2/module4.py
+++ b/gazelle/python/testdata/relative_imports/package2/module4.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def function4():
     return "function4"
diff --git a/gazelle/python/testdata/respect_kind_mapping/foo.py b/gazelle/python/testdata/respect_kind_mapping/foo.py
index 932de45..3f049df 100644
--- a/gazelle/python/testdata/respect_kind_mapping/foo.py
+++ b/gazelle/python/testdata/respect_kind_mapping/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def foo():
     return "foo"
diff --git a/gazelle/python/testdata/sibling_imports/pkg/b.py b/gazelle/python/testdata/sibling_imports/pkg/b.py
index 7095bdc..d04d423 100644
--- a/gazelle/python/testdata/sibling_imports/pkg/b.py
+++ b/gazelle/python/testdata/sibling_imports/pkg/b.py
@@ -1,2 +1,2 @@
 def run():
-    pass
\ No newline at end of file
+    pass
diff --git a/gazelle/python/testdata/sibling_imports/pkg/unit_test.py b/gazelle/python/testdata/sibling_imports/pkg/unit_test.py
index a3218e2..f42878a 100644
--- a/gazelle/python/testdata/sibling_imports/pkg/unit_test.py
+++ b/gazelle/python/testdata/sibling_imports/pkg/unit_test.py
@@ -1,3 +1,3 @@
 import a
+import test_util
 from b import run
-import test_util
\ No newline at end of file
diff --git a/gazelle/python/testdata/simple_test/foo.py b/gazelle/python/testdata/simple_test/foo.py
index 932de45..3f049df 100644
--- a/gazelle/python/testdata/simple_test/foo.py
+++ b/gazelle/python/testdata/simple_test/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def foo():
     return "foo"
diff --git a/gazelle/python/testdata/simple_test_with_conftest/conftest.py b/gazelle/python/testdata/simple_test_with_conftest/conftest.py
index bbdfb4c..4101095 100644
--- a/gazelle/python/testdata/simple_test_with_conftest/conftest.py
+++ b/gazelle/python/testdata/simple_test_with_conftest/conftest.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/gazelle/python/testdata/simple_test_with_conftest/foo.py b/gazelle/python/testdata/simple_test_with_conftest/foo.py
index 932de45..3f049df 100644
--- a/gazelle/python/testdata/simple_test_with_conftest/foo.py
+++ b/gazelle/python/testdata/simple_test_with_conftest/foo.py
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def foo():
     return "foo"
diff --git a/gazelle/python/testdata/subdir_sources/foo/has_main/__main__.py b/gazelle/python/testdata/subdir_sources/foo/has_main/__main__.py
index bd0fe61..78d2348 100644
--- a/gazelle/python/testdata/subdir_sources/foo/has_main/__main__.py
+++ b/gazelle/python/testdata/subdir_sources/foo/has_main/__main__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import foo.has_main.python.my_module
\ No newline at end of file
+import foo.has_main.python.my_module
diff --git a/gazelle/python/testdata/subdir_sources/foo/has_test/__test__.py b/gazelle/python/testdata/subdir_sources/foo/has_test/__test__.py
index 3c9ed1a..ad77cb7 100644
--- a/gazelle/python/testdata/subdir_sources/foo/has_test/__test__.py
+++ b/gazelle/python/testdata/subdir_sources/foo/has_test/__test__.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # For test purposes only.
-import foo.has_test.python.my_module
\ No newline at end of file
+import foo.has_test.python.my_module
diff --git a/python/pip_install/tools/dependency_resolver/__init__.py b/python/pip_install/tools/dependency_resolver/__init__.py
index bbdfb4c..4101095 100644
--- a/python/pip_install/tools/dependency_resolver/__init__.py
+++ b/python/pip_install/tools/dependency_resolver/__init__.py
@@ -11,4 +11,3 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
diff --git a/python/pip_install/tools/dependency_resolver/dependency_resolver.py b/python/pip_install/tools/dependency_resolver/dependency_resolver.py
index 5e914bc..afe5076 100644
--- a/python/pip_install/tools/dependency_resolver/dependency_resolver.py
+++ b/python/pip_install/tools/dependency_resolver/dependency_resolver.py
@@ -99,8 +99,10 @@
     bazel_runfiles = runfiles.Create()
 
     requirements_file = _select_golden_requirements_file(
-        requirements_txt=requirements_txt, requirements_linux=requirements_linux,
-        requirements_darwin=requirements_darwin, requirements_windows=requirements_windows
+        requirements_txt=requirements_txt,
+        requirements_linux=requirements_linux,
+        requirements_darwin=requirements_darwin,
+        requirements_windows=requirements_windows,
     )
 
     resolved_requirements_in = _locate(bazel_runfiles, requirements_in)
@@ -120,8 +122,8 @@
     # use the runfiles file first. Thus, we need to compute the relative path
     # from the execution root.
     # Note: Windows cannot reference generated files without runfiles support enabled.
-    requirements_in_relative = requirements_in[len(repository_prefix):]
-    requirements_file_relative = requirements_file[len(repository_prefix):]
+    requirements_in_relative = requirements_in[len(repository_prefix) :]
+    requirements_file_relative = requirements_file[len(repository_prefix) :]
 
     # Before loading click, set the locale for its parser.
     # If it leaks through to the system setting, it may fail:
@@ -157,7 +159,9 @@
     os.environ["CUSTOM_COMPILE_COMMAND"] = update_command
     os.environ["PIP_CONFIG_FILE"] = os.getenv("PIP_CONFIG_FILE") or os.devnull
 
-    argv.append(f"--output-file={requirements_file_relative if UPDATE else requirements_out}")
+    argv.append(
+        f"--output-file={requirements_file_relative if UPDATE else requirements_out}"
+    )
     argv.append(
         requirements_in_relative
         if Path(requirements_in_relative).exists()
diff --git a/python/private/repack_whl.py b/python/private/repack_whl.py
index ea9c01f..9052ac3 100644
--- a/python/private/repack_whl.py
+++ b/python/private/repack_whl.py
@@ -152,7 +152,9 @@
         record_contents = record_path.read_text() if record_path.exists() else ""
         distribution_prefix = distinfo_dir.with_suffix("").name
 
-        with _WhlFile(args.output, mode="w", distribution_prefix=distribution_prefix) as out:
+        with _WhlFile(
+            args.output, mode="w", distribution_prefix=distribution_prefix
+        ) as out:
             for p in _files_to_pack(patched_wheel_dir, record_contents):
                 rel_path = p.relative_to(patched_wheel_dir)
                 out.add_file(str(rel_path), p)
diff --git a/tests/integration/ignore_root_user_error/bzlmod_test.py b/tests/integration/ignore_root_user_error/bzlmod_test.py
index 62bc4f4..98715b3 100644
--- a/tests/integration/ignore_root_user_error/bzlmod_test.py
+++ b/tests/integration/ignore_root_user_error/bzlmod_test.py
@@ -12,26 +12,27 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import unittest
-import pathlib
 import json
+import pathlib
+import unittest
 
 from python.runfiles import runfiles
 
+
 class BzlmodTest(unittest.TestCase):
     def test_toolchains(self):
         rf = runfiles.Create()
-        debug_path = pathlib.Path(rf.Rlocation(
-                "rules_python_bzlmod_debug/debug_info.json"
-        ))
+        debug_path = pathlib.Path(
+            rf.Rlocation("rules_python_bzlmod_debug/debug_info.json")
+        )
         debug_info = json.loads(debug_path.read_bytes())
 
         expected = [
-            {'ignore_root_user_error': True, 'name': 'python_3_11', },
-            {'ignore_root_user_error': True, 'name': 'python_3_10'}
+            {"ignore_root_user_error": True, "name": "python_3_11"},
+            {"ignore_root_user_error": True, "name": "python_3_10"},
         ]
-        self.assertCountEqual(debug_info["toolchains_registered"],
-                              expected)
+        self.assertCountEqual(debug_info["toolchains_registered"], expected)
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tests/pycross/patched_py_wheel_library_test.py b/tests/pycross/patched_py_wheel_library_test.py
index 4591187..e1b404a 100644
--- a/tests/pycross/patched_py_wheel_library_test.py
+++ b/tests/pycross/patched_py_wheel_library_test.py
@@ -23,7 +23,9 @@
 class TestPyWheelLibrary(unittest.TestCase):
     def setUp(self):
         self.extraction_dir = Path(
-            RUNFILES.Rlocation("rules_python/tests/pycross/patched_extracted_wheel_for_testing")
+            RUNFILES.Rlocation(
+                "rules_python/tests/pycross/patched_extracted_wheel_for_testing"
+            )
         )
         self.assertTrue(self.extraction_dir.exists(), self.extraction_dir)
         self.assertTrue(self.extraction_dir.is_dir(), self.extraction_dir)