Skip to content

Commit

Permalink
fix(mypy): Resolves regression introducted in #9824 (#9973)
Browse files Browse the repository at this point in the history
Co-authored-by: John Bodley <john.bodley@airbnb.com>
  • Loading branch information
john-bodley and john-bodley committed Jun 3, 2020
1 parent 3fd6e06 commit ee777ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions superset/common/query_object.py
Expand Up @@ -58,8 +58,8 @@ class QueryObject:
"""

granularity: Optional[str]
from_dttm: datetime
to_dttm: datetime
from_dttm: Optional[datetime]
to_dttm: Optional[datetime]
is_timeseries: bool
time_shift: Optional[timedelta]
groupby: List[str]
Expand Down
4 changes: 2 additions & 2 deletions superset/connectors/sqla/models.py
Expand Up @@ -714,8 +714,8 @@ def get_sqla_query( # sqla
self,
metrics: List[Metric],
granularity: str,
from_dttm: datetime,
to_dttm: datetime,
from_dttm: Optional[datetime],
to_dttm: Optional[datetime],
columns: Optional[List[str]] = None,
groupby: Optional[List[str]] = None,
filter: Optional[List[Dict[str, Any]]] = None,
Expand Down
2 changes: 1 addition & 1 deletion superset/tasks/cache.py
Expand Up @@ -163,7 +163,7 @@ class TopNDashboardsStrategy(Strategy):
def __init__(self, top_n: int = 5, since: str = "7 days ago") -> None:
super(TopNDashboardsStrategy, self).__init__()
self.top_n = top_n
self.since = parse_human_datetime(since)
self.since = parse_human_datetime(since) if since else None

def get_urls(self) -> List[str]:
urls = []
Expand Down
8 changes: 4 additions & 4 deletions superset/utils/core.py
Expand Up @@ -1022,7 +1022,7 @@ def get_since_until(
time_shift: Optional[str] = None,
relative_start: Optional[str] = None,
relative_end: Optional[str] = None,
) -> Tuple[datetime, datetime]:
) -> Tuple[Optional[datetime], Optional[datetime]]:
"""Return `since` and `until` date time tuple from string representations of
time_range, since, until and time_shift.
Expand Down Expand Up @@ -1078,8 +1078,8 @@ def get_since_until(
since, until = time_range.split(separator, 1)
if since and since not in common_time_frames:
since = add_ago_to_since(since)
since = parse_human_datetime(since) # type: ignore
until = parse_human_datetime(until) # type: ignore
since = parse_human_datetime(since) if since else None # type: ignore
until = parse_human_datetime(until) if until else None # type: ignore
elif time_range in common_time_frames:
since, until = common_time_frames[time_range]
elif time_range == "No filter":
Expand All @@ -1100,7 +1100,7 @@ def get_since_until(
since = since or ""
if since:
since = add_ago_to_since(since)
since = parse_human_datetime(since) # type: ignore
since = parse_human_datetime(since) if since else None # type: ignore
until = parse_human_datetime(until) if until else relative_end # type: ignore

if time_shift:
Expand Down

0 comments on commit ee777ac

Please sign in to comment.