Skip to content

Commit 0f7307c

Browse files
authored
Fix comparision with nan
Also fixed some typos in the docstrings
1 parent 5f7e4d5 commit 0f7307c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/betterproto/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _parse_float(value: Any) -> float:
433433
434434
Parameters
435435
----------
436-
value : Any
436+
value: Any
437437
Value to parse
438438
439439
Returns
@@ -455,20 +455,19 @@ def _dump_float(value: float) -> Union[float, str]:
455455
456456
Parameters
457457
----------
458-
value : float
458+
value: float
459459
Value to dump
460460
461461
Returns
462462
-------
463463
Union[float, str]
464-
Dumped valid, either a float or the strings
465-
"Infinity" or "-Infinity"
464+
Dumped value, either a float or the strings
466465
"""
467466
if value == float("inf"):
468467
return INFINITY
469468
if value == -float("inf"):
470469
return NEG_INFINITY
471-
if value == float("nan"):
470+
if math.isnan(value):
472471
return NAN
473472
return value
474473

0 commit comments

Comments
 (0)