Skip to content

Commit

Permalink
pythongh-111277: In summarize_stats.py, don't fail fast on invalid ra…
Browse files Browse the repository at this point in the history
…tios
  • Loading branch information
mdboom committed Oct 25, 2023
1 parent 9da98c0 commit 5b51a44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tools/scripts/summarize_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,6 @@ def __init__(self, num: int, den: int | None, percentage: bool = True):
self.num = num
self.den = den
self.percentage = percentage
if den == 0 and num != 0:
raise ValueError("Invalid denominator")

def __float__(self):
if self.den == 0:
Expand All @@ -432,6 +430,8 @@ def __float__(self):

def markdown(self) -> str:
if self.den == 0 or self.den is None:
if self.num != 0:
return f"{self.num:,} / 0 !!"
return ""
elif self.percentage:
return f"{self.num / self.den:,.01%}"
Expand Down

0 comments on commit 5b51a44

Please sign in to comment.