From e4d1b49c392ff692ef01075263420f3e1a8e191d Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 13 Oct 2018 15:19:16 -0700 Subject: [PATCH] Switch some functions with many arguments to kwargs only. --- borgmatic/commands/borgmatic.py | 31 +++++++++++++++++---------- tests/unit/commands/test_borgmatic.py | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index 7dbe031b..3e418779 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -144,7 +144,15 @@ def run_configuration(config_filename, args): # pragma: no cover if args.create: hook.execute_hook(hooks.get('before_backup'), config_filename, 'pre-backup') - _run_commands(args, consistency, local_path, location, remote_path, retention, storage) + _run_commands( + args=args, + consistency=consistency, + local_pagh=local_path, + location=location, + remote_path=remote_path, + retention=retention, + storage=storage, + ) if args.create: hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup') @@ -153,25 +161,26 @@ def run_configuration(config_filename, args): # pragma: no cover raise -def _run_commands(args, consistency, local_path, location, remote_path, retention, storage): +def _run_commands(*, args, consistency, local_path, location, remote_path, retention, storage): json_results = [] for unexpanded_repository in location['repositories']: _run_commands_on_repository( - args, - consistency, - json_results, - local_path, - location, - remote_path, - retention, - storage, - unexpanded_repository, + args=args, + consistency=consistency, + json_results=json_results, + local_path=local_path, + location=location, + remote_path=remote_path, + retention=retention, + storage=storage, + unexpanded_repository=unexpanded_repository, ) if args.json: sys.stdout.write(json.dumps(json_results)) def _run_commands_on_repository( + *, args, consistency, json_results, diff --git a/tests/unit/commands/test_borgmatic.py b/tests/unit/commands/test_borgmatic.py index 20af02d8..943f9aae 100644 --- a/tests/unit/commands/test_borgmatic.py +++ b/tests/unit/commands/test_borgmatic.py @@ -6,7 +6,7 @@ from flexmock import flexmock from borgmatic.commands import borgmatic -def test__run_commands_handles_multiple_json_outputs_in_array(): +def test_run_commands_handles_multiple_json_outputs_in_array(): ( flexmock(borgmatic) .should_receive('_run_commands_on_repository')