|
|
|
@ -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("__")] |
|
|
|
|