This is an automated email from the ASF dual-hosted git repository. johnbodley pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push: new ee777ac fix(mypy): Resolves regression introducted in #9824 (#9973) ee777ac is described below commit ee777acd572dbc24831ce319045e883458257a84 Author: John Bodley <4567245+john-bod...@users.noreply.github.com> AuthorDate: Wed Jun 3 00:20:34 2020 -0700 fix(mypy): Resolves regression introducted in #9824 (#9973) Co-authored-by: John Bodley <john.bod...@airbnb.com> --- superset/common/query_object.py | 4 ++-- superset/connectors/sqla/models.py | 4 ++-- superset/tasks/cache.py | 2 +- superset/utils/core.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/superset/common/query_object.py b/superset/common/query_object.py index ea1f3f5..3c5b778 100644 --- a/superset/common/query_object.py +++ b/superset/common/query_object.py @@ -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] diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index 955424f..7236eac 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -714,8 +714,8 @@ class SqlaTable(Model, BaseDatasource): 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, diff --git a/superset/tasks/cache.py b/superset/tasks/cache.py index b530deb..a5b0199 100644 --- a/superset/tasks/cache.py +++ b/superset/tasks/cache.py @@ -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 = [] diff --git a/superset/utils/core.py b/superset/utils/core.py index 58a425f..00e3484 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -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. @@ -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": @@ -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: