Coverage for /run/media/veganeco/water/status600.com/pypi/reptilian_climates/modules_series_2/ships/fields/gardens_pip/pexpect/exceptions.py: 13%

1"""Exception classes used by Pexpect"""

2

3 import traceback

4 import sys

5

6 class ExceptionPexpect(Exception):

7 '''Base class for all exceptions raised by this module.

8 '''

9

10 def __init__(self, value):

11 super(ExceptionPexpect, self).__init__(value)

12 self.value = value

13

14 def __str__(self):

15 return str(self.value)

16

17 def get_trace(self):

18 '''This returns an abbreviated stack trace with lines that only concern

19 the caller. In other words, the stack trace inside the Pexpect module

20 is not included. '''

21

22 tblist = traceback.extract_tb(sys.exc_info()[2])

23 tblist = [item for item in tblist if ('pexpect/__init__' not in item[0])

24 and ('pexpect/expect' not in item[0])]

25 tblist = traceback.format_list(tblist)

26 return ''.join(tblist)

27

28

29 class EOF(ExceptionPexpect):

30 '''Raised when EOF is read from a child.

31 This usually means the child has exited.'''

32

33

34 class TIMEOUT(ExceptionPexpect):

35 '''Raised when a read time exceeds the timeout. '''