brn: Introduce BRN as a class
This commit is contained in:
parent
8c411e39bc
commit
a0da4d4641
8 changed files with 116 additions and 9 deletions
20
app/brm/utils.py
Normal file
20
app/brm/utils.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def is_integer(n: 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
|
||||
:return: true if it's an integer
|
||||
"""
|
||||
try:
|
||||
float(n)
|
||||
except ValueError:
|
||||
return False
|
||||
else:
|
||||
return float(n).is_integer()
|
Loading…
Add table
Add a link
Reference in a new issue