Skip to content

Report Manager models

ColorManager

Bases: BaseModel

Color management for status report.

Attributes:

Name Type Description
level str

Test result value.

color str

Associated color.

string

string() -> str

Build an str with color code

Returns:

Name Type Description
str str

String with level and its associated color

Source code in anta/reporter/models.py
32
33
34
35
36
37
38
39
def string(self) -> str:
    """
    Build an str with color code

    Returns:
        str: String with level and its associated color
    """
    return f"[{self.color}]{self.level}"

style_rich

style_rich() -> Text

Build a rich Text syntax with color

Returns:

Name Type Description
Text Text

object with level string and its associated color.

Source code in anta/reporter/models.py
23
24
25
26
27
28
29
30
def style_rich(self) -> Text:
    """
    Build a rich Text syntax with color

    Returns:
        Text: object with level string and its associated color.
    """
    return Text(self.level, style=self.color)

Last update: August 18, 2023