Skip to content

Commit

Permalink
Reduces hierarchies of if-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Jan 10, 2022
1 parent 030d322 commit 3e3c7bb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions superset/dashboards/filter_state/commands/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@
class GetFilterStateCommand(GetKeyValueCommand):
def get(self, resource_id: int, key: str, refresh_timeout: bool) -> Optional[str]:
dashboard = DashboardDAO.get_by_id_or_slug(str(resource_id))
if dashboard:
entry: Entry = cache_manager.filter_state_cache.get(
cache_key(resource_id, key)
)
if entry:
if refresh_timeout:
cache_manager.filter_state_cache.set(key, entry)
return entry["value"]
return None
entry: Entry = cache_manager.filter_state_cache.get(
cache_key(resource_id, key)
) or {}
if dashboard and entry and refresh_timeout:
cache_manager.filter_state_cache.set(key, entry)
return entry.get("value")

0 comments on commit 3e3c7bb

Please sign in to comment.