Coverage for pyEDAA/OutputFilter/Xilinx/Exception.py: 79%

19 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-05 22:59 +0000

1# ==================================================================================================================== # 

2# _____ ____ _ _ ___ _ _ _____ _ _ _ # 

3# _ __ _ _| ____| _ \ / \ / \ / _ \ _ _| |_ _ __ _ _| |_| ___(_) | |_ ___ _ __ # 

4# | '_ \| | | | _| | | | |/ _ \ / _ \ | | | | | | | __| '_ \| | | | __| |_ | | | __/ _ \ '__| # 

5# | |_) | |_| | |___| |_| / ___ \ / ___ \ | |_| | |_| | |_| |_) | |_| | |_| _| | | | || __/ | # 

6# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)___/ \__,_|\__| .__/ \__,_|\__|_| |_|_|\__\___|_| # 

7# |_| |___/ |_| # 

8# ==================================================================================================================== # 

9# Authors: # 

10# Patrick Lehmann # 

11# # 

12# License: # 

13# ==================================================================================================================== # 

14# Copyright 2025-2026 Electronic Design Automation Abstraction (EDA²) # 

15# # 

16# Licensed under the Apache License, Version 2.0 (the "License"); # 

17# you may not use this file except in compliance with the License. # 

18# You may obtain a copy of the License at # 

19# # 

20# http://www.apache.org/licenses/LICENSE-2.0 # 

21# # 

22# Unless required by applicable law or agreed to in writing, software # 

23# distributed under the License is distributed on an "AS IS" BASIS, # 

24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

25# See the License for the specific language governing permissions and # 

26# limitations under the License. # 

27# # 

28# SPDX-License-Identifier: Apache-2.0 # 

29# ==================================================================================================================== # 

30# 

31"""Basic classes for outputs from AMD/Xilinx Vivado.""" 

32from pyTooling.Decorators import export 

33 

34from pyEDAA.OutputFilter import OutputFilterException 

35 

36 

37@export 

38class ProcessorException(OutputFilterException): 

39 """ 

40 Base-class for exceptions raised by processors parsing log outputs. 

41 """ 

42 

43 

44@export 

45class ClassificationException(ProcessorException): 

46 """ 

47 Raised if a log output line couldn't be classified. 

48 """ 

49 _lineNumber: int #: Line number of the unclassified line. 

50 _rawMessage: str #: Raw message of the unclassified line. 

51 

52 def __init__(self, errorMessage: str, lineNumber: int, rawMessageLine: str) -> None: 

53 """ 

54 Initializes a classification exception. 

55 

56 :param errorMessage: Error message why the line couldn't be classified. 

57 :param lineNumber: Line number of the unclassified line. 

58 :param rawMessageLine: Raw message of the unclassified line. 

59 """ 

60 super().__init__(errorMessage) 

61 

62 self._lineNumber = lineNumber 

63 self._rawMessage = rawMessageLine 

64 

65 def __str__(self) -> str: 

66 return f"{self.message}: {self._rawMessage} (at line {self._lineNumber})" 

67 

68 

69@export 

70class ParserStateException(ProcessorException): 

71 """ 

72 Raised if a log output parser has a broken state. 

73 """ 

74 

75 

76@export 

77class NotPresentException(ProcessorException): 

78 pass