pyre-check doesn't detect naive date vs. tz aware date type error

63 Views Asked by At

Why can't Python type checker (I tried Pyre) find this type error?

from datetime import datetime
import pytz

utc = pytz.utc
a = utc.localize(datetime.now())

print(a)
#2021-12-11 15:55:35.187927+00:00

print( datetime.now())
#2021-12-11 15:55:35.188028

if a > datetime.now():  # type error here. TypeError: can't compare offset-naive and offset-aware datetimes
    print("done")
0

There are 0 best solutions below