Coverage for src/griffe/_internal/enumerations.py: 100.00%

159 statements  

« prev     ^ index     » next       coverage.py v7.10.2, created at 2025-08-11 13:44 +0200

1# This module contains all the enumerations of the package. 

2 

3from __future__ import annotations 

4 

5from enum import Enum 

6 

7 

8class LogLevel(str, Enum): 

9 """Enumeration of available log levels.""" 

10 

11 trace = "trace" 

12 """The TRACE log level.""" 

13 debug = "debug" 

14 """The DEBUG log level.""" 

15 info = "info" 

16 """The INFO log level.""" 

17 success = "success" 

18 """The SUCCESS log level.""" 

19 warning = "warning" 

20 """The WARNING log level.""" 

21 error = "error" 

22 """The ERROR log level.""" 

23 critical = "critical" 

24 """The CRITICAL log level.""" 

25 

26 

27class DocstringSectionKind(str, Enum): 

28 """Enumeration of the possible docstring section kinds.""" 

29 

30 text = "text" 

31 """Text section.""" 

32 parameters = "parameters" 

33 """Parameters section.""" 

34 other_parameters = "other parameters" 

35 """Other parameters (keyword arguments) section.""" 

36 type_parameters = "type parameters" 

37 """Type parameters section.""" 

38 raises = "raises" 

39 """Raises (exceptions) section.""" 

40 warns = "warns" 

41 """Warnings section.""" 

42 returns = "returns" 

43 """Returned value(s) section.""" 

44 yields = "yields" 

45 """Yielded value(s) (generators) section.""" 

46 receives = "receives" 

47 """Received value(s) (generators) section.""" 

48 examples = "examples" 

49 """Examples section.""" 

50 attributes = "attributes" 

51 """Attributes section.""" 

52 functions = "functions" 

53 """Functions section.""" 

54 classes = "classes" 

55 """Classes section.""" 

56 type_aliases = "type aliases" 

57 """Type aliases section.""" 

58 modules = "modules" 

59 """Modules section.""" 

60 deprecated = "deprecated" 

61 """Deprecation section.""" 

62 admonition = "admonition" 

63 """Admonition block.""" 

64 

65 

66class ParameterKind(str, Enum): 

67 """Enumeration of the different parameter kinds.""" 

68 

69 positional_only = "positional-only" 

70 """Positional-only parameter.""" 

71 positional_or_keyword = "positional or keyword" 

72 """Positional or keyword parameter.""" 

73 var_positional = "variadic positional" 

74 """Variadic positional parameter.""" 

75 keyword_only = "keyword-only" 

76 """Keyword-only parameter.""" 

77 var_keyword = "variadic keyword" 

78 """Variadic keyword parameter.""" 

79 

80 

81class TypeParameterKind(str, Enum): 

82 """Enumeration of the different type parameter kinds.""" 

83 

84 type_var = "type-var" 

85 """Type variable.""" 

86 type_var_tuple = "type-var-tuple" 

87 """Type variable tuple.""" 

88 param_spec = "param-spec" 

89 """Parameter specification variable.""" 

90 

91 

92class Kind(str, Enum): 

93 """Enumeration of the different object kinds.""" 

94 

95 MODULE = "module" 

96 """Modules.""" 

97 CLASS = "class" 

98 """Classes.""" 

99 FUNCTION = "function" 

100 """Functions and methods.""" 

101 ATTRIBUTE = "attribute" 

102 """Attributes and properties.""" 

103 ALIAS = "alias" 

104 """Aliases (imported objects).""" 

105 TYPE_ALIAS = "type alias" 

106 """Type aliases.""" 

107 

108 

109class ExplanationStyle(str, Enum): 

110 """Enumeration of the possible styles for explanations.""" 

111 

112 ONE_LINE = "oneline" 

113 """Explanations on one-line.""" 

114 VERBOSE = "verbose" 

115 """Explanations on multiple lines.""" 

116 MARKDOWN = "markdown" 

117 """Explanations in Markdown, adapted to changelogs.""" 

118 GITHUB = "github" 

119 """Explanation as GitHub workflow commands warnings, adapted to CI.""" 

120 

121 

122class BreakageKind(str, Enum): 

123 """Enumeration of the possible API breakages.""" 

124 

125 PARAMETER_MOVED = "Positional parameter was moved" 

126 """Positional parameter was moved""" 

127 PARAMETER_REMOVED = "Parameter was removed" 

128 """Parameter was removed""" 

129 PARAMETER_CHANGED_KIND = "Parameter kind was changed" 

130 """Parameter kind was changed""" 

131 PARAMETER_CHANGED_DEFAULT = "Parameter default was changed" 

132 """Parameter default was changed""" 

133 PARAMETER_CHANGED_REQUIRED = "Parameter is now required" 

134 """Parameter is now required""" 

135 PARAMETER_ADDED_REQUIRED = "Parameter was added as required" 

136 """Parameter was added as required""" 

137 RETURN_CHANGED_TYPE = "Return types are incompatible" 

138 """Return types are incompatible""" 

139 OBJECT_REMOVED = "Public object was removed" 

140 """Public object was removed""" 

141 OBJECT_CHANGED_KIND = "Public object points to a different kind of object" 

142 """Public object points to a different kind of object""" 

143 ATTRIBUTE_CHANGED_TYPE = "Attribute types are incompatible" 

144 """Attribute types are incompatible""" 

145 ATTRIBUTE_CHANGED_VALUE = "Attribute value was changed" 

146 """Attribute value was changed""" 

147 CLASS_REMOVED_BASE = "Base class was removed" 

148 """Base class was removed""" 

149 

150 

151class Parser(str, Enum): 

152 """Enumeration of the different docstring parsers.""" 

153 

154 auto = "auto" 

155 """Infer docstring parser. 

156 

157 [:octicons-heart-fill-24:{ .pulse } Sponsors only](../../../insiders/index.md){ .insiders } — 

158 [:octicons-tag-24: Insiders 1.3.0](../../../insiders/changelog.md#1.3.0). 

159 """ 

160 google = "google" 

161 """Google-style docstrings parser.""" 

162 sphinx = "sphinx" 

163 """Sphinx-style docstrings parser.""" 

164 numpy = "numpy" 

165 """Numpydoc-style docstrings parser.""" 

166 

167 

168class ObjectKind(str, Enum): 

169 """Enumeration of the different runtime object kinds.""" 

170 

171 MODULE = "module" 

172 """Modules.""" 

173 CLASS = "class" 

174 """Classes.""" 

175 STATICMETHOD = "staticmethod" 

176 """Static methods.""" 

177 CLASSMETHOD = "classmethod" 

178 """Class methods.""" 

179 METHOD_DESCRIPTOR = "method_descriptor" 

180 """Method descriptors.""" 

181 METHOD = "method" 

182 """Methods.""" 

183 BUILTIN_METHOD = "builtin_method" 

184 """Built-in methods.""" 

185 COROUTINE = "coroutine" 

186 """Coroutines""" 

187 FUNCTION = "function" 

188 """Functions.""" 

189 BUILTIN_FUNCTION = "builtin_function" 

190 """Built-in functions.""" 

191 CACHED_PROPERTY = "cached_property" 

192 """Cached properties.""" 

193 GETSET_DESCRIPTOR = "getset_descriptor" 

194 """Get/set descriptors.""" 

195 PROPERTY = "property" 

196 """Properties.""" 

197 TYPE_ALIAS = "type_alias" 

198 """Type aliases.""" 

199 ATTRIBUTE = "attribute" 

200 """Attributes.""" 

201 

202 def __str__(self) -> str: 

203 return self.value