exact matching: use set for invalid (#28537)

use set
old-commit-hash: fcc268b8be
beeps
Shane Smiskol 2 years ago committed by GitHub
parent 5400564d71
commit 1b7d771059
  1. 6
      selfdrive/car/fw_versions.py

@ -106,7 +106,7 @@ def match_fw_to_car_exact(fw_versions_dict, log=True) -> Set[str]:
FW versions for a list of "essential" ECUs. If an ECU is not considered FW versions for a list of "essential" ECUs. If an ECU is not considered
essential the FW version can be missing to get a fingerprint, but if it's present it essential the FW version can be missing to get a fingerprint, but if it's present it
needs to match the database.""" needs to match the database."""
invalid = [] invalid = set()
candidates = FW_VERSIONS candidates = FW_VERSIONS
for candidate, fws in candidates.items(): for candidate, fws in candidates.items():
@ -130,10 +130,10 @@ def match_fw_to_car_exact(fw_versions_dict, log=True) -> Set[str]:
continue continue
if not any([found_version in expected_versions for found_version in found_versions]): if not any([found_version in expected_versions for found_version in found_versions]):
invalid.append(candidate) invalid.add(candidate)
break break
return set(candidates.keys()) - set(invalid) return set(candidates.keys()) - invalid
def match_fw_to_car(fw_versions, allow_exact=True, allow_fuzzy=True, log=True): def match_fw_to_car(fw_versions, allow_exact=True, allow_fuzzy=True, log=True):

Loading…
Cancel
Save