summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Waldmann <tw@waldmann-edv.de>2023-07-26 01:10:24 +0200
committerThomas Waldmann <tw@waldmann-edv.de>2023-07-26 01:24:20 +0200
commit5013121bd85c24ab6ee67dd2bc157e2d3facc770 (patch)
treedaf6d89a5ba04b178d4a8eb51056d1da12cd3599 /src
parent6151b369c4ca96cf2ac5c7aebb4818d28b2200ad (diff)
fix E501
Diffstat (limited to 'src')
-rw-r--r--src/borg/archive.py4
-rw-r--r--src/borg/archiver/_common.py3
-rw-r--r--src/borg/archiver/rlist_cmd.py2
-rw-r--r--src/borg/cache.py5
-rw-r--r--src/borg/helpers/parseformat.py2
-rw-r--r--src/borg/helpers/shellpattern.py7
-rw-r--r--src/borg/manifest.py3
-rw-r--r--src/borg/remote.py2
-rw-r--r--src/borg/repository.py14
-rw-r--r--src/borg/testsuite/crypto.py6
-rw-r--r--src/borg/testsuite/helpers.py6
-rw-r--r--src/borg/testsuite/locking.py18
-rw-r--r--src/borg/testsuite/platform.py8
13 files changed, 46 insertions, 34 deletions
diff --git a/src/borg/archive.py b/src/borg/archive.py
index 60c647da8..808f901fb 100644
--- a/src/borg/archive.py
+++ b/src/borg/archive.py
@@ -974,8 +974,8 @@ Duration: {0.duration}
if not self.noacls:
acl_set(path, item, self.numeric_ids, fd=fd)
if not self.noxattrs and "xattrs" in item:
- # chown removes Linux capabilities, so set the extended attributes at the end, after chown, since they include
- # the Linux capabilities in the "security.capability" attribute.
+ # chown removes Linux capabilities, so set the extended attributes at the end, after chown,
+ # since they include the Linux capabilities in the "security.capability" attribute.
warning = xattr.set_all(fd or path, item.xattrs, follow_symlinks=False)
if warning:
set_ec(EXIT_WARNING)
diff --git a/src/borg/archiver/_common.py b/src/borg/archiver/_common.py
index f1d33ec80..6d0d06e82 100644
--- a/src/borg/archiver/_common.py
+++ b/src/borg/archiver/_common.py
@@ -85,7 +85,8 @@ def with_repository(
:param manifest: load manifest and repo_objs (key), pass them as keyword arguments
:param cache: open cache, pass it as keyword argument (implies manifest)
:param secure: do assert_secure after loading manifest
- :param compatibility: mandatory if not create and (manifest or cache), specifies mandatory feature categories to check
+ :param compatibility: mandatory if not create and (manifest or cache), specifies mandatory
+ feature categories to check
"""
# Note: with_repository decorator does not have a "key" argument (yet?)
compatibility = compat_check(
diff --git a/src/borg/archiver/rlist_cmd.py b/src/borg/archiver/rlist_cmd.py
index e026a3360..1e1f7b4eb 100644
--- a/src/borg/archiver/rlist_cmd.py
+++ b/src/borg/archiver/rlist_cmd.py
@@ -66,7 +66,7 @@ class RListMixIn:
# Strings are left-aligned, numbers are right-aligned.
# Note: time columns except ``isomtime``, ``isoctime`` and ``isoatime`` cannot be padded.
$ borg rlist --format '{archive:36} {time} [{id}]{NL}' /path/to/repo
- ArchiveFoo Thu, 2021-12-09 10:22:28 [0b8e9a312bef3f2f6e2d0fc110c196827786c15eba0188738e81697a7fa3b274]
+ ArchiveFoo Thu, 2021-12-09 10:22:28 [0b8e9...3b274]
...
The following keys are always available:
diff --git a/src/borg/cache.py b/src/borg/cache.py
index 015ee7fcd..77df3fc59 100644
--- a/src/borg/cache.py
+++ b/src/borg/cache.py
@@ -895,8 +895,9 @@ class LocalCache(CacheStatsMixin):
self.begin_txn()
with cache_if_remote(self.repository, decrypted_cache=self.repo_objs) as decrypted_repository:
- # TEMPORARY HACK: to avoid archive index caching, create a FILE named ~/.cache/borg/REPOID/chunks.archive.d -
- # this is only recommended if you have a fast, low latency connection to your repo (e.g. if repo is local disk)
+ # TEMPORARY HACK:
+ # to avoid archive index caching, create a FILE named ~/.cache/borg/REPOID/chunks.archive.d -
+ # this is only recommended if you have a fast, low latency connection to your repo (e.g. if repo is local).
self.do_cache = os.path.isdir(archive_path)
self.chunks = create_master_idx(self.chunks)
diff --git a/src/borg/helpers/parseformat.py b/src/borg/helpers/parseformat.py
index 79928a610..7297db376 100644
--- a/src/borg/helpers/parseformat.py
+++ b/src/borg/helpers/parseformat.py
@@ -456,7 +456,7 @@ class Location:
(?:file://)? # optional file protocol
(?P<path>
(?:[a-zA-Z]:)? # Drive letter followed by a colon (optional)
- (?:[^:]+) # Anything which does not contain a :, at least one character
+ (?:[^:]+) # Anything which does not contain a :, at least one char
)
""",
re.VERBOSE,
diff --git a/src/borg/helpers/shellpattern.py b/src/borg/helpers/shellpattern.py
index 7dc3ee09b..12b0bba2f 100644
--- a/src/borg/helpers/shellpattern.py
+++ b/src/borg/helpers/shellpattern.py
@@ -6,10 +6,9 @@ from queue import LifoQueue
def translate(pat, match_end=r"\Z"):
"""Translate a shell-style pattern to a regular expression.
- The pattern may include ``**<sep>`` (<sep> stands for the platform-specific path separator; "/" on POSIX systems) for
- matching zero or more directory levels and "*" for matching zero or more arbitrary characters with the exception of
- any path separator. Wrap meta-characters in brackets for a literal match (i.e. "[?]" to match the literal character
- "?").
+ The pattern may include ``**<sep>`` (<sep> stands for the platform-specific path separator; "/" on POSIX systems)
+ for matching zero or more directory levels and "*" for matching zero or more arbitrary characters except any path
+ separator. Wrap meta-characters in brackets for a literal match (i.e. "[?]" to match the literal character "?").
Using match_end=regex one can give a regular expression that is used to match after the regex that is generated from
the pattern. The default is to match the end of the string.
diff --git a/src/borg/manifest.py b/src/borg/manifest.py
index 189caf6a8..592b53194 100644
--- a/src/borg/manifest.py
+++ b/src/borg/manifest.py
@@ -164,7 +164,8 @@ class Archives(abc.MutableMapping):
consider_checkpoints = getattr(args, "consider_checkpoints", None)
if name is not None:
raise Error(
- "Giving a specific name is incompatible with options --first, --last, -a / --match-archives, and --consider-checkpoints."
+ "Giving a specific name is incompatible with options --first, --last, "
+ "-a / --match-archives, and --consider-checkpoints."
)
return self.list(
sort_by=args.sort_by.split(","),
diff --git a/src/borg/remote.py b/src/borg/remote.py
index 0bc977865..40b8b62ff 100644
--- a/src/borg/remote.py
+++ b/src/borg/remote.py
@@ -108,7 +108,7 @@ class UnexpectedRPCDataFormatFromServer(Error):
# All method calls on the remote repository object must be allowlisted in RepositoryServer.rpc_methods and have api
# stubs in RemoteRepository. The @api decorator on these stubs is used to set server version requirements.
#
-# Method parameters are identified only by name and never by position. Unknown parameters are ignored by the server side.
+# Method parameters are identified only by name and never by position. Unknown parameters are ignored by the server.
# If a new parameter is important and may not be ignored, on the client a parameter specific version requirement needs
# to be added.
# When parameters are removed, they need to be preserved as defaulted parameters on the client stubs so that older
diff --git a/src/borg/repository.py b/src/borg/repository.py
index c4b0f810d..673cf7584 100644
--- a/src/borg/repository.py
+++ b/src/borg/repository.py
@@ -881,13 +881,15 @@ class Repository:
#
# Now we crash. But only segment 2 gets deleted, while segment 1 is still around. Now key 1
# is suddenly undeleted (because the delete in segment 2 is now missing).
- # Again, note the requirement here. We delete these in the correct order that this doesn't happen,
- # and only if the FS materialization of these deletes is reordered or parts dropped this can happen.
- # In this case it doesn't cause outright corruption, 'just' an index count mismatch, which will be
- # fixed by borg-check --repair.
+ # Again, note the requirement here. We delete these in the correct order that this doesn't
+ # happen, and only if the FS materialization of these deletes is reordered or parts dropped
+ # this can happen.
+ # In this case it doesn't cause outright corruption, 'just' an index count mismatch, which
+ # will be fixed by borg-check --repair.
#
- # Note that in this check the index state is the proxy for a "most definitely settled" repository state,
- # i.e. the assumption is that *all* operations on segments <= index state are completed and stable.
+ # Note that in this check the index state is the proxy for a "most definitely settled"
+ # repository state, i.e. the assumption is that *all* operations on segments <= index state
+ # are completed and stable.
try:
new_segment, size = self.io.write_delete(key, raise_full=True)
except LoggedIO.SegmentFull:
diff --git a/src/borg/testsuite/crypto.py b/src/borg/testsuite/crypto.py
index 88386946c..4e0318996 100644
--- a/src/borg/testsuite/crypto.py
+++ b/src/borg/testsuite/crypto.py
@@ -315,7 +315,8 @@ def test_repo_key_detect_does_not_raise_integrity_error(getpass, monkeypatch):
This is a regression test for a bug I introduced and fixed:
Traceback (most recent call last):
- File "/home/user/borg-master/src/borg/testsuite/crypto.py", line 384, in test_repo_key_detect_does_not_raise_integrity_error
+ File "/home/user/borg-master/src/borg/testsuite/crypto.py", line 384,
+ in test_repo_key_detect_does_not_raise_integrity_error
RepoKey.detect(repository, manifest_data=None)
File "/home/user/borg-master/src/borg/crypto/key.py", line 402, in detect
if not key.load(target, passphrase):
@@ -335,7 +336,8 @@ def test_repo_key_detect_does_not_raise_integrity_error(getpass, monkeypatch):
1. FlexiKey.decrypt_key_file() is supposed to signal the decryption failure by returning None
2. FlexiKey.detect() relies on that interface - it tries an empty passphrase before prompting the user
- 3. my initial implementation of decrypt_key_file_argon2() was simply passing through the IntegrityError() from AES256_CTR_BASE.decrypt()
+ 3. my initial implementation of decrypt_key_file_argon2() was simply passing through the IntegrityError()
+ from AES256_CTR_BASE.decrypt()
"""
repository = MagicMock(id=b"repository_id")
getpass.return_value = "hello, pass phrase"
diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py
index 03070802d..aee14239c 100644
--- a/src/borg/testsuite/helpers.py
+++ b/src/borg/testsuite/helpers.py
@@ -178,11 +178,13 @@ class TestLocationWithoutEnv:
)
assert (
repr(Location("ssh://user@[2a02:0001:0002:0003:0004:0005:0006:0007]/some/path"))
- == "Location(proto='ssh', user='user', host='2a02:0001:0002:0003:0004:0005:0006:0007', port=None, path='/some/path')"
+ == "Location(proto='ssh', user='user', "
+ "host='2a02:0001:0002:0003:0004:0005:0006:0007', port=None, path='/some/path')"
)
assert (
repr(Location("ssh://user@[2a02:0001:0002:0003:0004:0005:0006:0007]:1234/some/path"))
- == "Location(proto='ssh', user='user', host='2a02:0001:0002:0003:0004:0005:0006:0007', port=1234, path='/some/path')"
+ == "Location(proto='ssh', user='user', "
+ "host='2a02:0001:0002:0003:0004:0005:0006:0007', port=1234, path='/some/path')"
)
def test_socket(self, monkeypatch, keys_dir):
diff --git a/src/borg/testsuite/locking.py b/src/borg/testsuite/locking.py
index 5010f164c..ea1bdb5f5 100644
--- a/src/borg/testsuite/locking.py
+++ b/src/borg/testsuite/locking.py
@@ -148,19 +148,19 @@ class TestExclusiveLock:
while not timer.timed_out():
cycle += 1
try:
- with ExclusiveLock(
- lockpath, id=id, timeout=timeout / 20, sleep=-1
- ): # This timeout is only for not exceeding the given timeout by more than 5%. With sleep<0 it's constantly polling anyway.
+ # This timeout is only for not exceeding the given timeout by more than 5%.
+ # With sleep<0 it's constantly polling anyway.
+ with ExclusiveLock(lockpath, id=id, timeout=timeout / 20, sleep=-1):
lock_owner_count = lock_owner_counter.incr()
print_locked(
- "Thread %2d: Acquired the lock. It's my %d. loop cycle. I am the %d. who has the lock concurrently."
- % (thread_id, cycle, lock_owner_count)
+ "Thread %2d: Acquired the lock. It's my %d. loop cycle. "
+ "I am the %d. who has the lock concurrently." % (thread_id, cycle, lock_owner_count)
)
time.sleep(0.005)
lock_owner_count = lock_owner_counter.decr()
print_locked(
- "Thread %2d: Releasing the lock, finishing my %d. loop cycle. Currently, %d colleagues still have the lock."
- % (thread_id, cycle, lock_owner_count)
+ "Thread %2d: Releasing the lock, finishing my %d. loop cycle. "
+ "Currently, %d colleagues still have the lock." % (thread_id, cycle, lock_owner_count)
)
except LockTimeout:
print_locked("Thread %2d: Got LockTimeout, finishing my %d. loop cycle." % (thread_id, cycle))
@@ -168,8 +168,8 @@ class TestExclusiveLock:
exception_count = exception_counter.incr()
e = format_exc()
print_locked(
- "Thread %2d: Exception thrown, finishing my %d. loop cycle. It's the %d. exception seen until now: %s"
- % (thread_id, cycle, exception_count, e)
+ "Thread %2d: Exception thrown, finishing my %d. loop cycle. "
+ "It's the %d. exception seen until now: %s" % (thread_id, cycle, exception_count, e)
)
print_locked("Thread %2d: Loop timed out--terminating after %d loop cycles." % (thread_id, cycle))
diff --git a/src/borg/testsuite/platform.py b/src/borg/testsuite/platform.py
index f1de49de9..14f8bed4b 100644
--- a/src/borg/testsuite/platform.py
+++ b/src/borg/testsuite/platform.py
@@ -186,7 +186,9 @@ class PlatformDarwinTestCase(BaseTestCase):
self.assert_equal(self.get_acl(file.name), {})
self.set_acl(
file.name,
- b"!#acl 1\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\nuser:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n",
+ b"!#acl 1\n"
+ b"group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\n"
+ b"user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n",
numeric_ids=False,
)
self.assert_in(
@@ -197,7 +199,9 @@ class PlatformDarwinTestCase(BaseTestCase):
)
self.set_acl(
file2.name,
- b"!#acl 1\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\nuser:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n",
+ b"!#acl 1\n"
+ b"group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\n"
+ b"user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n",
numeric_ids=True,
)
self.assert_in(