Skip to content

Commit

Permalink
Fix PEP8 sanity errors
Browse files Browse the repository at this point in the history
  • Loading branch information
allenrobel committed Apr 21, 2024
1 parent c79dc3c commit 151c834
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
3 changes: 2 additions & 1 deletion plugins/module_utils/fabric/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ansible_collections.cisco.dcnm.plugins.module_utils.common.conversion import \
ConversionUtils


class FabricCommon:
"""
Common methods used by the other classes supporting
Expand Down Expand Up @@ -124,7 +125,7 @@ def _fixup_payloads_to_commit(self) -> None:
"""
method_name = inspect.stack()[0][3]
for payload in self._payloads_to_commit:
if not "ANYCAST_GW_MAC" in payload:
if "ANYCAST_GW_MAC" not in payload:
continue
try:
payload["ANYCAST_GW_MAC"] = self.translate_mac_address(
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/fabric/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _verify_fabric_can_be_deleted(self, fabric_name):

if self.fabric_summary.fabric_is_empty is True:
return
msg = f"{self.class_name}.{method_name}: "
msg = f"{self.class_name}.{method_name}: "
msg += f"Fabric {fabric_name} cannot be deleted since it is not "
msg += "empty. Remove all devices from the fabric and try again."
raise ValueError(msg)
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/fabric/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def __init__(self):
self._init_properties()

def _init_properties(self):
"""
"""
""" """
self.properties = {}
self.properties["fabric_name"] = None
self.properties["template_name"] = None
Expand Down
6 changes: 4 additions & 2 deletions plugins/module_utils/fabric/fabric_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def refresh_super(self):

self.data = {}
if self.rest_send.response_current.get("DATA") is None:
# The DATA key should always be present. We should never hit this.
# The DATA key should always be present. We should never hit this.
self._update_results()
return
for item in self.rest_send.response_current.get("DATA"):
Expand Down Expand Up @@ -376,7 +376,9 @@ def _get_nv_pair(self, item):
raise ValueError(msg)

return self.conversion.make_none(
self.conversion.make_boolean(self.data_subclass[self.filter].get("nvPairs").get(item))
self.conversion.make_boolean(
self.data_subclass[self.filter].get("nvPairs").get(item)
)
)

@property
Expand Down
4 changes: 3 additions & 1 deletion plugins/module_utils/fabric/fabric_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def _verify_controller_response(self):
"""
method_name = inspect.stack()[0][3]

controller_return_code = self.rest_send.response_current.get("RETURN_CODE", None)
controller_return_code = self.rest_send.response_current.get(
"RETURN_CODE", None
)
controller_message = self.rest_send.response_current.get("MESSAGE", None)
if controller_return_code != 200:
msg = f"{self.class_name}.{method_name}: "
Expand Down
4 changes: 3 additions & 1 deletion plugins/module_utils/fabric/param_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import json
import logging
import re

from ansible_collections.cisco.dcnm.plugins.module_utils.common.conversion import \
ConversionUtils


class ParamInfo:
"""
Given a parameter, return a python dict containing parameter info.
Expand Down Expand Up @@ -212,7 +214,7 @@ def _get_max(self, parameter):
return None
return self.conversion.make_int(value)

def _get_param_name(self,parameter):
def _get_param_name(self, parameter):
"""
- Return the ``name`` key from the parameter dict.
- Raise ``KeyError`` if ``name`` key is missing
Expand Down
9 changes: 5 additions & 4 deletions plugins/module_utils/fabric/ruleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import json
import logging
import re

from ansible_collections.cisco.dcnm.plugins.module_utils.common.conversion import \
ConversionUtils


class RuleSetCommon:
"""
Common methods for the RuleSet class.
Expand All @@ -26,7 +28,6 @@ def __init__(self) -> None:
self.properties["template"] = None
self.properties["ruleset"] = {}


def clean_rule(self):
"""
Clean the rule string.
Expand Down Expand Up @@ -214,7 +215,7 @@ def _update_ruleset_no_boolean(self):
}
]
}
}
}
"""
method_name = inspect.stack()[0][3]
Expand Down Expand Up @@ -277,7 +278,7 @@ def _update_ruleset_boolean(self):
```
- Ruleset Structure (OR):
```python
STP_BRIDGE_PRIORITY: {
"terms": {
Expand All @@ -295,7 +296,7 @@ def _update_ruleset_boolean(self):
]
}
}
```
```
"""
if "and" in self.rule:
boolean_type = "and"
Expand Down
10 changes: 4 additions & 6 deletions plugins/module_utils/fabric/verify_playbook_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,13 +713,11 @@ def verify_parameter(self):
self.log.debug(msg)

param_rule = self._ruleset.ruleset[self.parameter]
case_and_rule = (
"and" in param_rule.get("terms") and
"or" not in param_rule.get("terms")
case_and_rule = "and" in param_rule.get("terms") and "or" not in param_rule.get(
"terms"
)
case_or_rule = (
"or" in param_rule.get("terms") and
"and" not in param_rule.get("terms")
case_or_rule = "or" in param_rule.get("terms") and "and" not in param_rule.get(
"terms"
)
case_na_rule = "na" in param_rule.get("terms")
try:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/dcnm_fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
default: False
auto_symmetric_vrf_lite:
description:
- Enable (True) or disable (False) auto generation of Whether to auto generate VRF LITE sub-interface and BGP peering configuration on managed neighbor devices.
- Enable (True) or disable (False) auto generation of VRF LITE sub-interface and BGP peering configuration on managed neighbor devices.
- If True, auto created VRF Lite IFC links will have 'Auto Deploy for Peer' enabled.
- NDFC GUI label, Auto Deploy for Peer
- NDFC GUI tab, Resources
Expand Down

0 comments on commit 151c834

Please sign in to comment.