From d56cf1aa89646d1a9e97fe700d6a597ea1e21b1b Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 31 Oct 2023 18:29:19 +0000 Subject: [PATCH 1/3] Fix issue where a lambda cannot be serialized. --- envision/data_formatter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/envision/data_formatter.py b/envision/data_formatter.py index 1a0dae4e36..b1afd2f102 100644 --- a/envision/data_formatter.py +++ b/envision/data_formatter.py @@ -74,6 +74,8 @@ class Operation(IntEnum): _primitives = {int, float, str, VehicleType, TrafficActorType} +def _passthrough_method_1_arg(v): + return v class ReductionContext: """Mappings between an object and its reduction to an ID.""" @@ -126,7 +128,7 @@ class EnvisionDataFormatterArgs(NamedTuple): """Data formatter configurations.""" id: Optional[str] - serializer: Callable[[list], Any] = lambda d: d + serializer: Callable[[list], Any] = _passthrough_method_1_arg float_decimals: int = 2 bool_as_int: bool = True enable_reduction: bool = True From 232bd77af8606fb800bbfb6c86507a957f4d05b7 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 31 Oct 2023 18:32:45 +0000 Subject: [PATCH 2/3] Update changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25aabc7812..8720e3399f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Copy and pasting the git commit messages is __NOT__ enough. ### Fixed - Fixed issue where `SumoTrafficSimulation` could get locked up on reset if a scenario had only 1 map but multiple scenario variations. - Fixed an issue where an out-of-scope method reference caused a pickling error. +- Fixed an issue where the `EnvisionDataFormatterArgs` default would use a locally defined lambda and cause a serialization failure. ### Removed ### Security From 4d17743739c29fd31f658ad870bb239f6c014dd2 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 31 Oct 2023 19:22:01 +0000 Subject: [PATCH 3/3] Make format. --- envision/data_formatter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/envision/data_formatter.py b/envision/data_formatter.py index b1afd2f102..3e8a124bac 100644 --- a/envision/data_formatter.py +++ b/envision/data_formatter.py @@ -74,9 +74,11 @@ class Operation(IntEnum): _primitives = {int, float, str, VehicleType, TrafficActorType} + def _passthrough_method_1_arg(v): return v + class ReductionContext: """Mappings between an object and its reduction to an ID."""