1717 from typing import Any
1818
1919 from simpleflow .swf .executor import Executor
20+ from simpleflow .swf .mapper .models .decision .base import Decision
2021 from simpleflow .swf .mapper .responses import Response
2122
2223
2324class Decider (Supervisor ):
2425 """
2526 Decider.
26-
27- :ivar _poller: decider poller.
28- :type _poller: DeciderPoller
2927 """
3028
29+ _poller : DeciderPoller
30+
3131 def __init__ (self , poller , nb_children = None ):
3232 self ._poller = poller
3333 super ().__init__ (
@@ -74,15 +74,16 @@ def __init__(
7474 behind this is to limit operational burden by having a single service
7575 handling multiple workflows.
7676
77- :param workflow_executors: executors handling workflow executions.
78- :type workflow_executors: list[simpleflow.swf.executor.Executor]
77+ workflow_executors: executors handling workflow executions.
7978
8079 """
8180 self .workflow_name = f"{ ',' .join ([ex .workflow_class .name for ex in workflow_executors ])} "
8281
8382 # Maps a workflow's name to its definition.
8483 # Used to dispatch a decision task to the corresponding workflow.
85- self ._workflow_executors = {executor .workflow_class .name : executor for executor in workflow_executors }
84+ self ._workflow_executors : dict [str , Executor ] = {
85+ executor .workflow_class .name : executor for executor in workflow_executors
86+ }
8687
8788 if task_list :
8889 self .task_list = task_list
@@ -123,8 +124,6 @@ def name(self):
123124 """
124125 The main purpose of this property is to find what workflow a decider
125126 handles.
126-
127- :rtype: str
128127 """
129128 if self .workflow_name :
130129 suffix = f"(workflow={ self .workflow_name } )"
@@ -148,7 +147,6 @@ def complete(
148147 :param token: task token.
149148 :param decisions: decisions, maybe with context.
150149 :param execution_context: None...
151- :return: nothing.
152150 """
153151 if isinstance (decisions , DecisionsAndContext ):
154152 decisions , execution_context = (
@@ -158,7 +156,7 @@ def complete(
158156 return simpleflow .swf .mapper .actors .Decider .complete (self , token , decisions , execution_context )
159157
160158 @with_state ("processing" )
161- def process (self , decision_response ) :
159+ def process (self , decision_response : Response ) -> None :
162160 """
163161 Take a PollForDecisionTask response object and try to complete the
164162 decision task, by calling self._complete() with the response token and
@@ -171,7 +169,7 @@ def process(self, decision_response):
171169 spawn (self , decision_response )
172170
173171 @with_state ("deciding" )
174- def decide (self , decision_response ):
172+ def decide (self , decision_response : Response ) -> ( list [ Decision ], DecisionsAndContext ):
175173 """
176174 Delegate the decision to the decider worker (which itself delegates to
177175 the executor).
0 commit comments