Issue #11297: Add collections.ChainMap()
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 4317535..aab5aee 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -636,7 +636,7 @@
### 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 4e3af5f..15fc266 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -120,7 +120,7 @@
"""
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 2bc5d00..d4f9cd9 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -46,7 +46,7 @@
####################################################################
import re as _re
-from collections import _ChainMap
+from collections import ChainMap
class _TemplateMetaclass(type):
pattern = r"""
@@ -100,7 +100,7 @@
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 @@
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 35fe5ff..5c73d78 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -11,7 +11,7 @@
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 @@
################################################################################
-### _ChainMap (helper class for configparser and the string module)
+### ChainMap (helper class for configparser and the string module)
################################################################################
class TestChainMap(unittest.TestCase):