I have the following function:
import pandas as pd
def eq(left: pd.Timestamp, right: pd.Timestamp) -> bool:
return left == right
I get the following error when I run it through Mypy:
error: Returning Any from function declared to return "bool"
I believe this is because Mypy doesn't know about pd.Timestamp
so treats it as Any
. (Using the Mypy reveal_type
function shows that Mypy treats left
and right
as Any
.)
What is the correct way to deal with this to stop Mypy complaining?
from How do I cleanly test equality of objects in Mypy without producing errors?
No comments:
Post a Comment