Show more detail on space launch page
This commit is contained in:
parent
e475f98dd6
commit
e16e04ab51
3 changed files with 41 additions and 11 deletions
|
|
@ -22,12 +22,21 @@ def format_list_with_ampersand(items: list[str]) -> str:
|
|||
return ""
|
||||
|
||||
|
||||
ESA = "AUT,BEL,CZE,DNK,FIN,FRA,DEU,GRC,IRE,ITA,LUZ,NLD,NOR,POL,PRT,ROU,ESP,SWE,CHE,GBR"
|
||||
|
||||
|
||||
def get_country(alpha_2: str) -> pycountry.db.Country | None:
|
||||
"""Lookup country by alpha-2 country code."""
|
||||
if alpha_2 == ESA:
|
||||
return pycountry.db.Country(flag="🇪🇺", name="ESA")
|
||||
if not alpha_2:
|
||||
return None
|
||||
if alpha_2 == "xk":
|
||||
return pycountry.db.Country(flag="\U0001F1FD\U0001F1F0", name="Kosovo")
|
||||
|
||||
country: pycountry.db.Country = pycountry.countries.get(alpha_2=alpha_2.upper())
|
||||
country: pycountry.db.Country
|
||||
if len(alpha_2) == 2:
|
||||
country = pycountry.countries.get(alpha_2=alpha_2.upper())
|
||||
elif len(alpha_2) == 3:
|
||||
country = pycountry.countries.get(alpha_3=alpha_2.upper())
|
||||
return country
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue