mirror of
				https://github.com/python/cpython.git
				synced 2025-11-01 06:01:29 +00:00 
			
		
		
		
	gh-111277: In summarize_stats.py, don't fail fast on invalid ratios (#111278)
This commit is contained in:
		
							parent
							
								
									84b4533e84
								
							
						
					
					
						commit
						9495bcaf59
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -421,8 +421,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: | ||||
|  | @ -433,7 +431,11 @@ def __float__(self): | |||
|             return self.num / self.den | ||||
| 
 | ||||
|     def markdown(self) -> str: | ||||
|         if self.den == 0 or self.den is None: | ||||
|         if self.den is None: | ||||
|             return "" | ||||
|         elif self.den == 0: | ||||
|             if self.num != 0: | ||||
|                 return f"{self.num:,} / 0 !!" | ||||
|             return "" | ||||
|         elif self.percentage: | ||||
|             return f"{self.num / self.den:,.01%}" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Michael Droettboom
						Michael Droettboom