locale: put all the imports together at the top (#10860)

This commit is contained in:
Alex Waygood
2023-10-08 14:18:27 +02:00
committed by GitHub
parent a042be6b17
commit c47be697a3
2 changed files with 41 additions and 41 deletions

View File

@@ -32,6 +32,7 @@ extra_standard_library = [
"_heapq",
"_imp",
"_json",
"_locale",
"_markupbase",
"_msi",
"_operator",

View File

@@ -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): ...