Browse Source

Switch some functions with many arguments to kwargs only.

Dan Helfman 6 years ago
parent
commit
e4d1b49c39
2 changed files with 21 additions and 12 deletions
  1. 20 11
      borgmatic/commands/borgmatic.py
  2. 1 1
      tests/unit/commands/test_borgmatic.py

+ 20 - 11
borgmatic/commands/borgmatic.py

@@ -144,7 +144,15 @@ def run_configuration(config_filename, args):  # pragma: no cover
         if args.create:
         if args.create:
             hook.execute_hook(hooks.get('before_backup'), config_filename, 'pre-backup')
             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:
         if args.create:
             hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup')
             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
         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 = []
     json_results = []
     for unexpanded_repository in location['repositories']:
     for unexpanded_repository in location['repositories']:
         _run_commands_on_repository(
         _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:
     if args.json:
         sys.stdout.write(json.dumps(json_results))
         sys.stdout.write(json.dumps(json_results))
 
 
 
 
 def _run_commands_on_repository(
 def _run_commands_on_repository(
+    *,
     args,
     args,
     consistency,
     consistency,
     json_results,
     json_results,

+ 1 - 1
tests/unit/commands/test_borgmatic.py

@@ -6,7 +6,7 @@ from flexmock import flexmock
 from borgmatic.commands import borgmatic
 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)
         flexmock(borgmatic)
         .should_receive('_run_commands_on_repository')
         .should_receive('_run_commands_on_repository')