Skip to content

Commit

Permalink
Retire python2 __div__ methods
Browse files Browse the repository at this point in the history
Suggested by ruff rule PLW3201, which is only part of ruff preview mode, but it seems like a good change to make at this point.
  • Loading branch information
markbandstra committed Jun 5, 2024
1 parent a06daf2 commit ef295c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
5 changes: 1 addition & 4 deletions becquerel/core/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ def __mul__(self, other):
# This line adds the right multiplication
__rmul__ = __mul__

def __div__(self, other):
def __truediv__(self, other):
"""Return a new Spectrum object with counts (or CPS) scaled down.
Args:
Expand All @@ -958,9 +958,6 @@ def __div__(self, other):

return self._mul_div(other, div=True)

# This line adds true division
__truediv__ = __div__

def _mul_div(self, scaling_factor: float, div=False):
"""Multiply or divide a spectrum by a scalar. Handle errors.
Expand Down
7 changes: 1 addition & 6 deletions becquerel/tools/isotope_qty.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,8 @@ def __mul__(self, other):

return self._mul_div(other, div=False)

def __div__(self, other):
"""Divide the quantity"""

return self._mul_div(other, div=True)

def __truediv__(self, other):
"""Divide the quantity (python 3)"""
"""Divide the quantity"""

return self._mul_div(other, div=True)

Expand Down

0 comments on commit ef295c4

Please sign in to comment.