Skip to content

Commit 3630eaa

Browse files
replace deprecated argparse.FileType, fixes #9266
also: fix trailing whitespace in archiver.py.
1 parent f379420 commit 3630eaa

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/borg/archiver.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,8 +2406,8 @@ def do_debug_dump_hints(self, args, repository):
24062406
def do_debug_convert_profile(self, args):
24072407
"""convert Borg profile to Python profile"""
24082408
import marshal
2409-
with args.output, args.input:
2410-
marshal.dump(msgpack.unpack(args.input, use_list=False, raw=False), args.output)
2409+
with open(args.input, 'rb') as input_file, open(args.output, 'wb') as output_file:
2410+
marshal.dump(msgpack.unpack(input_file, use_list=False, raw=False), output_file)
24112411

24122412
@with_repository(lock=False, manifest=False)
24132413
def do_break_lock(self, args, repository):
@@ -3227,8 +3227,8 @@ def define_borg_mount(parser):
32273227
archives and the directory structure below these will be loaded on-demand from
32283228
the repository when entering these directories, so expect some delay.
32293229
3230-
Care should be taken, as Borg backs up symlinks as-is. When an archive
3231-
or repository is mounted, it is possible to “jump” outside the mount point
3230+
Care should be taken, as Borg backs up symlinks as-is. When an archive
3231+
or repository is mounted, it is possible to “jump” outside the mount point
32323232
by following a symlink. If this happens, files or directories (or versions of them)
32333233
that are not part of the archive or repository may appear to be within the mount point.
32343234
@@ -4140,10 +4140,8 @@ def define_borg_mount(parser):
41404140
formatter_class=argparse.RawDescriptionHelpFormatter,
41414141
help='convert Borg profile to Python profile (debug)')
41424142
subparser.set_defaults(func=self.do_debug_convert_profile)
4143-
subparser.add_argument('input', metavar='INPUT', type=argparse.FileType('rb'),
4144-
help='Borg profile')
4145-
subparser.add_argument('output', metavar='OUTPUT', type=argparse.FileType('wb'),
4146-
help='Output file')
4143+
subparser.add_argument('input', metavar='INPUT', type=str, help='Borg profile')
4144+
subparser.add_argument('output', metavar='OUTPUT', type=str, help='Output file')
41474145

41484146
# borg delete
41494147
delete_epilog = process_epilog("""

0 commit comments

Comments
 (0)