| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
from enum import Enum |
| 6 |
|
| 7 |
|
| 8 |
class 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 |
|
| 27 |
class 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 |
|
| 66 |
class 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 |
|
| 81 |
class 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 |
|
| 92 |
class 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 |
|
| 109 |
class 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 |
AZURE_DEVOPS = "azdo" |
| 121 |
"""Explanations as Azure DevOps / Azure Pipelines logging commands.""" |
| 122 |
|
| 123 |
|
| 124 |
class BreakageKind(str, Enum): |
| 125 |
"""Enumeration of the possible API breakages.""" |
| 126 |
|
| 127 |
PARAMETER_MOVED = "Positional parameter was moved" |
| 128 |
"""Positional parameter was moved""" |
| 129 |
PARAMETER_REMOVED = "Parameter was removed" |
| 130 |
"""Parameter was removed""" |
| 131 |
PARAMETER_CHANGED_KIND = "Parameter kind was changed" |
| 132 |
"""Parameter kind was changed""" |
| 133 |
PARAMETER_CHANGED_DEFAULT = "Parameter default was changed" |
| 134 |
"""Parameter default was changed""" |
| 135 |
PARAMETER_CHANGED_REQUIRED = "Parameter is now required" |
| 136 |
"""Parameter is now required""" |
| 137 |
PARAMETER_ADDED_REQUIRED = "Parameter was added as required" |
| 138 |
"""Parameter was added as required""" |
| 139 |
RETURN_CHANGED_TYPE = "Return types are incompatible" |
| 140 |
"""Return types are incompatible""" |
| 141 |
OBJECT_REMOVED = "Public object was removed" |
| 142 |
"""Public object was removed""" |
| 143 |
OBJECT_CHANGED_KIND = "Public object points to a different kind of object" |
| 144 |
"""Public object points to a different kind of object""" |
| 145 |
ATTRIBUTE_CHANGED_TYPE = "Attribute types are incompatible" |
| 146 |
"""Attribute types are incompatible""" |
| 147 |
ATTRIBUTE_CHANGED_VALUE = "Attribute value was changed" |
| 148 |
"""Attribute value was changed""" |
| 149 |
CLASS_REMOVED_BASE = "Base class was removed" |
| 150 |
"""Base class was removed""" |
| 151 |
|
| 152 |
|
| 153 |
class Parser(str, Enum): |
| 154 |
"""Enumeration of the different docstring parsers.""" |
| 155 |
|
| 156 |
auto = "auto" |
| 157 |
"""Infer docstring parser.""" |
| 158 |
google = "google" |
| 159 |
"""Google-style docstrings parser.""" |
| 160 |
sphinx = "sphinx" |
| 161 |
"""Sphinx-style docstrings parser.""" |
| 162 |
numpy = "numpy" |
| 163 |
"""Numpydoc-style docstrings parser.""" |
| 164 |
|
| 165 |
|
| 166 |
class ObjectKind(str, Enum): |
| 167 |
"""Enumeration of the different runtime object kinds.""" |
| 168 |
|
| 169 |
MODULE = "module" |
| 170 |
"""Modules.""" |
| 171 |
CLASS = "class" |
| 172 |
"""Classes.""" |
| 173 |
STATICMETHOD = "staticmethod" |
| 174 |
"""Static methods.""" |
| 175 |
CLASSMETHOD = "classmethod" |
| 176 |
"""Class methods.""" |
| 177 |
METHOD_DESCRIPTOR = "method_descriptor" |
| 178 |
"""Method descriptors.""" |
| 179 |
METHOD = "method" |
| 180 |
"""Methods.""" |
| 181 |
BUILTIN_METHOD = "builtin_method" |
| 182 |
"""Built-in methods.""" |
| 183 |
COROUTINE = "coroutine" |
| 184 |
"""Coroutines""" |
| 185 |
FUNCTION = "function" |
| 186 |
"""Functions.""" |
| 187 |
BUILTIN_FUNCTION = "builtin_function" |
| 188 |
"""Built-in functions.""" |
| 189 |
CACHED_PROPERTY = "cached_property" |
| 190 |
"""Cached properties.""" |
| 191 |
GETSET_DESCRIPTOR = "getset_descriptor" |
| 192 |
"""Get/set descriptors.""" |
| 193 |
PROPERTY = "property" |
| 194 |
"""Properties.""" |
| 195 |
TYPE_ALIAS = "type_alias" |
| 196 |
"""Type aliases.""" |
| 197 |
ATTRIBUTE = "attribute" |
| 198 |
"""Attributes.""" |
| 199 |
|
| 200 |
def __str__(self) -> str: |
| 201 |
return self.value |