Coverage for /usr/lib/python3/dist-packages/sympy/polys/matrices/exceptions.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-14 15:55 +0200

1""" 

2 

3Module to define exceptions to be used in sympy.polys.matrices modules and 

4classes. 

5 

6Ideally all exceptions raised in these modules would be defined and documented 

7here and not e.g. imported from matrices. Also ideally generic exceptions like 

8ValueError/TypeError would not be raised anywhere. 

9 

10""" 

11 

12 

13class DMError(Exception): 

14 """Base class for errors raised by DomainMatrix""" 

15 pass 

16 

17 

18class DMBadInputError(DMError): 

19 """list of lists is inconsistent with shape""" 

20 pass 

21 

22 

23class DMDomainError(DMError): 

24 """domains do not match""" 

25 pass 

26 

27 

28class DMNotAField(DMDomainError): 

29 """domain is not a field""" 

30 pass 

31 

32 

33class DMFormatError(DMError): 

34 """mixed dense/sparse not supported""" 

35 pass 

36 

37 

38class DMNonInvertibleMatrixError(DMError): 

39 """The matrix in not invertible""" 

40 pass 

41 

42 

43class DMRankError(DMError): 

44 """matrix does not have expected rank""" 

45 pass 

46 

47 

48class DMShapeError(DMError): 

49 """shapes are inconsistent""" 

50 pass 

51 

52 

53class DMNonSquareMatrixError(DMShapeError): 

54 """The matrix is not square""" 

55 pass 

56 

57 

58class DMValueError(DMError): 

59 """The value passed is invalid""" 

60 pass 

61 

62 

63__all__ = [ 

64 'DMError', 'DMBadInputError', 'DMDomainError', 'DMFormatError', 

65 'DMRankError', 'DMShapeError', 'DMNotAField', 

66 'DMNonInvertibleMatrixError', 'DMNonSquareMatrixError', 'DMValueError' 

67]