7da427dd09
- Add Komatsu specific rules - Possibility to expand to any brand
20 lines
624 B
Python
20 lines
624 B
Python
# File: vehicle/__init__.py
|
|
# Copyright (C) 2026 Erick Ahmed
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import importlib
|
|
|
|
def get_vehicle_module(brand: str):
|
|
"""
|
|
Dynamically imports the correct decoder module based on the vehicle brand.
|
|
Falls back to 'vehicle.generic' if a specific brand module is not found.
|
|
"""
|
|
if not brand:
|
|
return importlib.import_module("vehicle.generic")
|
|
|
|
module_name = f"vehicle.{brand.lower().replace(' ', '_')}"
|
|
try:
|
|
return importlib.import_module(module_name)
|
|
except ModuleNotFoundError:
|
|
return importlib.import_module("vehicle.generic")
|