diff --git a/pyproject.toml b/pyproject.toml index a6c418621..346619c2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ extra_standard_library = [ "_heapq", "_imp", "_json", + "_locale", "_markupbase", "_msi", "_operator", diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 7dcb0cfa7..2e95c659d 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -1,40 +1,4 @@ import sys -from collections.abc import Callable - -__all__ = [ - "getlocale", - "getdefaultlocale", - "getpreferredencoding", - "Error", - "setlocale", - "resetlocale", - "localeconv", - "strcoll", - "strxfrm", - "str", - "atof", - "atoi", - "format_string", - "currency", - "normalize", - "LC_CTYPE", - "LC_COLLATE", - "LC_TIME", - "LC_MONETARY", - "LC_NUMERIC", - "LC_ALL", - "CHAR_MAX", -] - -if sys.version_info >= (3, 11): - __all__ += ["getencoding"] - -if sys.version_info < (3, 12): - __all__ += ["format"] - -if sys.platform != "win32": - __all__ += ["LC_MESSAGES"] - from _locale import ( CHAR_MAX as CHAR_MAX, LC_ALL as LC_ALL, @@ -49,6 +13,13 @@ from _locale import ( strxfrm as strxfrm, ) +# 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 +from collections.abc import Callable +from decimal import Decimal +from typing import Any + if sys.version_info >= (3, 11): from _locale import getencoding as getencoding @@ -120,11 +91,39 @@ if sys.platform != "win32": textdomain as textdomain, ) -# 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 -from decimal import Decimal -from typing import Any +__all__ = [ + "getlocale", + "getdefaultlocale", + "getpreferredencoding", + "Error", + "setlocale", + "resetlocale", + "localeconv", + "strcoll", + "strxfrm", + "str", + "atof", + "atoi", + "format_string", + "currency", + "normalize", + "LC_CTYPE", + "LC_COLLATE", + "LC_TIME", + "LC_MONETARY", + "LC_NUMERIC", + "LC_ALL", + "CHAR_MAX", +] + +if sys.version_info >= (3, 11): + __all__ += ["getencoding"] + +if sys.version_info < (3, 12): + __all__ += ["format"] + +if sys.platform != "win32": + __all__ += ["LC_MESSAGES"] class Error(Exception): ...