Commit c3ec20ab authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[tools] Fix typos; reduce verbosity; return frozenset

parent 7708f5c4
......@@ -405,7 +405,7 @@ def get_all_macs(path):
:param: Filepath to be opened and in which solutions will be returned.
:type: <str>
:return: Set of MAC/CAM from the given path.
:rtype: <set <str>>
:rtype: <frozenset <str>>
"""
# Put all macs in a list, not a set
......@@ -428,16 +428,18 @@ def get_all_macs(path):
# Print the number of macs for the given file
LOGGER.info("File %s: MACS: %s", file, len(temp_macs))
LOGGER.info("Files processed: %s", file_number)
assert file_number != 0, "No *mac.txt files found!"
LOGGER.info("Files processed: %s", file_number)
# Check of duplicated macs (number > 1)
unique_macs = set(total_macs)
unique_macs = frozenset(total_macs)
duplicated_macs = {(k, v) for k, v in Counter(total_macs).items() if v != 1}
LOGGER.info("Duplicated MACS: %s", duplicated_macs)
LOGGER.info("Number of MACS loaded: %s", len(total_macs))
LOGGER.info("Number of unique MACS returned: %s", len(unique_macs))
if duplicated_macs:
LOGGER.info("<%s> Duplicated MACS: %s", path, duplicated_macs)
LOGGER.info("<%s> Number of MACS loaded: %s", path, len(total_macs))
LOGGER.info("<%s> Number of unique MACS returned: %s", path, len(unique_macs))
# assert len(total_macs) == len(unique_macs)
return unique_macs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment