class NumberPattern: (source)
Undocumented
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | apply |
Renders into a string a number following the defined pattern. |
Method | compute |
Return the scaling factor to apply to the number before rendering. |
Method | scientific |
Returns normalized scientific notation components of a value. |
Instance Variable | exp |
Undocumented |
Instance Variable | exp |
Undocumented |
Instance Variable | frac |
Undocumented |
Instance Variable | grouping |
Undocumented |
Instance Variable | int |
Undocumented |
Instance Variable | number |
Undocumented |
Instance Variable | pattern |
Undocumented |
Instance Variable | prefix |
Undocumented |
Instance Variable | scale |
Undocumented |
Instance Variable | suffix |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _quantize |
Undocumented |
str
, prefix: tuple[ str, str]
, suffix: tuple[ str, str]
, grouping: tuple[ int, int]
, int_prec: tuple[ int, int]
, frac_prec: tuple[ int, int]
, exp_prec: tuple[ int, int]|None
, exp_plus: bool|None
, number_pattern: str|None
= None):
(source)
¶
Undocumented
(float|decimal.Decimal)|str
, locale: (Locale|str)|None
, currency: str|None
= None, currency_digits: bool
= True, decimal_quantization: bool
= True, force_frac: tuple[ int, int]|None
= None, group_separator: bool
= True):
(source)
¶
Renders into a string a number following the defined pattern. Forced decimal quantization is active by default so we'll produce a number string that is strictly following CLDR pattern definitions. :param value: The value to format. If this is not a Decimal object, it will be cast to one. :type value: decimal.Decimal|float|int :param locale: The locale to use for formatting. :type locale: str|babel.core.Locale :param currency: Which currency, if any, to format as. :type currency: str|None :param currency_digits: Whether or not to use the currency's precision. If false, the pattern's precision is used. :type currency_digits: bool :param decimal_quantization: Whether decimal numbers should be forcibly quantized to produce a formatted output strictly matching the CLDR definition for the locale. :type decimal_quantization: bool :param force_frac: DEPRECATED - a forced override for `self.frac_prec` for a single formatting invocation. :return: Formatted decimal string. :rtype: str
Return the scaling factor to apply to the number before rendering. Auto-set to a factor of 2 or 3 if presence of a ``%`` or ``‰`` sign is detected in the prefix or suffix of the pattern. Default is to not mess with the scale at all and keep it to 0.
decimal.Decimal
, locale: (Locale|str)|None
) -> tuple[ decimal.Decimal, int, str]
:
(source)
¶
Returns normalized scientific notation components of a value.
str
, locale: (Locale|str)|None
, force_frac: tuple[ int, int]|None
= None) -> str
:
(source)
¶
Undocumented