diff options
author | Victor Stinner <vstinner@python.org> | 2022-06-26 10:41:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 10:41:19 (GMT) |
commit | cc0d5e568e1cd02ed71ade46e77789b3b2674871 (patch) | |
tree | 7207b5383611a2ab4ef55c67fb2a5f023ad3f458 /Lib/locale.py | |
parent | 44c8e68b8cae2627ffe54a2ef407af0271981ed3 (diff) | |
download | cpython-cc0d5e568e1cd02ed71ade46e77789b3b2674871.zip cpython-cc0d5e568e1cd02ed71ade46e77789b3b2674871.tar.gz cpython-cc0d5e568e1cd02ed71ade46e77789b3b2674871.tar.bz2 |
gh-94226: Remove the locale.format() function (#94229)
Remove the locale.format() function, deprecated in Python
3.7: use locale.format_string() instead.
Remove TestFormatPatternArg test case: it is irrelevant for
locale.format_string() which accepts complex formats.
Diffstat (limited to 'Lib/locale.py')
-rw-r--r-- | Lib/locale.py | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index 7a7694e..c2c7a04 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -26,7 +26,7 @@ import functools # trying the import. So __all__ is also fiddled at the end of the file. __all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm", - "str", "atof", "atoi", "format", "format_string", "currency", + "str", "atof", "atoi", "format_string", "currency", "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", "LC_NUMERIC", "LC_ALL", "CHAR_MAX", "getencoding"] @@ -247,21 +247,6 @@ def format_string(f, val, grouping=False, monetary=False): return new_f % val -def format(percent, value, grouping=False, monetary=False, *additional): - """Deprecated, use format_string instead.""" - import warnings - warnings.warn( - "This method will be removed in a future version of Python. " - "Use 'locale.format_string()' instead.", - DeprecationWarning, stacklevel=2 - ) - - match = _percent_re.match(percent) - if not match or len(match.group())!= len(percent): - raise ValueError(("format() must be given exactly one %%char " - "format specifier, %s not valid") % repr(percent)) - return _format(percent, value, grouping, monetary, *additional) - def currency(val, symbol=True, grouping=False, international=False): """Formats val according to the currency settings in the current locale.""" |