Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/betterproto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _parse_float(value: Any) -> float:

Parameters
----------
value : Any
value: Any
Value to parse

Returns
Expand All @@ -455,20 +455,19 @@ def _dump_float(value: float) -> Union[float, str]:

Parameters
----------
value : float
value: float
Value to dump

Returns
-------
Union[float, str]
Dumped valid, either a float or the strings
"Infinity" or "-Infinity"
Dumped value, either a float or the strings
"""
if value == float("inf"):
return INFINITY
if value == -float("inf"):
return NEG_INFINITY
if value == float("nan"):
if math.isnan(value):
return NAN
return value

Expand Down