From 4d4938e6d5757354c9334a926d65fe7194186493 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Mon, 5 Feb 2024 15:18:18 +0800 Subject: [PATCH] Still need to use strenum to be able to generate car list in lpdp --- selfdrive/car/body/values.py | 3 ++- selfdrive/car/chrysler/values.py | 3 ++- selfdrive/car/ford/values.py | 3 ++- selfdrive/car/gm/values.py | 3 ++- selfdrive/car/honda/values.py | 3 ++- selfdrive/car/hyundai/values.py | 3 ++- selfdrive/car/mazda/values.py | 3 ++- selfdrive/car/mock/values.py | 3 ++- selfdrive/car/nissan/values.py | 3 ++- selfdrive/car/subaru/values.py | 3 ++- selfdrive/car/tesla/values.py | 3 ++- selfdrive/car/toyota/values.py | 3 ++- selfdrive/car/volkswagen/values.py | 3 ++- selfdrive/manager/manager.py | 7 ------- 14 files changed, 26 insertions(+), 20 deletions(-) diff --git a/selfdrive/car/body/values.py b/selfdrive/car/body/values.py index 33119bf0f..218b9a6f2 100644 --- a/selfdrive/car/body/values.py +++ b/selfdrive/car/body/values.py @@ -1,4 +1,5 @@ -from enum import StrEnum +# from enum import StrEnum +from strenum import StrEnum from typing import Dict from cereal import car diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py index 34e602562..c5ba56b98 100644 --- a/selfdrive/car/chrysler/values.py +++ b/selfdrive/car/chrysler/values.py @@ -1,4 +1,5 @@ -from enum import IntFlag, StrEnum +from enum import IntFlag#, StrEnum +from strenum import StrEnum from dataclasses import dataclass, field from typing import Dict, List, Optional, Union diff --git a/selfdrive/car/ford/values.py b/selfdrive/car/ford/values.py index 2c4415be2..7ecfb08e6 100644 --- a/selfdrive/car/ford/values.py +++ b/selfdrive/car/ford/values.py @@ -1,6 +1,7 @@ from collections import defaultdict from dataclasses import dataclass -from enum import Enum, StrEnum +from enum import Enum#, StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index dbbf15100..bcc222f67 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -1,6 +1,7 @@ from collections import defaultdict from dataclasses import dataclass -from enum import Enum, StrEnum +from enum import Enum#, StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 1d4a174b9..548228508 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -1,5 +1,6 @@ from dataclasses import dataclass -from enum import Enum, IntFlag, StrEnum +from enum import Enum, IntFlag#, StrEnum +from strenum import StrEnum from typing import Dict, List, Optional, Union from cereal import car diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 4b92bc5a4..b471e882c 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1,6 +1,7 @@ import re from dataclasses import dataclass -from enum import Enum, IntFlag, StrEnum +from enum import Enum, IntFlag#, StrEnum +from strenum import StrEnum from typing import Dict, List, Optional, Set, Tuple, Union from cereal import car diff --git a/selfdrive/car/mazda/values.py b/selfdrive/car/mazda/values.py index c95ae162f..0a88245a9 100644 --- a/selfdrive/car/mazda/values.py +++ b/selfdrive/car/mazda/values.py @@ -1,5 +1,6 @@ from dataclasses import dataclass, field -from enum import StrEnum +# from enum import StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/car/mock/values.py b/selfdrive/car/mock/values.py index c6c96579b..856253a56 100644 --- a/selfdrive/car/mock/values.py +++ b/selfdrive/car/mock/values.py @@ -1,4 +1,5 @@ -from enum import StrEnum +# from enum import StrEnum +from strenum import StrEnum from typing import Dict, List, Optional, Union from openpilot.selfdrive.car.docs_definitions import CarInfo diff --git a/selfdrive/car/nissan/values.py b/selfdrive/car/nissan/values.py index c013b2056..64e175083 100644 --- a/selfdrive/car/nissan/values.py +++ b/selfdrive/car/nissan/values.py @@ -1,5 +1,6 @@ from dataclasses import dataclass, field -from enum import StrEnum +# from enum import StrEnum +from strenum import StrEnum from typing import Dict, List, Optional, Union from cereal import car diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py index 9fb4b4568..3aabe3ffe 100644 --- a/selfdrive/car/subaru/values.py +++ b/selfdrive/car/subaru/values.py @@ -1,5 +1,6 @@ from dataclasses import dataclass, field -from enum import Enum, IntFlag, StrEnum +from enum import Enum, IntFlag#, StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/car/tesla/values.py b/selfdrive/car/tesla/values.py index 12877f134..b2cffd031 100644 --- a/selfdrive/car/tesla/values.py +++ b/selfdrive/car/tesla/values.py @@ -1,5 +1,6 @@ from collections import namedtuple -from enum import StrEnum +# from enum import StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 3325063a3..1cf15d947 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -1,7 +1,8 @@ import re from collections import defaultdict from dataclasses import dataclass, field -from enum import Enum, IntFlag, StrEnum +from enum import Enum, IntFlag#, StrEnum +from strenum import StrEnum from typing import Dict, List, Set, Union from cereal import car diff --git a/selfdrive/car/volkswagen/values.py b/selfdrive/car/volkswagen/values.py index f4809e452..16695db81 100755 --- a/selfdrive/car/volkswagen/values.py +++ b/selfdrive/car/volkswagen/values.py @@ -1,6 +1,7 @@ from collections import defaultdict, namedtuple from dataclasses import dataclass, field -from enum import Enum, IntFlag, StrEnum +from enum import Enum, IntFlag#, StrEnum +from strenum import StrEnum from typing import Dict, List, Union from cereal import car diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 20b4a7091..4dadb020b 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -198,13 +198,6 @@ def manager_thread() -> None: def main() -> None: - # rick - use strenum.StrEnum istead of enum.StrEnum (which is missing in python 3.8) - # Check if the enum module is already imported - if 'enum' in sys.modules: - # If enum module is imported, replace StrEnum in the enum module - from strenum import StrEnum - sys.modules['enum'].StrEnum = StrEnum - prepare_only = os.getenv("PREPAREONLY") is not None manager_init()