sleep.py 456 B

12345678910111213141516171819202122
  1. from neurons import Neurone
  2. import time
  3. class NoSecondsException(Exception):
  4. pass
  5. class Sleep(Neurone):
  6. def __init__(self, *args , **kwargs):
  7. Neurone.__init__(self)
  8. # get message to spell out loud
  9. seconds = kwargs.get('seconds', None)
  10. # user must specify a message
  11. if seconds is None:
  12. raise NoSecondsException("You must set a number of seconds as parameter")
  13. time.sleep(seconds)