Skip to content

Commit

Permalink
Apply ruff autofixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Nov 28, 2023
1 parent 0509ae4 commit 648bddb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions babel/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _get_numbering_system(locale: Locale, numbering_system: Literal["default"] |
def _get_number_symbols(
locale: Locale | str,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> LocaleDataDict:
parsed_locale = Locale.parse(locale)
numbering_system = _get_numbering_system(parsed_locale, numbering_system)
Expand Down Expand Up @@ -798,7 +798,7 @@ def _format_currency_long_name(
decimal_quantization: bool = True,
group_separator: bool = True,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> str:
# Algorithm described here:
# https://www.unicode.org/reports/tr35/tr35-numbers.html#Currencies
Expand Down Expand Up @@ -889,7 +889,7 @@ def format_percent(
decimal_quantization: bool = True,
group_separator: bool = True,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> str:
"""Return formatted percent value for a specific locale.
Expand Down Expand Up @@ -939,7 +939,7 @@ def format_percent(
pattern = parse_pattern(format)
return pattern.apply(
number, locale, decimal_quantization=decimal_quantization, group_separator=group_separator,
numbering_system=numbering_system
numbering_system=numbering_system,
)


Expand All @@ -949,7 +949,7 @@ def format_scientific(
locale: Locale | str | None = LC_NUMERIC,
decimal_quantization: bool = True,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> str:
"""Return value formatted in scientific notation for a specific locale.
Expand Down Expand Up @@ -1114,7 +1114,7 @@ def parse_decimal(
parsed_alt,
locale=locale,
decimal_quantization=False,
numbering_system=numbering_system
numbering_system=numbering_system,
)
if proper_alt == proper:
raise NumberFormatError(
Expand Down Expand Up @@ -1275,7 +1275,7 @@ def scientific_notation_elements(
self,
value: decimal.Decimal,
locale: Locale | str | None,
numbering_system: str
numbering_system: str,
) -> tuple[decimal.Decimal, int, str]:
""" Returns normalized scientific notation components of a value.
"""
Expand Down Expand Up @@ -1313,7 +1313,7 @@ def apply(
force_frac: tuple[int, int] | None = None,
group_separator: bool = True,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
):
"""Renders into a string a number following the defined pattern.
Expand Down
6 changes: 3 additions & 3 deletions babel/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def format_unit(
format: str | None = None,
locale: Locale | str | None = LC_NUMERIC,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> str:
"""Format a value of a given unit.
Expand Down Expand Up @@ -219,7 +219,7 @@ def format_compound_unit(
format: str | None = None,
locale: Locale | str | None = LC_NUMERIC,
*,
numbering_system: Literal["default"] | str = "latn"
numbering_system: Literal["default"] | str = "latn",
) -> str | None:
"""
Format a compound number value, i.e. "kilometers per hour" or similar.
Expand Down Expand Up @@ -334,7 +334,7 @@ def format_compound_unit(
denominator_value,
format=format,
locale=locale,
numbering_system=numbering_system
numbering_system=numbering_system,
)

# TODO: this doesn't support "compound_variations" (or "prefix"), and will fall back to the "x/y" representation
Expand Down
4 changes: 2 additions & 2 deletions tests/test_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ def test_compact(self):
assert numbers.format_compact_decimal(1000, locale='fr', format_type='long') == 'mille'
assert numbers.format_compact_decimal(1234, locale='fr', format_type='long') == '1 millier'
assert numbers.format_compact_decimal(
12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='default'
12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='default',
) == '12٫34\xa0ألف'
assert numbers.format_compact_decimal(
12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='latn'
12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='latn',
) == '12.34\xa0ألف'


Expand Down

0 comments on commit 648bddb

Please sign in to comment.