You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy .\mwe.py
mwe.py:17: error: Argument "key" to "max" has incompatible type"Callable[[MyClass], Timestamp]"; expected "Callable[[MyClass], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]" [arg-type]
mwe.py:17: error: Incompatible return value type (got "Timestamp", expected "Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]") [return-value]
Found 2 errors in 1 file (checked 1 source file)
I hope this is the right package, because this is an issue between mypy, protobuf, proto-plus and maybe something else.
When I have a Timestamp as a field, the proto-plus turns it into DatetimeWithNanoseconds which has arithmetic defined, because it extends datetime.datetime, but mypy does not know about it.
This is more elaborate example
This is indeed an issue with this package. There's no special-handling of Timestamp currently. I'll see if I can do something about that. Thanks for the heads-up
I have following issue with timestamp and mypy:
mwe.py
when I run the code, it succeeds:
python .\mwe.py max(classes, key=lambda m: m.create_time)=create_time { seconds: 2 nanos: 2 }
but it fails on mypy
I hope this is the right package, because this is an issue between mypy, protobuf, proto-plus and maybe something else.
When I have a
Timestamp
as a field, theproto-plus
turns it intoDatetimeWithNanoseconds
which has arithmetic defined, because it extendsdatetime.datetime
, but mypy does not know about it.This is more elaborate example
problem_example.py
which prints
I am using python 3.9 and here are all versions of packages:
The text was updated successfully, but these errors were encountered: