vector
vector copied to clipboard
Get rid of mypy's `# type: ignore[unreachable]` comments
Right now mypy
throws a bunch of errors in this particular code block -
https://github.com/scikit-hep/vector/blob/02d4655bf4c27578ca96c082501b517710570e57/src/vector/backends/awkward.py#L575-L582
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 https://github.com/scikit-hep/vector/pull/219#discussion_r911539892
https://github.com/scikit-hep/vector/pull/89 removes warn_unreachable = true
for now.
I guess the issue here is that Momentum is a subclass of VectorProtocol, while Vector2D, Vector3D etc. are also subclasses.