summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-02-26 01:02:51 +0000
committerRaymond Hettinger <python@rcn.com>2011-02-26 01:02:51 +0000
commit2886808d3809d69a6e9b360380080140b95df0b6 (patch)
tree9a754243a225f90ba686563dcc264b55ab7aa226 /Lib
parent0bb02cce6a0b0a0097edbdf892ad384ba1c66978 (diff)
downloadcpython-2886808d3809d69a6e9b360380080140b95df0b6.tar.gz
Issue #11297: Add collections.ChainMap()
Diffstat (limited to 'Lib')
-rw-r--r--Lib/collections/__init__.py2
-rw-r--r--Lib/configparser.py2
-rw-r--r--Lib/string.py6
-rw-r--r--Lib/test/test_collections.py4
4 files changed, 7 insertions, 7 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 4317535e87..aab5aeece0 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -636,7 +636,7 @@ class Counter(dict):
### ChainMap (helper for configparser and string.Template)
########################################################################
-class _ChainMap(MutableMapping):
+class ChainMap(MutableMapping):
''' A ChainMap groups multiple dicts (or other mappings) together
to create a single, updateable view.
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 4e3af5f43e..15fc26677e 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -120,7 +120,7 @@ ConfigParser -- responsible for parsing a list of
"""
from collections.abc import MutableMapping
-from collections import OrderedDict as _default_dict, _ChainMap
+from collections import OrderedDict as _default_dict, ChainMap as _ChainMap
import functools
import io
import itertools
diff --git a/Lib/string.py b/Lib/string.py
index 2bc5d00803..d4f9cd9355 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -46,7 +46,7 @@ def capwords(s, sep=None):
####################################################################
import re as _re
-from collections import _ChainMap
+from collections import ChainMap
class _TemplateMetaclass(type):
pattern = r"""
@@ -100,7 +100,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()
@@ -126,7 +126,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()
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 35fe5ff19d..5c73d7816b 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -11,7 +11,7 @@ import keyword
import re
import sys
from collections import UserDict
-from collections import _ChainMap as ChainMap
+from collections import ChainMap
from collections.abc import Hashable, Iterable, Iterator
from collections.abc import Sized, Container, Callable
from collections.abc import Set, MutableSet
@@ -21,7 +21,7 @@ from collections.abc import ByteString
################################################################################
-### _ChainMap (helper class for configparser and the string module)
+### ChainMap (helper class for configparser and the string module)
################################################################################
class TestChainMap(unittest.TestCase):