mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
blacken the code
This commit is contained in:
parent
ec1d89f477
commit
a40978ae1b
6 changed files with 26 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -39,13 +39,9 @@ def garbage_collect(self):
|
|||
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 @@ def report_and_delete(self):
|
|||
|
||||
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:
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
if the directory does not exist, the test will be skipped.
|
||||
"""
|
||||
|
||||
import errno
|
||||
import os
|
||||
import random
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue