Simplify trust_color() using match statement
This commit is contained in:
parent
f6d2b35318
commit
ddc037fa33
@ -224,16 +224,13 @@ def trust_color(trust: Trust) -> Color:
|
|||||||
-------
|
-------
|
||||||
The color representing the passed trust status
|
The color representing the passed trust status
|
||||||
"""
|
"""
|
||||||
color: Color = Color.RED
|
match trust:
|
||||||
if trust == Trust.revoked:
|
case Trust.full:
|
||||||
color = Color.RED
|
return Color.GREEN
|
||||||
if trust == Trust.unknown:
|
case Trust.unknown | Trust.marginal:
|
||||||
color = Color.YELLOW
|
return Color.YELLOW
|
||||||
if trust == Trust.marginal:
|
case _:
|
||||||
color = Color.YELLOW
|
return Color.RED
|
||||||
if trust == Trust.full:
|
|
||||||
color = Color.GREEN
|
|
||||||
return color
|
|
||||||
|
|
||||||
|
|
||||||
def format_trust_label(trust: Trust) -> str:
|
def format_trust_label(trust: Trust) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user