From f10b5fb9b6fe4159362d3ee514ab367c6213c401 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 7 Jun 2023 21:41:07 +0300 Subject: [PATCH] Update locale.pyi for Python3.12 (#10274) --- stdlib/locale.pyi | 11 +++++++++-- tests/stubtest_allowlists/py312.txt | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index c6cc7cacf..3753700ea 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -15,7 +15,6 @@ __all__ = [ "str", "atof", "atoi", - "format", "format_string", "currency", "normalize", @@ -32,6 +31,9 @@ __all__ = [ if sys.version_info >= (3, 11): __all__ += ["getencoding"] +if sys.version_info < (3, 12): + __all__ += ["format"] + # This module defines a function "str()", which is why "str" can't be used # as a type annotation or type alias. from builtins import str as _str @@ -123,7 +125,12 @@ def normalize(localename: _str) -> _str: ... def resetlocale(category: int = ...) -> None: ... def strcoll(__os1: _str, __os2: _str) -> int: ... def strxfrm(__string: _str) -> _str: ... -def format(percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any) -> _str: ... + +if sys.version_info < (3, 12): + def format( + percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any + ) -> _str: ... + def format_string(f: _str, val: Any, grouping: bool = False, monetary: bool = False) -> _str: ... def currency(val: float | Decimal, symbol: bool = True, grouping: bool = False, international: bool = False) -> _str: ... def delocalize(string: _str) -> _str: ... diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index 03c8cd9d7..4429ba53f 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -78,7 +78,6 @@ inspect.__all__ inspect.getasyncgenlocals inspect.getasyncgenstate inspect.markcoroutinefunction -locale.format logging.Logger.getChildren logging.__all__ logging.getHandlerByName