Rewrite TripElement.get_emoji() to use dict lookup
This commit is contained in:
parent
277e991869
commit
1948ab8ff5
|
@ -44,16 +44,17 @@ class TripElement:
|
||||||
detail: StrDict
|
detail: StrDict
|
||||||
|
|
||||||
def get_emoji(self) -> str | None:
|
def get_emoji(self) -> str | None:
|
||||||
"""Emjoji for trip element."""
|
"""Emoji for trip element."""
|
||||||
if self.element_type in ("check-in", "check-out"):
|
emoji_map = {
|
||||||
return emoji.emojize(":hotel:", language="alias")
|
"check-in": ":hotel:",
|
||||||
if self.element_type == "train":
|
"check-out": ":hotel:",
|
||||||
return emoji.emojize(":train:", language="alias")
|
"train": ":train:",
|
||||||
if self.element_type == "flight":
|
"flight": ":airplane:",
|
||||||
return emoji.emojize(":airplane:", language="alias")
|
"ferry": ":ferry:",
|
||||||
if self.element_type == "ferry":
|
}
|
||||||
return emoji.emojize(":ferry:", language="alias")
|
|
||||||
return None
|
alias = emoji_map.get(self.element_type)
|
||||||
|
return emoji.emojize(alias, language="alias") if alias else None
|
||||||
|
|
||||||
|
|
||||||
def airport_label(airport: StrDict) -> str:
|
def airport_label(airport: StrDict) -> str:
|
||||||
|
|
Loading…
Reference in a new issue