summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-09-25 21:55:55 (GMT)
committerGitHub <noreply@github.com>2017-09-25 21:55:55 (GMT)
commit81108375d9b2ccd0add1572da745311d4dfac505 (patch)
tree54632e1d6ec58850f70941452634c4faf1ea7218 /Lib/locale.py
parentf1502d097c29b266a5748312ee2451a2d6ac0af6 (diff)
downloadcpython-81108375d9b2ccd0add1572da745311d4dfac505.zip
cpython-81108375d9b2ccd0add1572da745311d4dfac505.tar.gz
cpython-81108375d9b2ccd0add1572da745311d4dfac505.tar.bz2
bpo-30152: Reduce the number of imports for argparse. (#1269)
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index 569fe85..f1d157d 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -14,10 +14,9 @@ import sys
import encodings
import encodings.aliases
import re
-import collections.abc
+import _collections_abc
from builtins import str as _builtin_str
import functools
-import warnings
# Try importing the _locale module.
#
@@ -215,7 +214,7 @@ def format_string(f, val, grouping=False, monetary=False):
percents = list(_percent_re.finditer(f))
new_f = _percent_re.sub('%s', f)
- if isinstance(val, collections.abc.Mapping):
+ if isinstance(val, _collections_abc.Mapping):
new_val = []
for perc in percents:
if perc.group()[-1]=='%':
@@ -244,6 +243,7 @@ def format_string(f, val, grouping=False, monetary=False):
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.",