|
1 |
| -from typing import Any |
| 1 | +import decimal |
| 2 | +from datetime import date |
| 3 | +from re import Pattern |
| 4 | +from typing_extensions import Literal |
2 | 5 |
|
3 | 6 | from babel.core import Locale
|
4 | 7 |
|
5 | 8 | long = int
|
6 |
| -LC_NUMERIC: Any |
| 9 | +LC_NUMERIC: str | None |
7 | 10 |
|
8 | 11 | class UnknownCurrencyError(Exception):
|
9 |
| - identifier: Any |
10 |
| - def __init__(self, identifier) -> None: ... |
| 12 | + identifier: str |
| 13 | + def __init__(self, identifier: str) -> None: ... |
11 | 14 |
|
12 |
| -def list_currencies(locale: Any | None = ...): ... |
13 |
| -def validate_currency(currency, locale: Any | None = ...) -> None: ... |
14 |
| -def is_currency(currency, locale: Any | None = ...): ... |
15 |
| -def normalize_currency(currency, locale: Any | None = ...): ... |
16 |
| -def get_currency_name(currency, count: Any | None = ..., locale=...): ... |
17 |
| -def get_currency_symbol(currency, locale=...): ... |
18 |
| -def get_currency_precision(currency): ... |
19 |
| -def get_currency_unit_pattern(currency, count: Any | None = ..., locale=...): ... |
| 15 | +def list_currencies(locale: Locale | str | None = ...) -> set[str]: ... |
| 16 | +def validate_currency(currency: str, locale: Locale | str | None = ...) -> None: ... |
| 17 | +def is_currency(currency: str, locale: Locale | str | None = ...) -> bool: ... |
| 18 | +def normalize_currency(currency: str, locale: Locale | str | None = ...) -> str | None: ... |
| 19 | +def get_currency_name(currency: str, count: float | decimal.Decimal | None = ..., locale: Locale | str | None = ...) -> str: ... |
| 20 | +def get_currency_symbol(currency: str, locale: Locale | str | None = ...) -> str: ... |
| 21 | +def get_currency_precision(currency: str) -> int: ... |
| 22 | +def get_currency_unit_pattern(currency: str, count: float | None = ..., locale: Locale | str | None = ...) -> str: ... |
20 | 23 | def get_territory_currencies(
|
21 |
| - territory, |
22 |
| - start_date: Any | None = ..., |
23 |
| - end_date: Any | None = ..., |
| 24 | + territory: str, |
| 25 | + start_date: date | None = ..., |
| 26 | + end_date: date | None = ..., |
24 | 27 | tender: bool = ...,
|
25 | 28 | non_tender: bool = ...,
|
26 | 29 | include_details: bool = ...,
|
27 |
| -): ... |
28 |
| -def get_decimal_symbol(locale=...): ... |
29 |
| -def get_plus_sign_symbol(locale=...): ... |
30 |
| -def get_minus_sign_symbol(locale=...): ... |
31 |
| -def get_exponential_symbol(locale=...): ... |
32 |
| -def get_group_symbol(locale=...): ... |
33 |
| -def format_number(number, locale=...): ... |
34 |
| -def get_decimal_precision(number): ... |
35 |
| -def get_decimal_quantum(precision): ... |
| 30 | +) -> list[str]: ... |
| 31 | +def get_decimal_symbol(locale: Locale | str | None = ...) -> str: ... |
| 32 | +def get_plus_sign_symbol(locale: Locale | str | None = ...) -> str: ... |
| 33 | +def get_minus_sign_symbol(locale: Locale | str | None = ...) -> str: ... |
| 34 | +def get_exponential_symbol(locale: Locale | str | None = ...) -> str: ... |
| 35 | +def get_group_symbol(locale: Locale | str | None = ...) -> str: ... |
| 36 | +def format_number(number: float | decimal.Decimal, locale: Locale | str | None = ...) -> str: ... |
| 37 | +def get_decimal_precision(number: decimal.Decimal) -> int: ... |
| 38 | +def get_decimal_quantum(precision: int | decimal.Decimal) -> decimal.Decimal: ... |
36 | 39 | def format_decimal(
|
37 |
| - number, format: Any | None = ..., locale=..., decimal_quantization: bool = ..., group_separator: bool = ... |
| 40 | + number: float | decimal.Decimal, |
| 41 | + format: str | None = ..., |
| 42 | + locale: Locale | str | None = ..., |
| 43 | + decimal_quantization: bool = ..., |
| 44 | + group_separator: bool = ..., |
38 | 45 | ): ...
|
39 | 46 | def format_compact_decimal(
|
40 |
| - number: float, *, format_type: str = ..., locale: Locale | str | None = ..., fraction_digits: int = ... |
| 47 | + number: float, *, format_type: Literal["short", "long"] = ..., locale: Locale | str | None = ..., fraction_digits: int = ... |
41 | 48 | ) -> str: ...
|
42 | 49 |
|
43 | 50 | class UnknownCurrencyFormatError(KeyError): ...
|
44 | 51 |
|
45 | 52 | def format_currency(
|
46 |
| - number, |
47 |
| - currency, |
48 |
| - format: Any | None = ..., |
49 |
| - locale=..., |
| 53 | + number: float | decimal.Decimal, |
| 54 | + currency: str, |
| 55 | + format: str | None = ..., |
| 56 | + locale: Locale | str | None = ..., |
50 | 57 | currency_digits: bool = ...,
|
51 |
| - format_type: str = ..., |
| 58 | + format_type: Literal["name", "standard", "accounting"] = ..., |
52 | 59 | decimal_quantization: bool = ...,
|
53 | 60 | group_separator: bool = ...,
|
54 |
| -): ... |
| 61 | +) -> str: ... |
55 | 62 | def format_percent(
|
56 |
| - number, format: Any | None = ..., locale=..., decimal_quantization: bool = ..., group_separator: bool = ... |
57 |
| -): ... |
58 |
| -def format_scientific(number, format: Any | None = ..., locale=..., decimal_quantization: bool = ...): ... |
| 63 | + number: float | decimal.Decimal, |
| 64 | + format: str | None = ..., |
| 65 | + locale: Locale | str | None = ..., |
| 66 | + decimal_quantization: bool = ..., |
| 67 | + group_separator: bool = ..., |
| 68 | +) -> str: ... |
| 69 | +def format_scientific( |
| 70 | + number: float | decimal.Decimal, format: str | None = ..., locale: Locale | str | None = ..., decimal_quantization: bool = ... |
| 71 | +) -> str: ... |
59 | 72 |
|
60 | 73 | class NumberFormatError(ValueError):
|
61 |
| - suggestions: Any |
62 |
| - def __init__(self, message, suggestions: Any | None = ...) -> None: ... |
| 74 | + suggestions: str | None |
| 75 | + def __init__(self, message: str, suggestions: str | None = ...) -> None: ... |
63 | 76 |
|
64 |
| -def parse_number(string, locale=...): ... |
65 |
| -def parse_decimal(string, locale=..., strict: bool = ...): ... |
| 77 | +def parse_number(string: str, locale: Locale | str | None = ...) -> int: ... |
| 78 | +def parse_decimal(string: str, locale: Locale | str | None = ..., strict: bool = ...) -> decimal.Decimal: ... |
66 | 79 |
|
67 | 80 | PREFIX_END: str
|
68 | 81 | NUMBER_TOKEN: str
|
69 |
| -PREFIX_PATTERN: Any |
70 |
| -NUMBER_PATTERN: Any |
| 82 | +PREFIX_PATTERN: str |
| 83 | +NUMBER_PATTERN: str |
71 | 84 | SUFFIX_PATTERN: str
|
72 |
| -number_re: Any |
| 85 | +number_re: Pattern[str] |
73 | 86 |
|
74 |
| -def parse_grouping(p): ... |
75 |
| -def parse_pattern(pattern): ... |
| 87 | +def parse_grouping(p: str) -> tuple[int, int]: ... |
| 88 | +def parse_pattern(pattern: NumberPattern | str) -> NumberPattern: ... |
76 | 89 |
|
77 | 90 | class NumberPattern:
|
78 |
| - pattern: Any |
79 |
| - prefix: Any |
80 |
| - suffix: Any |
81 |
| - grouping: Any |
82 |
| - int_prec: Any |
83 |
| - frac_prec: Any |
84 |
| - exp_prec: Any |
85 |
| - exp_plus: Any |
86 |
| - scale: Any |
87 |
| - def __init__(self, pattern, prefix, suffix, grouping, int_prec, frac_prec, exp_prec, exp_plus) -> None: ... |
88 |
| - def compute_scale(self): ... |
89 |
| - def scientific_notation_elements(self, value, locale): ... |
| 91 | + pattern: str |
| 92 | + prefix: tuple[str, str] |
| 93 | + suffix: tuple[str, str] |
| 94 | + grouping: tuple[int, int] |
| 95 | + int_prec: tuple[int, int] |
| 96 | + frac_prec: tuple[int, int] |
| 97 | + exp_prec: tuple[int, int] | None |
| 98 | + exp_plus: bool | None |
| 99 | + scale: Literal[0, 2, 3] |
| 100 | + def __init__( |
| 101 | + self, |
| 102 | + pattern: str, |
| 103 | + prefix: tuple[str, str], |
| 104 | + suffix: tuple[str, str], |
| 105 | + grouping: tuple[int, int], |
| 106 | + int_prec: tuple[int, int], |
| 107 | + frac_prec: tuple[int, int], |
| 108 | + exp_prec: tuple[int, int] | None, |
| 109 | + exp_plus: bool | None, |
| 110 | + ) -> None: ... |
| 111 | + def compute_scale(self) -> Literal[0, 2, 3]: ... |
| 112 | + def scientific_notation_elements( |
| 113 | + self, value: decimal.Decimal, locale: Locale | str | None |
| 114 | + ) -> tuple[decimal.Decimal, int, str]: ... |
90 | 115 | def apply(
|
91 | 116 | self,
|
92 |
| - value, |
93 |
| - locale, |
94 |
| - currency: Any | None = ..., |
| 117 | + value: float | decimal.Decimal, |
| 118 | + locale: Locale | str | None, |
| 119 | + currency: str | None = ..., |
95 | 120 | currency_digits: bool = ...,
|
96 | 121 | decimal_quantization: bool = ...,
|
97 |
| - force_frac: Any | None = ..., |
| 122 | + force_frac: int | None = ..., |
98 | 123 | group_separator: bool = ...,
|
99 |
| - ): ... |
| 124 | + ) -> str: ... |
0 commit comments