Skip to content

Commit

Permalink
fix(gathered_filter): Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesholland-uk committed Sep 8, 2023
1 parent e9c6cf0 commit d72e8f9
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions plugins/module_utils/panos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,31 +1225,43 @@ def matches_gathered_filter(self, item, logic):
raise Exception(err_msg)

if operator == "==":
evaler.append("{0}".format("{0}".format(item_config[field]) == value))
evaler.append(
"{0}".format("{0}".format(item_config[field]) == value)
)
elif operator == "!=":
evaler.append("{0}".format("{0}".format(item_config[field]) != value))
evaler.append(
"{0}".format("{0}".format(item_config[field]) != value)
)
elif operator == "<":
evaler.append(
"{0}".format(
False if value is None else item_config[field] < float(value)
False
if value is None
else item_config[field] < float(value)
)
)
elif operator == "<=":
evaler.append(
"{0}".format(
False if value is None else item_config[field] <= float(value)
False
if value is None
else item_config[field] <= float(value)
)
)
elif operator == ">":
evaler.append(
"{0}".format(
False if value is None else item_config[field] > float(value)
False
if value is None
else item_config[field] > float(value)
)
)
elif operator == ">=":
evaler.append(
"{0}".format(
False if value is None else item_config[field] >= float(value)
False
if value is None
else item_config[field] >= float(value)
)
)
elif operator == "contains":
Expand All @@ -1265,7 +1277,9 @@ def matches_gathered_filter(self, item, logic):
"{0}".format(not (item_config[field] or "").startswith(value))
)
elif operator == "ends-with":
evaler.append("{0}".format((item_config[field] or "").endswith(value)))
evaler.append(
"{0}".format((item_config[field] or "").endswith(value))
)
elif operator == "does-not-end-with":
evaler.append(
"{0}".format(not (item_config[field] or "").endswith(value))
Expand All @@ -1278,7 +1292,9 @@ def matches_gathered_filter(self, item, logic):
)
elif operator == "does-not-match-regex":
evaler.append(
"{0}".format(re.search(value, (item_config[field] or "")) is None)
"{0}".format(
re.search(value, (item_config[field] or "")) is None
)
)
elif operator == "contains-regex":
prog = re.compile(value)
Expand Down

0 comments on commit d72e8f9

Please sign in to comment.