瀏覽代碼

blacken the code

Thomas Waldmann 9 月之前
父節點
當前提交
a40978ae1b

+ 7 - 8
src/borg/archiver/__init__.py

@@ -582,14 +582,13 @@ def main():  # pragma: no cover
 
     # Register fault handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL.
     faulthandler.enable()
-    with signal_handler("SIGINT", raising_signal_handler(KeyboardInterrupt)), signal_handler(
-        "SIGHUP", raising_signal_handler(SigHup)
-    ), signal_handler("SIGTERM", raising_signal_handler(SigTerm)), signal_handler(
-        "SIGUSR1", sig_info_handler
-    ), signal_handler(
-        "SIGUSR2", sig_trace_handler
-    ), signal_handler(
-        "SIGINFO", sig_info_handler
+    with (
+        signal_handler("SIGINT", raising_signal_handler(KeyboardInterrupt)),
+        signal_handler("SIGHUP", raising_signal_handler(SigHup)),
+        signal_handler("SIGTERM", raising_signal_handler(SigTerm)),
+        signal_handler("SIGUSR1", sig_info_handler),
+        signal_handler("SIGUSR2", sig_trace_handler),
+        signal_handler("SIGINFO", sig_info_handler),
     ):
         archiver = Archiver()
         msg = msgid = tb = None

+ 6 - 8
src/borg/archiver/compact_cmd.py

@@ -39,13 +39,9 @@ class ArchiveGarbageCollector:
         logger.info("Getting object IDs present in the repository...")
         self.repository_chunks = self.get_repository_chunks()
         logger.info("Computing object IDs used by archives...")
-        (
-            self.used_chunks,
-            self.wanted_chunks,
-            self.total_files,
-            self.total_size,
-            self.archives_count,
-        ) = self.analyze_archives()
+        (self.used_chunks, self.wanted_chunks, self.total_files, self.total_size, self.archives_count) = (
+            self.analyze_archives()
+        )
         self.report_and_delete()
         logger.info("Finished compaction / garbage collection...")
 
@@ -134,7 +130,9 @@ class ArchiveGarbageCollector:
 
         count = len(self.repository_chunks)
         logger.info(f"Overall statistics, considering all {self.archives_count} archives in this repository:")
-        logger.info(f"Source data size was {format_file_size(self.total_size, precision=0)} in {self.total_files} files.")
+        logger.info(
+            f"Source data size was {format_file_size(self.total_size, precision=0)} in {self.total_files} files."
+        )
         dsize = sum(self.used_chunks[id] for id in self.repository_chunks)
         logger.info(f"Repository size is {format_file_size(self.repository_size, precision=0)} in {count} objects.")
         if self.total_size != 0:

+ 1 - 0
src/borg/helpers/__init__.py

@@ -5,6 +5,7 @@ that did not fit better elsewhere.
 Code used to be in borg/helpers.py but was split into the modules in this
 package, which are imported into here for compatibility.
 """
+
 import os
 from typing import List
 from collections import namedtuple

+ 5 - 3
src/borg/helpers/process.py

@@ -82,9 +82,11 @@ def daemonizing(*, timeout=5):
             logger.debug("Daemonizing: Foreground process (%s, %s, %s) is waiting for background process..." % old_id)
             exit_code = EXIT_SUCCESS
             # Indeed, SIGHUP and SIGTERM handlers should have been set on archiver.run(). Just in case...
-            with signal_handler("SIGINT", raising_signal_handler(KeyboardInterrupt)), signal_handler(
-                "SIGHUP", raising_signal_handler(SigHup)
-            ), signal_handler("SIGTERM", raising_signal_handler(SigTerm)):
+            with (
+                signal_handler("SIGINT", raising_signal_handler(KeyboardInterrupt)),
+                signal_handler("SIGHUP", raising_signal_handler(SigHup)),
+                signal_handler("SIGTERM", raising_signal_handler(SigTerm)),
+            ):
                 try:
                     if timeout > 0:
                         time.sleep(timeout)

+ 1 - 0
src/borg/testsuite/archiver/disk_full.py

@@ -14,6 +14,7 @@ sudo chown myuser /tmp/borg-mount/
 
 if the directory does not exist, the test will be skipped.
 """
+
 import errno
 import os
 import random

+ 6 - 4
src/borg/testsuite/archiver/mount_cmds.py

@@ -32,16 +32,18 @@ def test_fuse_mount_hardlinks(archivers, request):
         ignore_perms = ["-o", "ignore_permissions,defer_permissions"]
     else:
         ignore_perms = ["-o", "ignore_permissions"]
-    with fuse_mount(archiver, mountpoint, "-a", "test", "--strip-components=2", *ignore_perms), changedir(
-        os.path.join(mountpoint, "test")
+    with (
+        fuse_mount(archiver, mountpoint, "-a", "test", "--strip-components=2", *ignore_perms),
+        changedir(os.path.join(mountpoint, "test")),
     ):
         assert os.stat("hardlink").st_nlink == 2
         assert os.stat("subdir/hardlink").st_nlink == 2
         assert open("subdir/hardlink", "rb").read() == b"123456"
         assert os.stat("aaaa").st_nlink == 2
         assert os.stat("source2").st_nlink == 2
-    with fuse_mount(archiver, mountpoint, "input/dir1", "-a", "test", *ignore_perms), changedir(
-        os.path.join(mountpoint, "test")
+    with (
+        fuse_mount(archiver, mountpoint, "input/dir1", "-a", "test", *ignore_perms),
+        changedir(os.path.join(mountpoint, "test")),
     ):
         assert os.stat("input/dir1/hardlink").st_nlink == 2
         assert os.stat("input/dir1/subdir/hardlink").st_nlink == 2