diff options
author | Raymond Hettinger <python@rcn.com> | 2011-02-26 01:02:51 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-02-26 01:02:51 (GMT) |
commit | 9fe1ccfb5ac8c38be1439151712d3a8b3e7d87f2 (patch) | |
tree | edf92add219a4a427b21157a626f1c0520fd644f /Lib | |
parent | 692f038a5dad826254fe73050063862d76dc7baa (diff) | |
download | cpython-9fe1ccfb5ac8c38be1439151712d3a8b3e7d87f2.zip cpython-9fe1ccfb5ac8c38be1439151712d3a8b3e7d87f2.tar.gz cpython-9fe1ccfb5ac8c38be1439151712d3a8b3e7d87f2.tar.bz2 |
Issue #11297: Add collections.ChainMap()
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections/__init__.py | 2 | ||||
-rw-r--r-- | Lib/configparser.py | 2 | ||||
-rw-r--r-- | Lib/string.py | 6 | ||||
-rw-r--r-- | Lib/test/test_collections.py | 4 |
4 files changed, 7 insertions, 7 deletions
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 @@ 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 4e3af5f..15fc266 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 2bc5d00..d4f9cd9 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 35fe5ff..5c73d78 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): |