From cc591c47f2c173c04c972719fa68b74e78ba8a62 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 7 Jun 2023 14:41:28 -0700 Subject: [PATCH] copilot no good --- selfdrive/car/hyundai/values.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 5f69b5e36d..a654ee4b0d 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -360,19 +360,12 @@ def get_platform_codes(fw_versions: List[bytes]) -> Set[bytes]: for code, dates in codes.items(): min_date = min(dates) max_date = max(dates) - min_year, min_month = int(min_date[:2]), int(min_date[2:]) + current_year, current_month = int(min_date[:2]), int(min_date[2:]) max_year, max_month = int(max_date[:2]), int(max_date[2:]) - # Add all dates between the two as bytes: - for year in range(min_year, max_year + 1): - for month in range(1, 13): - if year == min_year and month < min_month: - continue - if year == max_year and month > max_month: - continue - - final_codes.add(code + b'_' + (str(year).zfill(2) + str(month).zfill(2)).encode()) - - print(code, [d for d in dates], min_date, max_date) + while current_year < max_year or current_month <= max_month: + final_codes.add(code + b'_' + (str(current_year).zfill(2) + str(current_month).zfill(2)).encode()) + current_year += (current_month + 1) // 13 + current_month = (current_month % 12) + 1 print('final_codes', final_codes)