Skip to content

Commit a3a8d61

Browse files
blacken src
1 parent 21f5116 commit a3a8d61

File tree

9 files changed

+28
-55
lines changed

9 files changed

+28
-55
lines changed

src/borg/archiver/__init__.py

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

6767

68-
69-
70-
7168
from .analyze_cmd import AnalyzeMixIn
7269
from .benchmark_cmd import BenchmarkMixIn
7370
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
@@ -89,29 +89,10 @@ def build_parser_tag(self, subparsers, common_parser, mid_common_parser):
8989
formatter_class=argparse.RawDescriptionHelpFormatter,
9090
)
9191
subparsers.add_subcommand("tag", subparser, help="tag archives")
92+
subparser.add_argument("--set", dest="set_tags", metavar="TAG", type=tag_validator, nargs="+", help="set tags")
93+
subparser.add_argument("--add", dest="add_tags", metavar="TAG", type=tag_validator, nargs="+", help="add tags")
9294
subparser.add_argument(
93-
"--set",
94-
dest="set_tags",
95-
metavar="TAG",
96-
type=tag_validator,
97-
nargs="+",
98-
help="set tags",
99-
)
100-
subparser.add_argument(
101-
"--add",
102-
dest="add_tags",
103-
metavar="TAG",
104-
type=tag_validator,
105-
nargs="+",
106-
help="add tags",
107-
)
108-
subparser.add_argument(
109-
"--remove",
110-
dest="remove_tags",
111-
metavar="TAG",
112-
type=tag_validator,
113-
nargs="+",
114-
help="remove tags",
95+
"--remove", dest="remove_tags", metavar="TAG", type=tag_validator, nargs="+", help="remove tags"
11596
)
11697
define_archive_filters_group(subparser)
11798
subparser.add_argument(

src/borg/helpers/jap_helpers.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,33 @@ def flatten_namespace(ns: Any) -> argparse.Namespace:
1111
internal dispatch and logic expect a flat namespace.
1212
"""
1313
flat = argparse.Namespace()
14-
14+
1515
# Extract the nested path of subcommands
1616
subcmds = []
1717
current = ns
1818
while current and hasattr(current, "subcommand") and current.subcommand:
1919
subcmds.append(current.subcommand)
2020
current = getattr(current, current.subcommand, None)
21-
21+
2222
if subcmds:
2323
flat.subcommand = " ".join(subcmds)
24-
24+
2525
def _flatten(source, target):
26-
items = vars(source).items() if hasattr(source, '__dict__') else source.items() if hasattr(source, 'items') else []
26+
items = (
27+
vars(source).items() if hasattr(source, "__dict__") else source.items() if hasattr(source, "items") else []
28+
)
2729
for k, v in items:
28-
if isinstance(v, argparse.Namespace) or type(v).__name__ == 'Namespace':
30+
if isinstance(v, argparse.Namespace) or type(v).__name__ == "Namespace":
2931
_flatten(v, target)
3032
else:
3133
if k != "subcommand" and not hasattr(target, k):
3234
setattr(target, k, v)
33-
35+
3436
_flatten(ns, flat)
35-
37+
3638
# Ensure list defaults previously handled by set_defaults are present
3739
for list_attr in ("paths", "patterns", "pattern_roots"):
3840
if getattr(flat, list_attr, None) is None:
3941
setattr(flat, list_attr, [])
40-
42+
4143
return flat

src/borg/testsuite/archiver/lock_cmds_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ def test_with_lock(tmp_path):
3535
# so that lock acquisition for command2 fails as the test expects it.
3636
lock_wait, execution_time, startup_wait = 2, 4, 1
3737
assert lock_wait < execution_time - startup_wait
38-
command1 = sys.executable, "-c", f'import time; print("first command - acquires the lock"); time.sleep({execution_time})'
38+
command1 = (
39+
sys.executable,
40+
"-c",
41+
f'import time; print("first command - acquires the lock"); time.sleep({execution_time})',
42+
)
3943
command2 = sys.executable, "-c", 'print("second command - should never get executed")'
4044
borgwl = borg_bin, "with-lock", f"--lock-wait={lock_wait}"
4145
popen_options = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, env=env)

src/borg/testsuite/archiver/serve_cmd_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def serve_socket(monkeypatch):
2525
socket_file = tempfile.mktemp(suffix=".sock", prefix="borg-", dir=get_runtime_dir())
2626
import sys
2727
import time
28+
2829
borg_bin = os.path.join(os.path.dirname(sys.executable), "borg")
2930
with subprocess.Popen([borg_bin, f"--socket={socket_file}", "serve"]) as p:
3031
while not os.path.exists(socket_file):

0 commit comments

Comments
 (0)