Skip to content

Commit

Permalink
Fix pickling error. (#2100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot authored Oct 30, 2023
1 parent 7bb8c06 commit 66b30d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
### Deprecated
### 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.
### Removed
### Security

Expand Down
9 changes: 5 additions & 4 deletions envision/client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class SingleAttributeOverride(NamedTuple):
"""The maximum number of elements an iterable attribute can contain."""


def _default_override():
return SingleAttributeOverride(True, None)


@dataclass(frozen=True)
class EnvisionStateFilter:
"""A state filtering tool."""
Expand All @@ -49,7 +53,4 @@ class EnvisionStateFilter:
def default(cls):
"""Give a new default filter."""

def default_override():
return SingleAttributeOverride(True, None)

return cls(defaultdict(default_override), defaultdict(default_override))
return cls(defaultdict(_default_override), defaultdict(_default_override))
8 changes: 5 additions & 3 deletions envision/tests/test_data_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@
TIMESTEP_SEC = 0.1


class KeepLaneAgent(Agent):
def act(self, obs):
return "keep_lane"


@pytest.fixture
def agent_spec():
class KeepLaneAgent(Agent):
def act(self, obs):
return "keep_lane"

return AgentSpec(
interface=AgentInterface.from_type(
Expand Down

0 comments on commit 66b30d3

Please sign in to comment.