[mypy] Enforcing typing for superset.utils (#9905)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2020-05-27 22:57:30 -07:00
committed by GitHub
parent 54dced1cf6
commit b296a0f250
17 changed files with 194 additions and 148 deletions

View File

@@ -21,7 +21,7 @@ import pytz
EPOCH = datetime(1970, 1, 1)
def datetime_to_epoch(dttm):
def datetime_to_epoch(dttm: datetime) -> float:
if dttm.tzinfo:
dttm = dttm.replace(tzinfo=pytz.utc)
epoch_with_tz = pytz.utc.localize(EPOCH)
@@ -29,5 +29,5 @@ def datetime_to_epoch(dttm):
return (dttm - EPOCH).total_seconds() * 1000
def now_as_float():
def now_as_float() -> float:
return datetime_to_epoch(datetime.utcnow())