From 2824cd119784e32720920091d9b2934d5714d83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rousset?= Date: Wed, 10 Aug 2016 22:52:29 +0200 Subject: [PATCH] Improve locale (#462) --- stdlib/2.7/_locale.pyi | 81 ------------ stdlib/2.7/locale.pyi | 33 ----- stdlib/{3/_locale.pyi => 2and3/locale.pyi} | 136 ++++++++++++--------- stdlib/3/locale.pyi | 17 --- 4 files changed, 77 insertions(+), 190 deletions(-) delete mode 100644 stdlib/2.7/_locale.pyi delete mode 100644 stdlib/2.7/locale.pyi rename stdlib/{3/_locale.pyi => 2and3/locale.pyi} (55%) delete mode 100644 stdlib/3/locale.pyi diff --git a/stdlib/2.7/_locale.pyi b/stdlib/2.7/_locale.pyi deleted file mode 100644 index 20584fc02..000000000 --- a/stdlib/2.7/_locale.pyi +++ /dev/null @@ -1,81 +0,0 @@ -from typing import Optional, Dict, Any - -ABDAY_1 = ... # type: int -ABDAY_2 = ... # type: int -ABDAY_3 = ... # type: int -ABDAY_4 = ... # type: int -ABDAY_5 = ... # type: int -ABDAY_6 = ... # type: int -ABDAY_7 = ... # type: int -ABMON_1 = ... # type: int -ABMON_10 = ... # type: int -ABMON_11 = ... # type: int -ABMON_12 = ... # type: int -ABMON_2 = ... # type: int -ABMON_3 = ... # type: int -ABMON_4 = ... # type: int -ABMON_5 = ... # type: int -ABMON_6 = ... # type: int -ABMON_7 = ... # type: int -ABMON_8 = ... # type: int -ABMON_9 = ... # type: int -ALT_DIGITS = ... # type: int -AM_STR = ... # type: int -CHAR_MAX = ... # type: int -CODESET = ... # type: int -CRNCYSTR = ... # type: int -DAY_1 = ... # type: int -DAY_2 = ... # type: int -DAY_3 = ... # type: int -DAY_4 = ... # type: int -DAY_5 = ... # type: int -DAY_6 = ... # type: int -DAY_7 = ... # type: int -D_FMT = ... # type: int -D_T_FMT = ... # type: int -ERA = ... # type: int -ERA_D_FMT = ... # type: int -ERA_D_T_FMT = ... # type: int -ERA_T_FMT = ... # type: int -LC_ALL = ... # type: int -LC_COLLATE = ... # type: int -LC_CTYPE = ... # type: int -LC_MESSAGES = ... # type: int -LC_MONETARY = ... # type: int -LC_NUMERIC = ... # type: int -LC_TIME = ... # type: int -MON_1 = ... # type: int -MON_10 = ... # type: int -MON_11 = ... # type: int -MON_12 = ... # type: int -MON_2 = ... # type: int -MON_3 = ... # type: int -MON_4 = ... # type: int -MON_5 = ... # type: int -MON_6 = ... # type: int -MON_7 = ... # type: int -MON_8 = ... # type: int -MON_9 = ... # type: int -NOEXPR = ... # type: int -PM_STR = ... # type: int -RADIXCHAR = ... # type: int -THOUSEP = ... # type: int -T_FMT = ... # type: int -T_FMT_AMPM = ... # type: int -YESEXPR = ... # type: int -_DATE_FMT = ... # type: int - -class Error(Exception): - pass - -def bind_textdomain_codeset(domain: Optional[str], codeset: Optional[str]) -> Optional[str]: pass -def bindtextdomain(domain: Optional[str], dir: Optional[str]) -> str: pass -def dcgettext(domain: Optional[str], msg: str, category: int) -> str: pass -def dgettext(domain: Optional[str], msg: str) -> str: pass -def gettext(msg: str) -> str: pass -def localeconv() -> Dict[str, Any]: pass -def nl_langinfo(key: int) -> str: pass -def setlocale(i: int, s: str) -> str: pass -def strcoll(left: str, right: str) -> int: pass -def strxfrm(s: str) -> str: pass -def textdomain(domain: Optional[str]) -> str: pass diff --git a/stdlib/2.7/locale.pyi b/stdlib/2.7/locale.pyi deleted file mode 100644 index b79617e64..000000000 --- a/stdlib/2.7/locale.pyi +++ /dev/null @@ -1,33 +0,0 @@ -# Stubs for locale (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any -from _locale import * - -class _unicode: ... - -CHAR_MAX = ... # type: Any -LC_ALL = ... # type: Any -LC_COLLATE = ... # type: Any -LC_CTYPE = ... # type: Any -LC_MESSAGES = ... # type: Any -LC_MONETARY = ... # type: Any -LC_NUMERIC = ... # type: Any -LC_TIME = ... # type: Any -Error = ... # type: Any - -def localeconv(): ... -def strcoll(a, b): ... -def strxfrm(s): ... -def format(percent, value, grouping=False, monetary=False, *additional): ... -def format_string(f, val, grouping=False): ... -def currency(val, symbol=True, grouping=False, international=False): ... -def str(val): ... -def atof(string, func=...): ... -def atoi(str): ... -def normalize(localename): ... -def getdefaultlocale(envvars=...): ... -def getlocale(category=...): ... -def resetlocale(category=...): ... -def getpreferredencoding(do_setlocale=True): ... diff --git a/stdlib/3/_locale.pyi b/stdlib/2and3/locale.pyi similarity index 55% rename from stdlib/3/_locale.pyi rename to stdlib/2and3/locale.pyi index beed6c936..7a7dac750 100644 --- a/stdlib/3/_locale.pyi +++ b/stdlib/2and3/locale.pyi @@ -1,33 +1,18 @@ -# Stubs for _locale (Python 3.4) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. +# Stubs for locale + +from typing import Any, Iterable, List, Mapping, Optional, Sequence, Tuple, Union +import sys +import builtins + +_str = builtins.str # TODO workaround for mypy#2010 -from typing import Iterable -ABDAY_1 = ... # type: int -ABDAY_2 = ... # type: int -ABDAY_3 = ... # type: int -ABDAY_4 = ... # type: int -ABDAY_5 = ... # type: int -ABDAY_6 = ... # type: int -ABDAY_7 = ... # type: int -ABMON_1 = ... # type: int -ABMON_10 = ... # type: int -ABMON_11 = ... # type: int -ABMON_12 = ... # type: int -ABMON_2 = ... # type: int -ABMON_3 = ... # type: int -ABMON_4 = ... # type: int -ABMON_5 = ... # type: int -ABMON_6 = ... # type: int -ABMON_7 = ... # type: int -ABMON_8 = ... # type: int -ABMON_9 = ... # type: int -ALT_DIGITS = ... # type: int -AM_STR = ... # type: int -CHAR_MAX = ... # type: int CODESET = ... # type: int -CRNCYSTR = ... # type: int +D_T_FMT = ... # type: int +D_FMT = ... # type: int +T_FMT = ... # type: int +T_FMT_AMPM = ... # type: int + DAY_1 = ... # type: int DAY_2 = ... # type: int DAY_3 = ... # type: int @@ -35,23 +20,15 @@ DAY_4 = ... # type: int DAY_5 = ... # type: int DAY_6 = ... # type: int DAY_7 = ... # type: int -D_FMT = ... # type: int -D_T_FMT = ... # type: int -ERA = ... # type: int -ERA_D_FMT = ... # type: int -ERA_D_T_FMT = ... # type: int -ERA_T_FMT = ... # type: int -LC_ALL = ... # type: int -LC_COLLATE = ... # type: int -LC_CTYPE = ... # type: int -LC_MESSAGES = ... # type: int -LC_MONETARY = ... # type: int -LC_NUMERIC = ... # type: int -LC_TIME = ... # type: int +ABDAY_1 = ... # type: int +ABDAY_2 = ... # type: int +ABDAY_3 = ... # type: int +ABDAY_4 = ... # type: int +ABDAY_5 = ... # type: int +ABDAY_6 = ... # type: int +ABDAY_7 = ... # type: int + MON_1 = ... # type: int -MON_10 = ... # type: int -MON_11 = ... # type: int -MON_12 = ... # type: int MON_2 = ... # type: int MON_3 = ... # type: int MON_4 = ... # type: int @@ -60,25 +37,66 @@ MON_6 = ... # type: int MON_7 = ... # type: int MON_8 = ... # type: int MON_9 = ... # type: int -NOEXPR = ... # type: int -PM_STR = ... # type: int +MON_10 = ... # type: int +MON_11 = ... # type: int +MON_12 = ... # type: int +ABMON_1 = ... # type: int +ABMON_2 = ... # type: int +ABMON_3 = ... # type: int +ABMON_4 = ... # type: int +ABMON_5 = ... # type: int +ABMON_6 = ... # type: int +ABMON_7 = ... # type: int +ABMON_8 = ... # type: int +ABMON_9 = ... # type: int +ABMON_10 = ... # type: int +ABMON_11 = ... # type: int +ABMON_12 = ... # type: int + RADIXCHAR = ... # type: int THOUSEP = ... # type: int -T_FMT = ... # type: int -T_FMT_AMPM = ... # type: int YESEXPR = ... # type: int -_DATE_FMT = ... # type: int +NOEXPR = ... # type: int +CRNCYSTR = ... # type: int -def bind_textdomain_codeset(domain, codeset): ... -def bindtextdomain(domain, dir): ... -def dcgettext(domain, msg, category): ... -def dgettext(domain, msg): ... -def gettext(msg): ... -def localeconv(): ... -def nl_langinfo(key): ... -def setlocale(category: int, locale: Iterable[str] = ...) -> str: ... -def strcoll(string1, string2) -> int: ... -def strxfrm(string): ... -def textdomain(domain): ... +ERA = ... # type: int +ERA_D_T_FMT = ... # type: int +ERA_D_FMT = ... # type: int +ERA_T_FMT = ... # type: int + +ALT_DIGITS = ... # type: int + +LC_CTYPE = ... # type: int +LC_COLLATE = ... # type: int +LC_TIME = ... # type: int +LC_MONETARY = ... # type: int +LC_MESSAGES = ... # type: int +LC_NUMERIC = ... # type: int +LC_ALL = ... # type: int + +CHAR_MAX = ... # type: int class Error(Exception): ... + +def setlocale(category: int, + locale: Union[_str, Iterable[_str], None] = ...) -> _str: ... +def localeconv() -> Mapping[_str, Union[int, _str, List[int]]]: ... +def nl_langinfo(option: int) -> _str: ... +def getdefaultlocale(envvars: Tuple[_str] = ...) -> Tuple[Optional[_str], Optional[_str]]: ... +def getlocale(category: int = ...) -> Sequence[_str]: ... +def getpreferredencoding(do_setlocale: bool = ...) -> _str: ... +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: int, grouping: bool = ..., + monetary: bool = ...) -> _str: ... +def format_string(format: _str, val: Sequence[Any], + grouping: bool = ...) -> _str: ... +def currency(val: int, symbol: bool = ..., grouping: bool = ..., + international: bool = ...) -> _str: ... +def str(float: float) -> _str: ... +if sys.version_info >= (3, 5): + def delocalize(string: _str) -> None: ... +def atof(string: _str) -> float: ... +def atoi(string: _str) -> int: ... diff --git a/stdlib/3/locale.pyi b/stdlib/3/locale.pyi deleted file mode 100644 index a76d137af..000000000 --- a/stdlib/3/locale.pyi +++ /dev/null @@ -1,17 +0,0 @@ -# Stubs for locale (Python 3.4) -# -# NOTE: This stub is based on a stub automatically generated by stubgen. - -from _locale import * - -def format(percent, value, grouping=..., monetary=..., *additional): ... -def format_string(f, val, grouping=...): ... -def currency(val, symbol=..., grouping=..., international=...): ... -def str(val): ... -def atof(string, func=...): ... -def atoi(str): ... -def normalize(localename): ... -def getdefaultlocale(envvars=...): ... -def getlocale(category=...): ... -def resetlocale(category=...): ... -def getpreferredencoding(do_setlocale=...): ...