1- from protowhat .Feedback import Feedback
1+ from protowhat .Feedback import FeedbackComponent
22from protowhat .State import State as BaseState
33import copy
44
5- from protowhat .Test import Fail
6-
75from sheetwhat .selectors import Dispatcher
86
97
@@ -15,26 +13,30 @@ def __init__(
1513 self .solution_data = solution_data
1614 self .sct_range = sct_range
1715 self .reporter = reporter
18- self .messages = []
16+ self .feedback_context = None
1917 self .creator = None
2018 self .dispatcher = Dispatcher ()
2119 self .node_name = "root"
2220 self .force_diagnose = force_diagnose
23-
24- def report (self , feedback : str ):
25- return self .do_test (Fail (Feedback (feedback )))
21+ self .debug = False
2622
2723 def to_child (self , append_message = "" , node_name = None , ** kwargs ):
2824 """Basic implementation of returning a child state"""
2925 child = copy .deepcopy (self )
3026 for kwarg in kwargs :
3127 setattr (child , kwarg , kwargs [kwarg ])
3228 child .node_name = node_name
33- if not isinstance (append_message , dict ):
34- append_message = { "msg" : append_message , "kwargs" : {}}
35- child .messages = [ * self . messages , append_message ]
29+ if not isinstance (append_message , FeedbackComponent ):
30+ append_message = FeedbackComponent ( append_message )
31+ child .feedback_context = append_message
3632 return child
3733
34+ def get_feedback (self , conclusion ):
35+ return self .feedback_cls (
36+ conclusion ,
37+ [state .feedback_context for state in self .state_history ],
38+ )
39+
3840 def to_message_exposed_dict (self ):
3941 """This dictionary is passed through to the message formatter. The fields
4042 defined in the dictionary can be replaced by values in the state by using
0 commit comments