-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Right now mypy
throws a bunch of errors in this particular code block -
vector/src/vector/backends/awkward.py
Lines 575 to 582 in 02d4655
def _class_to_name(cls: typing.Type[VectorProtocol]) -> str: | |
if issubclass(cls, Momentum): | |
if issubclass(cls, Vector2D): # type: ignore[unreachable] | |
return "Momentum2D" # type: ignore[unreachable] | |
elif issubclass(cls, Vector3D): # type: ignore[unreachable] | |
return "Momentum3D" # type: ignore[unreachable] | |
elif issubclass(cls, Vector4D): # type: ignore[unreachable] | |
return "Momentum4D" # type: ignore[unreachable] |
saying -
error: Subclass of "VectorProtocol", "Momentum", and "Vector2D" cannot exist: would have inconsistent method resolution order [unreachable]
These errors have been suppressed using the type: ignore[unreachable]
comments, but this should be fixed. The type: ignore[unreachable]
comments should be removed from Vector
(these are the only type: ignore[unreachable]
comments left in the codebase).
Guessing it is not understanding that
Type[VectorProtocol]
can (sometimes) pass a subclass ofMomentum
check? Might be worth updating that. But not in this PR, these are (all) fine for now.
Originally posted by @henryiii in #219 (comment)
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed
Type
Projects
Status
No status