diff --git a/docs/changelog.md b/docs/changelog.md index d56be2d0..d74a4c4e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,14 @@ ## Version 1.5 +### Version 1.5.1 + +#### Fixes + +- fix: uncap numpy [#502][] + +[#502]: https://github.com/scikit-hep/vector/pull/502 + ### Version 1.5.0 #### Breaking diff --git a/pyproject.toml b/pyproject.toml index 1e544037..a635003f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dynamic = [ "version", ] dependencies = [ - "numpy>=1.13.3,<2.1", + "numpy>=1.13.3", "packaging>=19", ] optional-dependencies.awkward = [ diff --git a/src/vector/backends/numpy.py b/src/vector/backends/numpy.py index 679afc43..be35718d 100644 --- a/src/vector/backends/numpy.py +++ b/src/vector/backends/numpy.py @@ -215,38 +215,38 @@ def _getitem( ) if hasattr(array, "_longitudinal_type"): longitudinal = array._longitudinal_type.ObjectClass( - *(out[x] for x in _coordinate_class_to_names[_ltype(array)]) # type: ignore[arg-type] + *(out[x] for x in _coordinate_class_to_names[_ltype(array)]) ) if hasattr(array, "_temporal_type"): temporal = array._temporal_type.ObjectClass( - *(out[x] for x in _coordinate_class_to_names[_ttype(array)]) # type: ignore[arg-type] + *(out[x] for x in _coordinate_class_to_names[_ttype(array)]) ) if temporal is not None: return array.ObjectClass( azimuthal=azimuthal, - longitudinal=longitudinal, # type: ignore[arg-type, return-value] + longitudinal=longitudinal, # type: ignore[arg-type] temporal=temporal, # type: ignore[arg-type] ) elif longitudinal is not None: - return array.ObjectClass(azimuthal=azimuthal, longitudinal=longitudinal) # type: ignore[arg-type, return-value] + return array.ObjectClass(azimuthal=azimuthal, longitudinal=longitudinal) # type: ignore[arg-type] elif azimuthal is not None: - return array.ObjectClass(azimuthal=azimuthal) # type: ignore[return-value] + return array.ObjectClass(azimuthal=azimuthal) elif issubclass(array.ObjectClass, vector.backends.object.AzimuthalObject): - return array.ObjectClass(*tuple(out)[:2]) # type: ignore[arg-type, return-value] + return array.ObjectClass(*tuple(out)[:2]) # type: ignore[arg-type] elif issubclass(array.ObjectClass, vector.backends.object.LongitudinalObject): coords = ( out.view(numpy.ndarray)[0] if len(out) == 1 # type: ignore[arg-type] else out.view(numpy.ndarray)[2] ) - return array.ObjectClass(coords) # type: ignore[return-value] + return array.ObjectClass(coords) else: coords = ( out.view(numpy.ndarray)[0] if len(out) == 1 # type: ignore[arg-type] else out.view(numpy.ndarray)[3] ) - return array.ObjectClass(coords) # type: ignore[return-value] + return array.ObjectClass(coords) def _array_repr( @@ -879,14 +879,14 @@ def sum( keepdims=keepdims, initial=initial, where=where, - ), # type: ignore[call-overload] + ), ) def __eq__(self, other: typing.Any) -> typing.Any: - return numpy.equal(self, other) # type: ignore[call-overload] + return numpy.equal(self, other) def __ne__(self, other: typing.Any) -> typing.Any: - return numpy.not_equal(self, other) # type: ignore[call-overload] + return numpy.not_equal(self, other) def __reduce__(self) -> str | tuple[typing.Any, ...]: pickled_state = super().__reduce__() @@ -1197,7 +1197,7 @@ def azimuthal(self) -> AzimuthalNumpy: AzimuthalNumpyXY([(1.1, 2.1), (1.2, 2.2), (1.3, 2.3), (1.4, 2.4), (1.5, 2.5)], dtype=[('x', ' None: return _setitem(self, where, what, False) -class MomentumNumpy2D(PlanarMomentum, VectorNumpy2D): # type: ignore[misc] +class MomentumNumpy2D(PlanarMomentum, VectorNumpy2D): """ Two dimensional momentum vector class for the NumPy backend. This class can be directly used to construct two dimensional NumPy momentum vectors. For two dimensional @@ -1427,13 +1427,13 @@ def __repr__(self) -> str: def azimuthal(self) -> AzimuthalNumpy: """Returns the azimuthal type class for the given ``VectorNumpy3D`` object.""" # TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194 - return self.view(self._azimuthal_type) # type: ignore[return-value] + return self.view(self._azimuthal_type) @property def longitudinal(self) -> LongitudinalNumpy: """Returns the longitudinal type class for the given ``VectorNumpy3D`` object.""" # TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194 - return self.view(self._longitudinal_type) # type: ignore[return-value] + return self.view(self._longitudinal_type) def _wrap_result( self, @@ -1562,7 +1562,7 @@ def __setitem__(self, where: typing.Any, what: typing.Any) -> None: return _setitem(self, where, what, False) -class MomentumNumpy3D(SpatialMomentum, VectorNumpy3D): # type: ignore[misc] +class MomentumNumpy3D(SpatialMomentum, VectorNumpy3D): """ Three dimensional momentum vector class for the NumPy backend. This class can be directly used to construct three dimensional NumPy momentum vectors. For three dimensional @@ -1707,19 +1707,19 @@ def __repr__(self) -> str: def azimuthal(self) -> AzimuthalNumpy: """Returns the azimuthal type class for the given ``VectorNumpy4D`` object.""" # TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194 - return self.view(self._azimuthal_type) # type: ignore[return-value] + return self.view(self._azimuthal_type) @property def longitudinal(self) -> LongitudinalNumpy: """Returns the longitudinal type class for the given ``Vectornumpy4D`` object.""" # TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194 - return self.view(self._longitudinal_type) # type: ignore[return-value] + return self.view(self._longitudinal_type) @property def temporal(self) -> TemporalNumpy: """Returns the azimuthal type class for the given ``VectorNumpy4D`` object.""" # TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194 - return self.view(self._temporal_type) # type: ignore[return-value] + return self.view(self._temporal_type) def _wrap_result( self, @@ -1882,7 +1882,7 @@ def __setitem__(self, where: typing.Any, what: typing.Any) -> None: return _setitem(self, where, what, False) -class MomentumNumpy4D(LorentzMomentum, VectorNumpy4D): # type: ignore[misc] +class MomentumNumpy4D(LorentzMomentum, VectorNumpy4D): """ Four dimensional momentum vector class for the NumPy backend. This class can be directly used to construct four dimensional NumPy momentum vectors. For three dimensional diff --git a/src/vector/backends/object.py b/src/vector/backends/object.py index 7f585e13..2b15be8e 100644 --- a/src/vector/backends/object.py +++ b/src/vector/backends/object.py @@ -332,61 +332,61 @@ class VectorObject(Vector): lib = numpy def __eq__(self, other: typing.Any) -> typing.Any: - return numpy.equal(self, other) # type: ignore[call-overload] + return numpy.equal(self, other) def __ne__(self, other: typing.Any) -> typing.Any: - return numpy.not_equal(self, other) # type: ignore[call-overload] + return numpy.not_equal(self, other) def __abs__(self) -> float: return numpy.absolute(self) def __add__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.add(self, other) # type: ignore[call-overload] + return numpy.add(self, other) def __radd__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.add(other, self) # type: ignore[call-overload] + return numpy.add(other, self) def __iadd__(self: SameVectorType, other: VectorProtocol) -> SameVectorType: - return _replace_data(self, numpy.add(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.add(self, other)) def __sub__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.subtract(self, other) # type: ignore[call-overload] + return numpy.subtract(self, other) def __rsub__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.subtract(other, self) # type: ignore[call-overload] + return numpy.subtract(other, self) def __isub__(self: SameVectorType, other: VectorProtocol) -> SameVectorType: - return _replace_data(self, numpy.subtract(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.subtract(self, other)) def __mul__(self, other: float) -> VectorProtocol: - return numpy.multiply(self, other) # type: ignore[call-overload] + return numpy.multiply(self, other) def __rmul__(self, other: float) -> VectorProtocol: - return numpy.multiply(other, self) # type: ignore[call-overload] + return numpy.multiply(other, self) def __imul__(self: SameVectorType, other: float) -> SameVectorType: - return _replace_data(self, numpy.multiply(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.multiply(self, other)) def __neg__(self: SameVectorType) -> SameVectorType: - return numpy.negative(self) # type: ignore[call-overload] + return numpy.negative(self) def __pos__(self: SameVectorType) -> SameVectorType: - return numpy.positive(self) # type: ignore[call-overload] + return numpy.positive(self) def __truediv__(self, other: float) -> VectorProtocol: - return numpy.true_divide(self, other) # type: ignore[call-overload] + return numpy.true_divide(self, other) def __rtruediv__(self, other: float) -> VectorProtocol: - return numpy.true_divide(other, self) # type: ignore[call-overload] + return numpy.true_divide(other, self) def __itruediv__(self: SameVectorType, other: float) -> VectorProtocol: - return _replace_data(self, numpy.true_divide(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.true_divide(self, other)) def __pow__(self, other: float) -> float: - return numpy.square(self) if other == 2 else numpy.power(self, other) # type: ignore[call-overload] + return numpy.square(self) if other == 2 else numpy.power(self, other) def __matmul__(self, other: VectorProtocol) -> float: - return numpy.matmul(self, other) # type: ignore[call-overload] + return numpy.matmul(self, other) def __array_ufunc__( self, diff --git a/src/vector/backends/sympy.py b/src/vector/backends/sympy.py index 7132f35a..840d0576 100644 --- a/src/vector/backends/sympy.py +++ b/src/vector/backends/sympy.py @@ -345,61 +345,61 @@ class VectorSympy(Vector): lib = SympyLib() def __eq__(self, other: typing.Any) -> typing.Any: - return numpy.equal(self, other) # type: ignore[call-overload] + return numpy.equal(self, other) def __ne__(self, other: typing.Any) -> typing.Any: - return numpy.not_equal(self, other) # type: ignore[call-overload] + return numpy.not_equal(self, other) def __abs__(self) -> float: return numpy.absolute(self) def __add__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.add(self, other) # type: ignore[call-overload] + return numpy.add(self, other) def __radd__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.add(other, self) # type: ignore[call-overload] + return numpy.add(other, self) def __iadd__(self: SameVectorType, other: VectorProtocol) -> SameVectorType: - return _replace_data(self, numpy.add(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.add(self, other)) def __sub__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.subtract(self, other) # type: ignore[call-overload] + return numpy.subtract(self, other) def __rsub__(self, other: VectorProtocol) -> VectorProtocol: - return numpy.subtract(other, self) # type: ignore[call-overload] + return numpy.subtract(other, self) def __isub__(self: SameVectorType, other: VectorProtocol) -> SameVectorType: - return _replace_data(self, numpy.subtract(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.subtract(self, other)) def __mul__(self, other: float) -> VectorProtocol: - return numpy.multiply(self, other) # type: ignore[call-overload] + return numpy.multiply(self, other) def __rmul__(self, other: float) -> VectorProtocol: - return numpy.multiply(other, self) # type: ignore[call-overload] + return numpy.multiply(other, self) def __imul__(self: SameVectorType, other: float) -> SameVectorType: - return _replace_data(self, numpy.multiply(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.multiply(self, other)) def __neg__(self: SameVectorType) -> SameVectorType: - return numpy.negative(self) # type: ignore[call-overload] + return numpy.negative(self) def __pos__(self: SameVectorType) -> SameVectorType: - return numpy.positive(self) # type: ignore[call-overload] + return numpy.positive(self) def __truediv__(self, other: float) -> VectorProtocol: - return numpy.true_divide(self, other) # type: ignore[call-overload] + return numpy.true_divide(self, other) def __rtruediv__(self, other: float) -> VectorProtocol: - return numpy.true_divide(other, self) # type: ignore[call-overload] + return numpy.true_divide(other, self) def __itruediv__(self: SameVectorType, other: float) -> VectorProtocol: - return _replace_data(self, numpy.true_divide(self, other)) # type: ignore[call-overload] + return _replace_data(self, numpy.true_divide(self, other)) def __pow__(self, other: float) -> float: - return numpy.power(self, other) # type: ignore[call-overload] + return numpy.power(self, other) def __matmul__(self, other: VectorProtocol) -> float: - return numpy.matmul(self, other) # type: ignore[call-overload] + return numpy.matmul(self, other) def __array_ufunc__( self,