(values: Sequence[Optional[float]])
| 64 | |
| 65 | |
| 66 | def mean(values: Sequence[Optional[float]]) -> Optional[float]: |
| 67 | clean = [float(value) for value in values if value is not None and math.isfinite(float(value))] |
| 68 | if not clean: |
| 69 | return None |
| 70 | return sum(clean) / len(clean) |
| 71 | |
| 72 | |
| 73 | def safe_div(numerator: float, denominator: float) -> Optional[float]: |
no outgoing calls
no test coverage detected