values: use union arguments (#32258)

* use get_args to reduce duplication

* clean up
old-commit-hash: f427427b5e
pull/32199/head
Shane Smiskol 1 year ago committed by GitHub
parent 616b048906
commit 5ce8d5c4da
  1. 6
      selfdrive/car/values.py

@ -1,4 +1,4 @@
from typing import cast from typing import get_args
from openpilot.selfdrive.car.body.values import CAR as BODY from openpilot.selfdrive.car.body.values import CAR as BODY
from openpilot.selfdrive.car.chrysler.values import CAR as CHRYSLER from openpilot.selfdrive.car.chrysler.values import CAR as CHRYSLER
from openpilot.selfdrive.car.ford.values import CAR as FORD from openpilot.selfdrive.car.ford.values import CAR as FORD
@ -14,6 +14,6 @@ from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
from openpilot.selfdrive.car.volkswagen.values import CAR as VOLKSWAGEN from openpilot.selfdrive.car.volkswagen.values import CAR as VOLKSWAGEN
Platform = BODY | CHRYSLER | FORD | GM | HONDA | HYUNDAI | MAZDA | MOCK | NISSAN | SUBARU | TESLA | TOYOTA | VOLKSWAGEN Platform = BODY | CHRYSLER | FORD | GM | HONDA | HYUNDAI | MAZDA | MOCK | NISSAN | SUBARU | TESLA | TOYOTA | VOLKSWAGEN
BRANDS = [BODY, CHRYSLER, FORD, GM, HONDA, HYUNDAI, MAZDA, MOCK, NISSAN, SUBARU, TESLA, TOYOTA, VOLKSWAGEN] BRANDS = get_args(Platform)
PLATFORMS: dict[str, Platform] = {str(platform): platform for brand in BRANDS for platform in cast(list[Platform], brand)} PLATFORMS: dict[str, Platform] = {str(platform): platform for brand in BRANDS for platform in brand}

Loading…
Cancel
Save