Coverage for pyEDAA/Reports/DocumentationCoverage/__init__.py: 100%

60 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-16 22:20 +0000

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

2# _____ ____ _ _ ____ _ # 

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

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

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

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

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

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

9# Authors: # 

10# Patrick Lehmann # 

11# # 

12# License: # 

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

14# Copyright 2021-2025 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"""Abstraction of code documentation coverage data model.""" 

32from enum import Flag 

33from typing import Optional as Nullable 

34 

35from pyTooling.Decorators import export 

36from pyTooling.MetaClasses import ExtendedType 

37 

38from pyEDAA.Reports import ReportException 

39 

40 

41@export 

42class DocCoverageException(ReportException): 

43 pass 

44 

45 

46@export 

47class CoverageState(Flag): 

48 Unknown = 0 

49 Excluded = 1 

50 Ignored = 2 

51 Empty = 4 

52 Covered = 8 

53 

54 Weak = 16 

55 Incomplete = 32 

56 Inherited = 64 

57 Detailed = 128 

58 

59 Undocumented = 256 

60 Documented = 512 

61 

62 Parameters = 1024 

63 ReturnValue = 2048 

64 Exceptions = 8192 

65 Types = 16384 

66 

67# unrequiredButDocumented 

68# wrongly documented 

69 

70 

71@export 

72class Base(metaclass=ExtendedType, slots=True): 

73 _parent: Nullable["Base"] 

74 _name: str 

75 _status: CoverageState 

76 

77 def __init__(self, name: str, parent: Nullable["Base"] = None): 

78 if name is None: 

79 raise ValueError(f"Parameter 'name' must not be None.") 

80 

81 self._parent = parent 

82 self._name = name 

83 self._status = CoverageState.Unknown 

84 

85 @property 

86 def Parent(self) -> Nullable["Base"]: 

87 return self._parent 

88 

89 @property 

90 def Name(self) -> str: 

91 return self._name 

92 

93 @property 

94 def Status(self) -> CoverageState: 

95 return self._status 

96 

97 

98@export 

99class _Type(Base): 

100 pass 

101 

102 

103@export 

104class Class(_Type): 

105 pass 

106 

107 

108@export 

109class _Unit(Base): 

110 pass 

111 

112 

113@export 

114class Module(_Unit): 

115 pass 

116 

117 

118@export 

119class Package(_Unit): 

120 pass