Skip to content

Commit

Permalink
Fix variable loading when they are unset
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-decker committed Jan 27, 2025
1 parent 97618b6 commit 3be1632
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions selfdrive/frogpilot/fleetmanager/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,30 @@ def get_nav_active():
return False

def get_amap_key():
token = params.get("AMapKey1", encoding='utf8')
token2 = params.get("AMapKey2", encoding='utf8')
return (
token.strip() if (token := params.get("AMapKey1", encoding='utf8')) != "0" else None,
token2.strip() if (token2 := params.get("AMapKey2", encoding='utf8')) != "0" else None
token.strip() if token and token != "0" else None,
token2.strip() if token2 and token2 != "0" else None
)

def get_gmap_key():
return token.strip() if (token := params.get("GMapKey", encoding='utf8')) != "0" else None
token = params.get("GMapKey", encoding='utf8')
if token is None:
return None
return token.strip() if token != "0" else None

def get_public_token():
return token.strip() if (token := params.get("MapboxPublicKey", encoding='utf8')).startswith("pk") else None
token = params.get("MapboxPublicKey", encoding='utf8')
if token is None:
return None
return token.strip() if token.startswith("pk") else None

def get_app_token():
return token.strip() if (token := params.get("MapboxSecretKey", encoding='utf8')).startswith("sk") else None
token = params.get("MapboxSecretKey", encoding='utf8')
if token is None:
return None
return token.strip() if token.startswith("sk") else None

def get_SearchInput():
SearchInput = params.get_int("SearchInput")
Expand Down

0 comments on commit 3be1632

Please sign in to comment.