Coverage for src/_griffe/enumerations.py: 100.00%
142 statements
« prev ^ index » next coverage.py v7.6.2, created at 2024-10-12 01:34 +0200
« prev ^ index » next coverage.py v7.6.2, created at 2024-10-12 01:34 +0200
1# This module contains all the enumerations of the package.
3from __future__ import annotations
5from enum import Enum
8class LogLevel(str, Enum):
9 """Enumeration of available log levels."""
11 trace: str = "trace"
12 """The TRACE log level."""
13 debug: str = "debug"
14 """The DEBUG log level."""
15 info: str = "info"
16 """The INFO log level."""
17 success: str = "success"
18 """The SUCCESS log level."""
19 warning: str = "warning"
20 """The WARNING log level."""
21 error: str = "error"
22 """The ERROR log level."""
23 critical: str = "critical"
24 """The CRITICAL log level."""
27class DocstringSectionKind(str, Enum):
28 """Enumeration of the possible docstring section kinds."""
30 text = "text"
31 """Text section."""
32 parameters = "parameters"
33 """Parameters section."""
34 other_parameters = "other parameters"
35 """Other parameters (keyword arguments) section."""
36 raises = "raises"
37 """Raises (exceptions) section."""
38 warns = "warns"
39 """Warnings section."""
40 returns = "returns"
41 """Returned value(s) section."""
42 yields = "yields"
43 """Yielded value(s) (generators) section."""
44 receives = "receives"
45 """Received value(s) (generators) section."""
46 examples = "examples"
47 """Examples section."""
48 attributes = "attributes"
49 """Attributes section."""
50 functions = "functions"
51 """Functions section."""
52 classes = "classes"
53 """Classes section."""
54 modules = "modules"
55 """Modules section."""
56 deprecated = "deprecated"
57 """Deprecation section."""
58 admonition = "admonition"
59 """Admonition block."""
62class ParameterKind(str, Enum):
63 """Enumeration of the different parameter kinds."""
65 positional_only: str = "positional-only"
66 """Positional-only parameter."""
67 positional_or_keyword: str = "positional or keyword"
68 """Positional or keyword parameter."""
69 var_positional: str = "variadic positional"
70 """Variadic positional parameter."""
71 keyword_only: str = "keyword-only"
72 """Keyword-only parameter."""
73 var_keyword: str = "variadic keyword"
74 """Variadic keyword parameter."""
77class Kind(str, Enum):
78 """Enumeration of the different object kinds."""
80 MODULE: str = "module"
81 """Modules."""
82 CLASS: str = "class"
83 """Classes."""
84 FUNCTION: str = "function"
85 """Functions and methods."""
86 ATTRIBUTE: str = "attribute"
87 """Attributes and properties."""
88 ALIAS: str = "alias"
89 """Aliases (imported objects)."""
92class ExplanationStyle(str, Enum):
93 """Enumeration of the possible styles for explanations."""
95 ONE_LINE: str = "oneline"
96 """Explanations on one-line."""
97 VERBOSE: str = "verbose"
98 """Explanations on multiple lines."""
99 MARKDOWN: str = "markdown"
100 """Explanations in Markdown, adapted to changelogs."""
101 GITHUB: str = "github"
102 """Explanation as GitHub workflow commands warnings, adapted to CI."""
105class BreakageKind(str, Enum):
106 """Enumeration of the possible API breakages."""
108 PARAMETER_MOVED: str = "Positional parameter was moved"
109 """Positional parameter was moved"""
110 PARAMETER_REMOVED: str = "Parameter was removed"
111 """Parameter was removed"""
112 PARAMETER_CHANGED_KIND: str = "Parameter kind was changed"
113 """Parameter kind was changed"""
114 PARAMETER_CHANGED_DEFAULT: str = "Parameter default was changed"
115 """Parameter default was changed"""
116 PARAMETER_CHANGED_REQUIRED: str = "Parameter is now required"
117 """Parameter is now required"""
118 PARAMETER_ADDED_REQUIRED: str = "Parameter was added as required"
119 """Parameter was added as required"""
120 RETURN_CHANGED_TYPE: str = "Return types are incompatible"
121 """Return types are incompatible"""
122 OBJECT_REMOVED: str = "Public object was removed"
123 """Public object was removed"""
124 OBJECT_CHANGED_KIND: str = "Public object points to a different kind of object"
125 """Public object points to a different kind of object"""
126 ATTRIBUTE_CHANGED_TYPE: str = "Attribute types are incompatible"
127 """Attribute types are incompatible"""
128 ATTRIBUTE_CHANGED_VALUE: str = "Attribute value was changed"
129 """Attribute value was changed"""
130 CLASS_REMOVED_BASE: str = "Base class was removed"
131 """Base class was removed"""
134class Parser(str, Enum):
135 """Enumeration of the different docstring parsers."""
137 auto = "auto"
138 """Infer docstring parser.
140 [:octicons-heart-fill-24:{ .pulse } Sponsors only](../../../insiders/index.md){ .insiders } —
141 [:octicons-tag-24: Insiders 1.3.0](../../../insiders/changelog.md#1.3.0).
142 """
143 google = "google"
144 """Google-style docstrings parser."""
145 sphinx = "sphinx"
146 """Sphinx-style docstrings parser."""
147 numpy = "numpy"
148 """Numpydoc-style docstrings parser."""
151class ObjectKind(str, Enum):
152 """Enumeration of the different runtime object kinds."""
154 MODULE: str = "module"
155 """Modules."""
156 CLASS: str = "class"
157 """Classes."""
158 STATICMETHOD: str = "staticmethod"
159 """Static methods."""
160 CLASSMETHOD: str = "classmethod"
161 """Class methods."""
162 METHOD_DESCRIPTOR: str = "method_descriptor"
163 """Method descriptors."""
164 METHOD: str = "method"
165 """Methods."""
166 BUILTIN_METHOD: str = "builtin_method"
167 """Built-in methods."""
168 COROUTINE: str = "coroutine"
169 """Coroutines"""
170 FUNCTION: str = "function"
171 """Functions."""
172 BUILTIN_FUNCTION: str = "builtin_function"
173 """Built-in functions."""
174 CACHED_PROPERTY: str = "cached_property"
175 """Cached properties."""
176 PROPERTY: str = "property"
177 """Properties."""
178 ATTRIBUTE: str = "attribute"
179 """Attributes."""
181 def __str__(self) -> str:
182 return self.value