lint: various non-semantic fixes
This commit is contained in:
parent
cbd80cf7b3
commit
273dcb2a8a
5 changed files with 13 additions and 13 deletions
|
@ -3,18 +3,18 @@ from __future__ import annotations
|
|||
from typing import Any
|
||||
|
||||
|
||||
def is_integer(n: Any) -> bool:
|
||||
def is_integer(contender: Any) -> bool:
|
||||
"""
|
||||
Determine if a string (or other object type that can be converted automatically) represents an integer.
|
||||
|
||||
Thanks to https://note.nkmk.me/en/python-check-int-float/.
|
||||
|
||||
:param n: object to test
|
||||
:param contender: object to test
|
||||
:return: true if it's an integer
|
||||
"""
|
||||
try:
|
||||
float(n)
|
||||
float(contender)
|
||||
except ValueError:
|
||||
return False
|
||||
else:
|
||||
return float(n).is_integer()
|
||||
return float(contender).is_integer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue