Skip to content

Commit

Permalink
Use set to delete checking uniqueness in if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Aug 14, 2024
1 parent db357d5 commit b48d82a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mlx/coverity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,16 @@ def handle_attribute_filter(self, attribute_values, name, valid_attributes, allo
list[str]: The list of valid attributes
"""
logging.info("Using %s filter [%s]", name, attribute_values)
filter_values = []
filter_values = set()
for field in attribute_values.split(","):
if not valid_attributes or field in valid_attributes:
logging.info("Classification [%s] is valid", field)
filter_values.append(field)
filter_values.add(field)
elif allow_regex:
pattern = re.compile(field)
for element in valid_attributes:
if pattern.search(element) and element not in filter_values:
filter_values.append(element)
if pattern.search(element):
filter_values.add(element)
else:
logging.error("Invalid %s filter: %s", name, field)
return filter_values
Expand Down

0 comments on commit b48d82a

Please sign in to comment.