Skip to content

Commit

Permalink
fix: Properly handle NaN and Inf default values (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored Apr 19, 2024
1 parent f00f972 commit c937533
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scripts/generate_options_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def type_hint(value: typing.Any):


def get_value(value: typing.Any):
if isinstance(value, float) and math.isnan(value):
return 'float("nan")'
if value == float("inf"):
return 'float("inf")'
if isinstance(value, float) and math.isnan(value):
return 'float("nan")'
if isinstance(value, SliceType):
return f"SliceType.{value.name}"
if isinstance(value, MuliplanarType):
Expand All @@ -66,7 +66,7 @@ def generate_mixin(options: typing.Dict[str, typing.Any]):
"",
"import typing",
"",
"from ._constants import SliceType, MuliplanarType, DragMode",
"from ._constants import DragMode, MuliplanarType, SliceType",
"",
'__all__ = ["OptionsMixin"]',
"",
Expand Down
1 change: 0 additions & 1 deletion src/ipyniivue/_options_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

__all__ = ["OptionsMixin"]


class OptionsMixin:
@property
def text_height(self) -> float:
Expand Down

0 comments on commit c937533

Please sign in to comment.