1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-01 12:45:34 +00:00

Archive.extract_item: remove unused params, make most params kwargs

stripped_components: this is done already in do_extract, it modifies item.path accordingly.

original_path: not used any more.

also: run black.
This commit is contained in:
Thomas Waldmann 2023-04-16 13:42:33 +02:00
parent 0679cbd410
commit 9e534c1929
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 2 additions and 24 deletions

View file

@ -780,18 +780,7 @@ def extract_helper(self, item, path, hlm, *, dry_run=False):
# In this case, we *want* to extract twice, because there is no other way.
pass
def extract_item(
self,
item,
restore_attrs=True,
dry_run=False,
stdout=False,
sparse=False,
hlm=None,
stripped_components=0,
original_path=None,
pi=None,
):
def extract_item(self, item, *, restore_attrs=True, dry_run=False, stdout=False, sparse=False, hlm=None, pi=None):
"""
Extract archive item.
@ -801,8 +790,6 @@ def extract_item(
:param stdout: write extracted data to stdout
:param sparse: write sparse files (chunk-granularity, independent of the original being sparse)
:param hlm: maps hlid to link_target for extracting subtrees with hardlinks correctly
:param stripped_components: stripped leading path components to correct hard link extraction
:param original_path: 'path' key as stored in archive
:param pi: ProgressIndicatorPercent (or similar) for file extraction progress (in bytes)
"""
has_damaged_chunks = "chunks_healthy" in item
@ -834,7 +821,6 @@ def extract_item(
raise BackupError("File has damaged (all-zero) chunks. Try running borg check --repair.")
return
original_path = original_path or item.path
dest = self.cwd
if item.path.startswith(("/", "../")):
raise Exception("Path should be relative and local")

View file

@ -75,15 +75,7 @@ def do_extract(self, args, repository, manifest, archive):
dirs.append(item)
archive.extract_item(item, stdout=stdout, restore_attrs=False)
else:
archive.extract_item(
item,
stdout=stdout,
sparse=sparse,
hlm=hlm,
stripped_components=strip_components,
original_path=orig_path,
pi=pi,
)
archive.extract_item(item, stdout=stdout, sparse=sparse, hlm=hlm, pi=pi)
except (BackupOSError, BackupError) as e:
self.print_warning("%s: %s", remove_surrogates(orig_path), e)