From e01d2e6a8f2de8b3a2657d2fd595b9f6e6765c1c Mon Sep 17 00:00:00 2001 From: James Fox Date: Sun, 9 Oct 2022 21:48:26 +0100 Subject: [PATCH] fix typing --- pycid/core/macid.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pycid/core/macid.py b/pycid/core/macid.py index 24dfdf0..9794282 100644 --- a/pycid/core/macid.py +++ b/pycid/core/macid.py @@ -8,7 +8,7 @@ from pgmpy.factors.discrete import TabularCPD from pycid.core.cpd import DecisionDomain, StochasticFunctionCPD -from pycid.core.macid_base import MACIDBase +from pycid.core.macid_base import AgentLabel, MACIDBase from pycid.core.relevance_graph import CondensedRelevanceGraph from pycid.export.gambit import behavior_to_cpd, macid_to_efg, pygambit_ne_solver @@ -47,7 +47,7 @@ def get_ne(self, solver: Optional[str] = None) -> List[List[StochasticFunctionCP """ return self.get_ne_in_sg(solver=solver) - def create_subgame(self, active_subgame_decs) -> MACID: + def create_subgame(self, active_subgame_decs: Iterable[str]) -> MACID: """ Return a full subgame from the full macid with the active_subgame_decs active as decisions in this subgame. """ @@ -60,7 +60,7 @@ def create_subgame(self, active_subgame_decs) -> MACID: edges_sg = [pair for pair in self.edges if pair[1] in r_nodes_plus_decs] # sg_nodes = set([node for pair in edges_sg for node in pair]) # finds the decision_agents mapping in this subgame - sg_agents_decs = {} + sg_agents_decs: Dict[AgentLabel, List[str]] = {} for node in active_subgame_decs: agent = self.decision_agent[node] if agent in sg_agents_decs: @@ -68,7 +68,7 @@ def create_subgame(self, active_subgame_decs) -> MACID: else: sg_agents_decs[agent] = [node] # finds the utilities_agents mapping in this subgame - sg_agents_utils = {} + sg_agents_utils: Dict[AgentLabel, List[str]] = {} for node in set(r_nodes).intersection(set(self.utilities)): agent = self.utility_agent[node] if agent in sg_agents_utils: