class NumberPattern(object):
Undocumented
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | _format_frac |
Undocumented |
Method | _format_int |
Undocumented |
Method | _format_significant |
Undocumented |
Method | _quantize_value |
Undocumented |
Method | apply |
Renders into a string a number following the defined pattern. |
Method | compute_scale |
Return the scaling factor to apply to the number before rendering. |
Method | scientific_notation_elements |
Returns normalized scientific notation components of a value. |
Instance Variable | exp_plus |
Undocumented |
Instance Variable | exp_prec |
Undocumented |
Instance Variable | frac_prec |
Undocumented |
Instance Variable | grouping |
Undocumented |
Instance Variable | int_prec |
Undocumented |
Instance Variable | pattern |
Undocumented |
Instance Variable | prefix |
Undocumented |
Instance Variable | scale |
Undocumented |
Instance Variable | suffix |
Undocumented |
Undocumented
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.
Parameters | |
value:decimal.Decimal|float|int | The value to format. If this is not a Decimal object, it will be cast to one. |
locale:str|babel.core.Locale | The locale to use for formatting. |
currency:str|None | Which currency, if any, to format as. |
currency_digits:bool | Whether or not to use the currency's precision. If false, the pattern's precision is used. |
decimal_quantization:bool | Whether decimal numbers should be forcibly quantized to produce a formatted output strictly matching the CLDR definition for the locale. |
force_frac | DEPRECATED - a forced override for self.frac_prec
for a single formatting invocation. |
group_separator | Undocumented |
Returns | |
str | Formatted decimal string. |
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.