From b2fdc873660e5c8e33a182b5968d4f6619bfec44 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 3 Jun 2024 13:05:28 -0600 Subject: [PATCH] fix python black formatting Signed-off-by: Rich Megginson --- library/network_connections.py | 20 +++++++++---------- .../network_lsr/argument_validator.py | 6 +++--- tests/unit/test_network_connections.py | 1 - 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index cb95d68..7a16bb6 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -2524,11 +2524,11 @@ class Cmd_nm(Cmd): % ( con.get_id(), con.get_uuid(), - "not-active" - if not is_active - else "is-modified" - if is_modified - else "force-state-change", + ( + "not-active" + if not is_active + else "is-modified" if is_modified else "force-state-change" + ), ), ) self.connections_data_set_changed(idx) @@ -2784,11 +2784,11 @@ class Cmd_initscripts(Cmd): "up connection %s (%s)" % ( name, - "not-active" - if is_active is not True - else "is-modified" - if is_modified - else "force-state-change", + ( + "not-active" + if is_active is not True + else "is-modified" if is_modified else "force-state-change" + ), ), ) cmd = "ifup" diff --git a/module_utils/network_lsr/argument_validator.py b/module_utils/network_lsr/argument_validator.py index 867ca35..f65a7ac 100644 --- a/module_utils/network_lsr/argument_validator.py +++ b/module_utils/network_lsr/argument_validator.py @@ -477,7 +477,7 @@ class ArgValidatorDict(ArgValidator): items = list(value.items()) except AttributeError: raise ValidationError(name, "invalid content is not a dictionary") - for (setting, value) in items: + for setting, value in items: try: validator = self.nested[setting] except KeyError: @@ -493,7 +493,7 @@ class ArgValidatorDict(ArgValidator): except ValidationError as e: raise ValidationError(e.name, e.error_message) result[setting] = validated_value - for (setting, validator) in self.nested.items(): + for setting, validator in self.nested.items(): if setting in seen_keys: continue if validator.required: @@ -543,7 +543,7 @@ class ArgValidatorList(ArgValidator): value = [s for s in value.split(" ") if s] result = [] - for (idx, v) in enumerate(value): + for idx, v in enumerate(value): if (v is None or v == "") and self.remove_none_or_empty: continue try: diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 84a421d..cca6d7b 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -5270,7 +5270,6 @@ class TestValidatorDictBond(Python26CompatTestCase): ] def test_invalid_bond_option_ad(self): - """ Test the ad bond option restrictions """