From c1b0002bc9e9953a477037106474892202057e94 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 3 May 2021 10:26:41 -0600 Subject: [PATCH] fix python black issues There was recently an upgrade to python black which made function documentation checking stricter. This caused network tox CI to break. The fix is to format the function doc text in the manner expected by black. Signed-off-by: Rich Megginson --- library/network_connections.py | 12 ++++++------ module_utils/network_lsr/utils.py | 2 +- tests/unit/test_network_connections.py | 10 +++++----- tests/unit/test_nm_provider.py | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index b1a8a69..6096ebc 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -1175,7 +1175,7 @@ class NMUtil: return True def create_checkpoint(self, timeout): - """ Create a new checkpoint """ + """Create a new checkpoint""" checkpoint = Util.call_async_method( self.nmclient, "checkpoint_create", @@ -1192,11 +1192,11 @@ class NMUtil: return None def destroy_checkpoint(self, path): - """ Destroy the specified checkpoint """ + """Destroy the specified checkpoint""" Util.call_async_method(self.nmclient, "checkpoint_destroy", [path]) def rollback_checkpoint(self, path): - """ Rollback the specified checkpoint """ + """Rollback the specified checkpoint""" Util.call_async_method( self.nmclient, "checkpoint_rollback", @@ -1863,10 +1863,10 @@ class Cmd(object): ) def start_transaction(self): - """ Hook before making changes """ + """Hook before making changes""" def finish_transaction(self): - """ Hook for after all changes where made successfuly """ + """Hook for after all changes where made successfuly""" def rollback_transaction(self, idx, action, error): """Hook if configuring a profile results in an error @@ -1885,7 +1885,7 @@ class Cmd(object): ) def on_failure(self): - """ Hook to do any cleanup on failure before exiting """ + """Hook to do any cleanup on failure before exiting""" pass def run_action_absent(self, idx): diff --git a/module_utils/network_lsr/utils.py b/module_utils/network_lsr/utils.py index 1231225..7f672ce 100644 --- a/module_utils/network_lsr/utils.py +++ b/module_utils/network_lsr/utils.py @@ -138,7 +138,7 @@ class Util: @classmethod def call_async_method(cls, object_, action, args, mainloop_timeout=10): - """ Asynchronously call a NetworkManager method """ + """Asynchronously call a NetworkManager method""" cancellable = cls.create_cancellable() async_action = action + "_async" # NM does not use a uniform naming for the async methods, diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index b14e7b3..a500292 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -2795,13 +2795,13 @@ class TestValidator(unittest.TestCase): ) def test_interface_name_ethernet_default(self): - """ Use the profile name as interface_name for ethernet profiles """ + """Use the profile name as interface_name for ethernet profiles""" cons_without_interface_name = [{"name": "eth0", "type": "ethernet"}] connections = ARGS_CONNECTIONS.validate(cons_without_interface_name) self.assertTrue(connections[0]["interface_name"] == "eth0") def test_interface_name_ethernet_mac(self): - """ Do not set interface_name when mac is specified """ + """Do not set interface_name when mac is specified""" cons_without_interface_name = [ {"name": "eth0", "type": "ethernet", "mac": "3b:0b:88:16:6d:1a"} ] @@ -2809,7 +2809,7 @@ class TestValidator(unittest.TestCase): self.assertTrue(connections[0]["interface_name"] is None) def test_interface_name_ethernet_empty(self): - """ Allow not to restrict the profile to an interface """ + """Allow not to restrict the profile to an interface""" network_connections = [ {"name": "internal_network", "type": "ethernet", "interface_name": ""} ] @@ -2818,7 +2818,7 @@ class TestValidator(unittest.TestCase): self.assertTrue(connections[0]["interface_name"] is None) def test_interface_name_ethernet_None(self): - """ Check that interface_name cannot be None """ + """Check that interface_name cannot be None""" network_connections = [ {"name": "internal_network", "type": "ethernet", "interface_name": None} ] @@ -2827,7 +2827,7 @@ class TestValidator(unittest.TestCase): ) def test_interface_name_ethernet_explicit(self): - """ Use the explicitly provided interface name """ + """Use the explicitly provided interface name""" network_connections = [ {"name": "internal", "type": "ethernet", "interface_name": "eth0"} ] diff --git a/tests/unit/test_nm_provider.py b/tests/unit/test_nm_provider.py index ed8563f..1163584 100644 --- a/tests/unit/test_nm_provider.py +++ b/tests/unit/test_nm_provider.py @@ -25,14 +25,14 @@ with mock.patch.dict("sys.modules", {"gi": mock.Mock(), "gi.repository": mock.Mo def test_get_nm_ethtool_feature(): - """ Test get_nm_ethtool_feature() """ + """Test get_nm_ethtool_feature()""" with mock.patch.object(nm_provider.Util, "NM") as nm_mock: nm_feature = nm_provider.get_nm_ethtool_feature("esp_hw_offload") assert nm_feature == nm_mock.return_value.ETHTOOL_OPTNAME_FEATURE_ESP_HW_OFFLOAD def test_get_nm_ethtool_coalesce(): - """ Test get_nm_ethtool_coalesce() """ + """Test get_nm_ethtool_coalesce()""" with mock.patch.object(nm_provider.Util, "NM") as nm_mock: nm_feature = nm_provider.get_nm_ethtool_coalesce("rx_frames") assert nm_feature == nm_mock.return_value.ETHTOOL_OPTNAME_COALESCE_RX_FRAMES