mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Closes #26809: Merge with 3.5
This commit is contained in:
commit
8bc9378c98
2 changed files with 9 additions and 3 deletions
|
@ -14,6 +14,10 @@ printable -- a string containing all ASCII characters considered printable
|
|||
|
||||
"""
|
||||
|
||||
__all__ = ["ascii_letters", "ascii_lowercase", "ascii_uppercase", "capwords",
|
||||
"digits", "hexdigits", "octdigits", "printable", "punctuation",
|
||||
"whitespace", "Formatter", "Template"]
|
||||
|
||||
import _string
|
||||
|
||||
# Some strings for ctype-style character classification
|
||||
|
@ -46,7 +50,7 @@ def capwords(s, sep=None):
|
|||
|
||||
####################################################################
|
||||
import re as _re
|
||||
from collections import ChainMap
|
||||
from collections import ChainMap as _ChainMap
|
||||
|
||||
class _TemplateMetaclass(type):
|
||||
pattern = r"""
|
||||
|
@ -104,7 +108,7 @@ class Template(metaclass=_TemplateMetaclass):
|
|||
if not args:
|
||||
mapping = kws
|
||||
elif kws:
|
||||
mapping = ChainMap(kws, args[0])
|
||||
mapping = _ChainMap(kws, args[0])
|
||||
else:
|
||||
mapping = args[0]
|
||||
# Helper function for .sub()
|
||||
|
@ -131,7 +135,7 @@ class Template(metaclass=_TemplateMetaclass):
|
|||
if not args:
|
||||
mapping = kws
|
||||
elif kws:
|
||||
mapping = ChainMap(kws, args[0])
|
||||
mapping = _ChainMap(kws, args[0])
|
||||
else:
|
||||
mapping = args[0]
|
||||
# Helper function for .sub()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue