Skip to content

Commit

Permalink
tests pass in a cython 3.0.2 environment
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-waltmann committed Aug 28, 2023
1 parent 349983f commit 5a32216
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions freud/box.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -718,15 +718,7 @@ cdef class Box:
pass
return NotImplemented

def __mul__(arg1, arg2):
# Note Cython treats __mul__ and __rmul__ as one operation, so
# type checks are necessary.
if isinstance(arg1, freud.box.Box):
self = arg1
scale = arg2
else:
scale = arg1
self = arg2
def _mul_impl(self, scale):
if scale > 0:
return self.__class__(Lx=self.Lx*scale,
Ly=self.Ly*scale,
Expand All @@ -736,6 +728,12 @@ cdef class Box:
else:
raise ValueError("Box can only be multiplied by positive values.")

def __mul__(self, scale):
return self._mul_impl(scale)

def __rmul__(self, scale):
return self._mul_impl(scale)

def plot(self, title=None, ax=None, image=[0, 0, 0], *args, **kwargs):
"""Plot a :class:`~.box.Box` object.
Expand Down
2 changes: 1 addition & 1 deletion freud/locality.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ cdef class NeighborQueryResult:
yield (npoint.query_point_idx, npoint.point_idx, npoint.distance)
npoint = dereference(iterator).next()

raise StopIteration
return

def toNeighborList(self, sort_by_distance=False):
"""Convert query result to a freud :class:`~NeighborList`.
Expand Down

0 comments on commit 5a32216

Please sign in to comment.