LifoManager.py 665 B

123456789101112131415161718192021222324252627282930
  1. import logging
  2. from kalliope.core.Lifo.LIFOBuffer import LIFOBuffer
  3. from six import with_metaclass
  4. from kalliope.core.Models import Singleton
  5. logging.basicConfig()
  6. logger = logging.getLogger("kalliope")
  7. class LifoManager(with_metaclass(Singleton, object)):
  8. lifo_buffer = LIFOBuffer()
  9. @classmethod
  10. def get_singleton_lifo(cls):
  11. return cls.lifo_buffer
  12. @classmethod
  13. def get_new_lifo(cls):
  14. """
  15. This class is used to manage hooks "on_start_speaking" and "on_stop_speaking".
  16. :return:
  17. """
  18. return LIFOBuffer()
  19. @classmethod
  20. def clean_saved_lifo(cls):
  21. cls.lifo_buffer = LIFOBuffer()