Skip to content

Commit

Permalink
Fix mypy test
Browse files Browse the repository at this point in the history
  • Loading branch information
kadero committed Oct 5, 2021
1 parent d61225a commit 4349176
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion core/dbt/contracts/graph/unparsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ class Time(dbtClassMixin, Mergeable):
period: Optional[TimePeriod] = None

def exceeded(self, actual_age: float) -> bool:
kwargs = {self.period.plural(): self.count}
if self.period is None:
return False
if self.count is None:
return False
kwargs: Dict[str, int] = {self.period.plural(): self.count}
difference = timedelta(**kwargs).total_seconds()
return actual_age > difference

Expand Down
8 changes: 4 additions & 4 deletions core/dbt/parser/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,15 @@ def get_unused_msg(
def merge_freshness_time_thresholds(
base: Optional[Time], update: Optional[Time]
) -> Optional[Time]:
if base is None and update is None:
return None
if base is not None and update is not None:
return base.merged(update)
elif base is None and update is not None:
return update
elif base is not None and update is None:
return base
else:
# base and update are not none
return base.merged(update)
# base and update are none
return None


def merge_freshness(
Expand Down

0 comments on commit 4349176

Please sign in to comment.