Skip to content

Commit 7db38a1

Browse files
blacken src
1 parent 074aaa1 commit 7db38a1

File tree

7 files changed

+20
-52
lines changed

7 files changed

+20
-52
lines changed

src/borg/archiver/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@
6666
PURE_PYTHON_MSGPACK_WARNING = "Using a pure-python msgpack! This will result in lower performance."
6767

6868

69-
70-
71-
7269
from .analyze_cmd import AnalyzeMixIn
7370
from .benchmark_cmd import BenchmarkMixIn
7471
from .check_cmd import CheckMixIn

src/borg/archiver/_common.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,8 @@ def process_epilog(epilog):
269269

270270

271271
def define_exclude_and_patterns(add_option, *, tag_files=False, strip_components=False):
272-
add_option(
273-
"--pattern-roots-internal",
274-
dest="pattern_roots",
275-
action="append",
276-
default=[],
277-
help=argparse.SUPPRESS,
278-
)
279-
add_option(
280-
"--patterns-internal",
281-
dest="patterns",
282-
action="append",
283-
default=[],
284-
help=argparse.SUPPRESS,
285-
)
272+
add_option("--pattern-roots-internal", dest="pattern_roots", action="append", default=[], help=argparse.SUPPRESS)
273+
add_option("--patterns-internal", dest="patterns", action="append", default=[], help=argparse.SUPPRESS)
286274
add_option(
287275
"-e",
288276
"--exclude",

src/borg/archiver/benchmark_cmd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ def build_parser_benchmarks(self, subparsers, common_parser, mid_common_parser):
408408
epilog=bench_crud_epilog,
409409
formatter_class=argparse.RawDescriptionHelpFormatter,
410410
)
411-
benchmark_parsers.add_subcommand("crud", subparser, help="benchmarks Borg CRUD (create, extract, update, delete).")
411+
benchmark_parsers.add_subcommand(
412+
"crud", subparser, help="benchmarks Borg CRUD (create, extract, update, delete)."
413+
)
412414

413415
subparser.add_argument("path", metavar="PATH", help="path where to create benchmark input data")
414416
subparser.add_argument("--json-lines", action="store_true", help="Format output as JSON Lines.")

src/borg/archiver/debug_cmd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ def build_parser_debug(self, subparsers, common_parser, mid_common_parser):
568568
epilog=debug_convert_profile_epilog,
569569
formatter_class=argparse.RawDescriptionHelpFormatter,
570570
)
571-
debug_parsers.add_subcommand("convert-profile", subparser, help="convert Borg profile to Python profile (debug)")
571+
debug_parsers.add_subcommand(
572+
"convert-profile", subparser, help="convert Borg profile to Python profile (debug)"
573+
)
572574
subparser.add_argument("input", metavar="INPUT", type=str, help="Borg profile")
573575
subparser.add_argument("output", metavar="OUTPUT", type=str, help="Output file")

src/borg/archiver/help_cmd.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,7 @@ def do_subcommand_help(self, parser, args):
555555
do_maincommand_help = do_subcommand_help
556556

557557
def build_parser_help(self, subparsers, common_parser, mid_common_parser, parser):
558-
subparser = ArgumentParser(
559-
parents=[common_parser],
560-
add_help=False,
561-
description="Extra help",
562-
)
558+
subparser = ArgumentParser(parents=[common_parser], add_help=False, description="Extra help")
563559
subparsers.add_subcommand("help", subparser, help="Extra help")
564560
subparser.add_argument("--epilog-only", dest="epilog_only", action="store_true")
565561
subparser.add_argument("--usage-only", dest="usage_only", action="store_true")

src/borg/archiver/tag_cmd.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,10 @@ def build_parser_tag(self, subparsers, common_parser, mid_common_parser):
9090
formatter_class=argparse.RawDescriptionHelpFormatter,
9191
)
9292
subparsers.add_subcommand("tag", subparser, help="tag archives")
93+
subparser.add_argument("--set", dest="set_tags", metavar="TAG", type=tag_validator, nargs="+", help="set tags")
94+
subparser.add_argument("--add", dest="add_tags", metavar="TAG", type=tag_validator, nargs="+", help="add tags")
9395
subparser.add_argument(
94-
"--set",
95-
dest="set_tags",
96-
metavar="TAG",
97-
type=tag_validator,
98-
nargs="+",
99-
help="set tags",
100-
)
101-
subparser.add_argument(
102-
"--add",
103-
dest="add_tags",
104-
metavar="TAG",
105-
type=tag_validator,
106-
nargs="+",
107-
help="add tags",
108-
)
109-
subparser.add_argument(
110-
"--remove",
111-
dest="remove_tags",
112-
metavar="TAG",
113-
type=tag_validator,
114-
nargs="+",
115-
help="remove tags",
96+
"--remove", dest="remove_tags", metavar="TAG", type=tag_validator, nargs="+", help="remove tags"
11697
)
11798
define_archive_filters_group(subparser)
11899
subparser.add_argument(

src/borg/helpers/jap_helpers.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@ def flatten_namespace(ns: Any) -> argparse.Namespace:
99
internal dispatch and logic expect a flat namespace.
1010
"""
1111
flat = argparse.Namespace()
12-
12+
1313
# Extract the nested path of subcommands
1414
subcmds = []
1515
current = ns
1616
while current and hasattr(current, "subcommand") and current.subcommand:
1717
subcmds.append(current.subcommand)
1818
current = getattr(current, current.subcommand, None)
19-
19+
2020
if subcmds:
2121
flat.subcommand = " ".join(subcmds)
22-
22+
2323
def _flatten(source, target):
24-
items = vars(source).items() if hasattr(source, '__dict__') else source.items() if hasattr(source, 'items') else []
24+
items = (
25+
vars(source).items() if hasattr(source, "__dict__") else source.items() if hasattr(source, "items") else []
26+
)
2527
for k, v in items:
26-
if isinstance(v, argparse.Namespace) or type(v).__name__ == 'Namespace':
28+
if isinstance(v, argparse.Namespace) or type(v).__name__ == "Namespace":
2729
_flatten(v, target)
2830
else:
2931
if k != "subcommand" and not hasattr(target, k):
3032
setattr(target, k, v)
31-
33+
3234
_flatten(ns, flat)
3335
return flat

0 commit comments

Comments
 (0)