From 4de4cd04288a8559104f85f378635e5d485a3885 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sun, 22 Mar 2020 08:53:32 -0700 Subject: [PATCH] locale: various improvements (#3860) - fix delocalize return type - fix arg names - add missing args --- stdlib/2and3/locale.pyi | 16 ++++++++-------- tests/stubtest_whitelists/py3_common.txt | 4 ---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/stdlib/2and3/locale.pyi b/stdlib/2and3/locale.pyi index a0d7383ad..c4703f7f0 100644 --- a/stdlib/2and3/locale.pyi +++ b/stdlib/2and3/locale.pyi @@ -1,7 +1,7 @@ # Stubs for locale from decimal import Decimal -from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union import sys # workaround for mypy#2010 @@ -92,21 +92,21 @@ def normalize(localename: _str) -> _str: ... def resetlocale(category: int = ...) -> None: ... def strcoll(string1: _str, string2: _str) -> int: ... def strxfrm(string: _str) -> _str: ... -def format(format: _str, val: Union[float, Decimal], grouping: bool = ..., - monetary: bool = ...) -> _str: ... +def format(percent: _str, value: Union[float, Decimal], grouping: bool = ..., + monetary: bool = ..., *additional: Any) -> _str: ... if sys.version_info >= (3, 7): - def format_string(format: _str, val: Any, + def format_string(f: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ... else: - def format_string(format: _str, val: Any, + def format_string(f: _str, val: Any, grouping: bool = ...) -> _str: ... def currency(val: Union[int, float, Decimal], symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... if sys.version_info >= (3, 5): - def delocalize(string: _str) -> None: ... -def atof(string: _str) -> float: ... + def delocalize(string: _str) -> _str: ... +def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... def atoi(string: _str) -> int: ... -def str(float: float) -> _str: ... +def str(val: float) -> _str: ... locale_alias: Dict[_str, _str] # undocumented locale_encoding_alias: Dict[_str, _str] # undocumented diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index d6fafc928..33521f5c9 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -471,10 +471,6 @@ lib2to3.pytree.Base.type lib2to3.pytree.BasePattern.type lib2to3.pytree.NegatedPattern.match lib2to3.pytree.NegatedPattern.match_seq -locale.atof -locale.format -locale.format_string -locale.str logging.Formatter.formatException logging.Handler.addFilter logging.Handler.removeFilter