From af667685976ee1c717617d2a65d4f75d70614abe Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 8 Mar 2022 01:53:20 -0800 Subject: [PATCH] update type hinting --- selfdrive/car/car_helpers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 53062f9586..0f13d700f3 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -1,4 +1,5 @@ import os +from typing import Any, Dict, List from common.params import Params from common.basedir import BASEDIR @@ -58,7 +59,8 @@ def load_interfaces(brand_names): return ret -def get_interface_attr(attr): +def get_interface_attr(attr: str) -> Dict[str, Any]: + # returns given attribute from each interface brand_names = {} for car_folder in [x[0] for x in os.walk(BASEDIR + '/selfdrive/car')]: try: @@ -70,11 +72,8 @@ def get_interface_attr(attr): return brand_names -def _get_interface_names(): - # read all the folders in selfdrive/car and return a dict where: - # - keys are all the car names that which we have an interface for - # - values are lists of specific car models for a given brand - +def _get_interface_names() -> Dict[str, List[str]]: + # returns a dict of brand name and its respective models brand_names = {} for brand_name, model_names in get_interface_attr("CAR").items(): model_names = [getattr(model_names, c) for c in model_names.__dict__.keys() if not c.startswith("__")]