Skip to content

Commit

Permalink
Remove rudundant dunder adds and simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
VeckoTheGecko committed Jul 31, 2024
1 parent 3dc6965 commit 3221bf8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
10 changes: 0 additions & 10 deletions parcels/interaction/interactionkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,6 @@ def merge(self, kernel, kclass):
return kclass(self._fieldset, self._ptype, pyfunc=pyfunc,
funcname=funcname)

def __add__(self, kernel):
if not isinstance(kernel, InteractionKernel):
kernel = InteractionKernel(self.fieldset, self.ptype, pyfunc=kernel)
return self.merge(kernel, InteractionKernel)

def __radd__(self, kernel):
if not isinstance(kernel, InteractionKernel):
kernel = InteractionKernel(self.fieldset, self.ptype, pyfunc=kernel)
return kernel.merge(self, InteractionKernel)

def __del__(self):
# Clean-up the in-memory dynamic linked libraries.
# This is not really necessary, as these programs are not that large, but with the new random
Expand Down
4 changes: 1 addition & 3 deletions parcels/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,7 @@ def __add__(self, kernel):
return self.merge(kernel, type(self))

def __radd__(self, kernel):
if not isinstance(kernel, type(self)):
kernel = type(self)(self.fieldset, self.ptype, pyfunc=kernel)
return kernel.merge(self, type(self))
return self + kernel

@classmethod
def from_list(cls, fieldset, ptype, pyfunc_list, *args, **kwargs):
Expand Down

0 comments on commit 3221bf8

Please sign in to comment.