diff --git a/borgmatic/config/generate.py b/borgmatic/config/generate.py index 4d3cda78..e22c452c 100644 --- a/borgmatic/config/generate.py +++ b/borgmatic/config/generate.py @@ -168,9 +168,11 @@ def render_configuration(config): rendered, # Dumping certain values (integers, for instance) causes ruamel.yaml to append an # end-of-document "..." marker. Strip it. - transform=lambda dumped: dumped[: -len(RUAMEL_YAML_END_OF_DOCUMENT_MARKER)] - if dumped.endswith(RUAMEL_YAML_END_OF_DOCUMENT_MARKER) - else dumped, + transform=lambda dumped: ( + dumped[: -len(RUAMEL_YAML_END_OF_DOCUMENT_MARKER)] + if dumped.endswith(RUAMEL_YAML_END_OF_DOCUMENT_MARKER) + else dumped + ), ) return rendered.getvalue() diff --git a/tests/unit/borg/test_environment.py b/tests/unit/borg/test_environment.py index dcb5375c..1b49ba7c 100644 --- a/tests/unit/borg/test_environment.py +++ b/tests/unit/borg/test_environment.py @@ -103,7 +103,6 @@ def test_make_environment_without_configuration_passes_through_default_environme 'BORG_DEBUG_PASSPHRASE': 'nah', 'BORG_DISPLAY_PASSPHRASE': 'yup', 'BORG_MSGPACK_VERSION_CHECK': 'yup', - }, ) flexmock(module.borgmatic.hooks.credential.parse).should_receive( diff --git a/tests/unit/commands/test_arguments.py b/tests/unit/commands/test_arguments.py index 0fad32e7..0606a1d2 100644 --- a/tests/unit/commands/test_arguments.py +++ b/tests/unit/commands/test_arguments.py @@ -329,10 +329,12 @@ def test_parse_arguments_for_actions_consumes_action_arguments_after_action_name remaining = flexmock() flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace}, - ) - or remaining, + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace}, + ) + or remaining + ), ) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = {'action': flexmock(), 'other': flexmock()} @@ -355,10 +357,12 @@ def test_parse_arguments_for_actions_consumes_action_arguments_with_alias(): remaining = flexmock() flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {canonical or action: action_namespace}, - ) - or remaining, + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {canonical or action: action_namespace}, + ) + or remaining + ), ) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -387,10 +391,12 @@ def test_parse_arguments_for_actions_consumes_multiple_action_arguments(): other_namespace = flexmock(bar=3) flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace if action == 'action' else other_namespace}, - ) - or (), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace if action == 'action' else other_namespace}, + ) + or () + ), ).and_return(('other', '--bar', '3')).and_return('action', '--foo', 'true') flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -420,10 +426,12 @@ def test_parse_arguments_for_actions_respects_command_line_action_ordering(): action_namespace = flexmock(foo=True) flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: other_namespace if action == 'other' else action_namespace}, - ) - or (), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: other_namespace if action == 'other' else action_namespace}, + ) + or () + ), ).and_return(('action',)).and_return(('other', '--foo', 'true')) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -458,10 +466,12 @@ def test_parse_arguments_for_actions_applies_default_action_parsers(): flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: namespaces.get(action)}, - ) - or (), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: namespaces.get(action)}, + ) + or () + ), ).and_return(()) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -488,10 +498,12 @@ def test_parse_arguments_for_actions_consumes_global_arguments(): action_namespace = flexmock() flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace}, - ) - or ('--verbosity', 'lots'), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace}, + ) + or ('--verbosity', 'lots') + ), ) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -516,10 +528,12 @@ def test_parse_arguments_for_actions_passes_through_unknown_arguments_before_act action_namespace = flexmock() flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace}, - ) - or ('--wtf', 'yes'), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace}, + ) + or ('--wtf', 'yes') + ), ) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -544,10 +558,12 @@ def test_parse_arguments_for_actions_passes_through_unknown_arguments_after_acti action_namespace = flexmock() flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace}, - ) - or ('--wtf', 'yes'), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace}, + ) + or ('--wtf', 'yes') + ), ) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = { @@ -572,10 +588,12 @@ def test_parse_arguments_for_actions_with_borg_action_skips_other_action_parsers action_namespace = flexmock(options=[]) flexmock(module).should_receive('get_subaction_parsers').and_return({}) flexmock(module).should_receive('parse_and_record_action_arguments').replace_with( - lambda unparsed, parsed, parser, action, canonical=None: parsed.update( - {action: action_namespace}, - ) - or (), + lambda unparsed, parsed, parser, action, canonical=None: ( + parsed.update( + {action: action_namespace}, + ) + or () + ), ).and_return(()) flexmock(module).should_receive('get_subactions_for_actions').and_return({}) action_parsers = {