Beispiel #1
0
 def event_occurred(self, event_data):
     """Should be used to set final result"""
     if self.done():
         raise ResultAlreadySet(self)
     if self._occurred is None:
         self._occurred = []
     self._occurred.append(event_data)
     if self.till_occurs_times > 0:
         if len(self._occurred) >= self.till_occurs_times:
             self.set_result(self._occurred)
     self.notify()
Beispiel #2
0
 def event_occurred(self, event_data):
     """
     Sets event_data as new item of occurrence ret.
     :param event_data: data to set as value of occurrence.
     :return: None
     """
     """Should be used to set final result"""
     if self.done():
         raise ResultAlreadySet(self)
     if self._occurred is None:
         self._occurred = []
     self._occurred.append(event_data)
     if self.till_occurs_times > 0:
         if len(self._occurred) >= self.till_occurs_times:
             self.set_result(self._occurred)
     self.notify()
Beispiel #3
0
 def set_result(self, result):
     """Should be used to set final result"""
     if self.done():
         raise ResultAlreadySet(self)
     self._is_done = True
     self._result = result