Open
Description
LGTM is overly pedantic with Python's typing.Protocol
, i.e. structural typing, expecting it to be complete like a regular class.
A Protocol
is often used for type-hints of the minimum required functionality. In the false positive, a Protocol
is used to express "can be compared by <
"; this is the minimum required to allow sorting:
The sort routines are guaranteed to use
__lt__()
when making comparisons between two objects.
So the entire purpose of the Protocol
is just to express the minimum not complete functionality.
LGTM instead treats this Protocol
as a regular class and warns because it expects the complete set of comparison operators.