wg-backend-django/dell-env/lib/python3.11/site-packages/dash/dash_table/FormatTemplate.py

20 lines
521 B
Python
Raw Normal View History

2023-10-30 03:40:43 -04:00
from .Format import Format, Group, Scheme, Sign, Symbol
def money(decimals, sign=Sign.default):
return Format(
group=Group.yes,
precision=decimals,
scheme=Scheme.fixed,
sign=sign,
symbol=Symbol.yes,
)
def percentage(decimals, rounded=False):
if not isinstance(rounded, bool):
raise TypeError("expected rounded to be a boolean")
rounded = Scheme.percentage_rounded if rounded else Scheme.percentage
return Format(scheme=rounded, precision=decimals)