Skip to content

check

Helper classes for doctor checks.

Check

Bases: BaseModel

Holds a success status and a success/failure message for a single doctor check.

Source code in dapla_team_cli/doctor/check.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Check(BaseModel):
    """Holds a success status and a success/failure message for a single doctor check."""

    success: bool
    message: str

    def __bool__(self) -> bool:
        """Simplify expressions.

        E.g. 'if check' instead of 'if check.success'
        """
        return self.success

    def __str__(self) -> str:
        """Simplify expressions.

        E.g. 'print(check)' instead of 'print(check.message)'
        """
        return self.message

__bool__()

Simplify expressions.

E.g. 'if check' instead of 'if check.success'

Source code in dapla_team_cli/doctor/check.py
11
12
13
14
15
16
def __bool__(self) -> bool:
    """Simplify expressions.

    E.g. 'if check' instead of 'if check.success'
    """
    return self.success

__str__()

Simplify expressions.

E.g. 'print(check)' instead of 'print(check.message)'

Source code in dapla_team_cli/doctor/check.py
18
19
20
21
22
23
def __str__(self) -> str:
    """Simplify expressions.

    E.g. 'print(check)' instead of 'print(check.message)'
    """
    return self.message

Failure

Bases: Check

A failed check.

Source code in dapla_team_cli/doctor/check.py
32
33
34
35
class Failure(Check):
    """A failed check."""

    success: bool = False

Success

Bases: Check

A successful check.

Source code in dapla_team_cli/doctor/check.py
26
27
28
29
class Success(Check):
    """A successful check."""

    success: bool = True