Browse Source

ruff format

Jelmer Vernooij 10 months ago
parent
commit
9315f2c0af

+ 3 - 1
dulwich/cli.py

@@ -624,7 +624,9 @@ class SuperCommand(Command):
 
     def run(self, args):
         if not args and not self.default_command:
-            print("Supported subcommands: {}".format(", ".join(self.subcommands.keys())))
+            print(
+                "Supported subcommands: {}".format(", ".join(self.subcommands.keys()))
+            )
             return False
         cmd = args[0]
         try:

+ 5 - 1
dulwich/diff_tree.py

@@ -240,7 +240,11 @@ def _all_same(seq, key):
 
 
 def tree_changes_for_merge(
-        store: BaseObjectStore, parent_tree_ids: List[ObjectID], tree_id: ObjectID, rename_detector=None):
+    store: BaseObjectStore,
+    parent_tree_ids: List[ObjectID],
+    tree_id: ObjectID,
+    rename_detector=None,
+):
     """Get the tree changes for a merge tree relative to all its parents.
 
     Args:

+ 2 - 6
dulwich/repo.py

@@ -829,9 +829,7 @@ class BaseRepo:
           KeyError: when the specified ref or object does not exist
         """
         if not isinstance(name, bytes):
-            raise TypeError(
-                f"'name' must be bytestring, not {type(name).__name__:.80}"
-            )
+            raise TypeError(f"'name' must be bytestring, not {type(name).__name__:.80}")
         if len(name) in (20, 40):
             try:
                 return self.object_store[name]
@@ -1473,9 +1471,7 @@ class Repo(BaseRepo):
                     del index[tree_path]
                     continue
                 except KeyError as exc:
-                    raise KeyError(
-                        f"file '{tree_path.decode()}' not in index"
-                    ) from exc
+                    raise KeyError(f"file '{tree_path.decode()}' not in index") from exc
 
             st = None
             try:

+ 0 - 3
dulwich/tests/test_object_store.py

@@ -294,6 +294,3 @@ class PackBasedObjectStoreTests(ObjectStoreTests):
         self.assertEqual(2, self.store.repack())
         self.assertEqual(1, len(self.store.packs))
         self.assertEqual(0, self.store.pack_loose_objects())
-
-
-

+ 1 - 3
tests/compat/utils.py

@@ -40,9 +40,7 @@ from .. import SkipTest, TestCase
 _DEFAULT_GIT = "git"
 _VERSION_LEN = 4
 _REPOS_DATA_DIR = os.path.abspath(
-    os.path.join(
-        os.path.dirname(__file__), os.pardir, os.pardir, "testdata", "repos"
-    )
+    os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "testdata", "repos")
 )
 
 

+ 1 - 0
tests/contrib/__init__.py

@@ -18,6 +18,7 @@
 # License, Version 2.0.
 #
 
+
 def test_suite():
     import unittest
 

+ 1 - 3
tests/contrib/test_swift_smoke.py

@@ -179,9 +179,7 @@ class SwiftRepoSmokeTest(unittest.TestCase):
         )
         swift_repo = swift.SwiftRepo("fakerepo", self.conf)
         for branch in ("master", "mybranch", "pullr-108"):
-            remote_shas[branch] = swift_repo.refs.read_loose_ref(
-                f"refs/heads/{branch}"
-            )
+            remote_shas[branch] = swift_repo.refs.read_loose_ref(f"refs/heads/{branch}")
         self.assertDictEqual(local_shas, remote_shas)
 
     def test_push_data_branch(self):

+ 1 - 3
tests/test_client.py

@@ -1207,9 +1207,7 @@ class HttpGitClientTests(TestCase):
                 preload_content=True,
             ):
                 response = HTTPResponse(
-                    headers={
-                        "Content-Type": "application/x-git-upload-pack-result"
-                    },
+                    headers={"Content-Type": "application/x-git-upload-pack-result"},
                     request_method=method,
                     request_url=url,
                     preload_content=preload_content,

+ 3 - 1
tests/test_pack.py

@@ -256,7 +256,9 @@ class TestPackData(PackTests):
         self.get_pack_data(pack1_sha).close()
 
     def test_from_file(self):
-        path = os.path.join(self.datadir, "pack-{}.pack".format(pack1_sha.decode("ascii")))
+        path = os.path.join(
+            self.datadir, "pack-{}.pack".format(pack1_sha.decode("ascii"))
+        )
         with open(path, "rb") as f:
             PackData.from_file(f, os.path.getsize(path))
 

+ 1 - 3
tests/test_patch.py

@@ -234,8 +234,7 @@ diff --git a/dulwich/tests/test_patch.py b/dulwich/tests/test_patch.py
  
  class DiffTests(TestCase):
 """
-        text = (
-            f"""\
+        text = f"""\
 From dulwich-users-bounces+jelmer=samba.org@lists.launchpad.net \
 Mon Nov 29 00:58:18 2010
 Date: Sun, 28 Nov 2010 17:57:27 -0600
@@ -255,7 +254,6 @@ Unsubscribe : https://launchpad.net/~dulwich-users
 More help   : https://help.launchpad.net/ListHelp
 
 """
-        )
         c, diff, version = git_am_patch_split(BytesIO(text))
         self.assertEqual(expected_diff, diff)
         self.assertEqual(None, version)

+ 1 - 3
tests/test_repository.py

@@ -405,9 +405,7 @@ class RepositoryRootTests(TestCase):
     def test_clone_no_head(self):
         temp_dir = self.mkdtemp()
         self.addCleanup(shutil.rmtree, temp_dir)
-        repo_dir = os.path.join(
-            os.path.dirname(__file__), "..", "testdata", "repos"
-        )
+        repo_dir = os.path.join(os.path.dirname(__file__), "..", "testdata", "repos")
         dest_dir = os.path.join(temp_dir, "a.git")
         shutil.copytree(os.path.join(repo_dir, "a.git"), dest_dir, symlinks=True)
         r = Repo(dest_dir)