From c65e8947f2b20164dd3bea0a300d42ee9b705594 Mon Sep 17 00:00:00 2001 From: Elliot Tower Date: Wed, 18 Oct 2023 12:47:07 -0400 Subject: [PATCH] Change AEC last() to assert agent is not None (#1120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relevant if integer AgentID is used, previous “assert agent” failed on AgentID of zero --- pettingzoo/utils/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pettingzoo/utils/env.py b/pettingzoo/utils/env.py index 3889ee01e..00523856b 100644 --- a/pettingzoo/utils/env.py +++ b/pettingzoo/utils/env.py @@ -182,7 +182,7 @@ def last( ) -> tuple[ObsType | None, float, bool, bool, dict[str, Any]]: """Returns observation, cumulative reward, terminated, truncated, info for the current agent (specified by self.agent_selection).""" agent = self.agent_selection - assert agent + assert agent is not None observation = self.observe(agent) if observe else None return ( observation,