Skip to content

Commit a49f32a

Browse files
committed
Refactor for mypy issue
1 parent 52a481b commit a49f32a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pymdownx/blocks/block.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ def type_number(value: Any) -> int | float:
8989
def type_integer(value: Any) -> int:
9090
"""Ensure type integer or fail."""
9191

92-
if not isinstance(value, int):
93-
if not isinstance(value, float) or not value.is_integer():
94-
raise ValueError(f"Could not convert type {type(value)} to an integer")
95-
value = int(value)
92+
if isinstance(value, int):
93+
return value
9694

97-
return value
95+
if not isinstance(value, float) or not value.is_integer():
96+
raise ValueError(f"Could not convert type {type(value)} to an integer")
97+
return int(value)
9898

9999

100100
def type_ranged_number(minimum: int | None = None, maximum: int | None = None) -> Callable[[Any], int | float]:

0 commit comments

Comments
 (0)