]> granicus.if.org Git - python/commitdiff
Issue #26809: Add __all__ to string module. Patch by Emanuel Barry
authorZachary Ware <zachary.ware@gmail.com>
Sat, 4 Jun 2016 19:35:05 +0000 (14:35 -0500)
committerZachary Ware <zachary.ware@gmail.com>
Sat, 4 Jun 2016 19:35:05 +0000 (14:35 -0500)
Lib/string.py
Misc/NEWS

index 62e8f2f059b4ac1f86b71dc843bd9fa79c2f2e8f..89287c4c0adecb5781b50b13b4a0127d81e725b0 100644 (file)
@@ -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()
@@ -134,7 +138,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()
index f51918bf89f1c07a7f0729930cfe4b8fac1457e2..64fefad6751256f3fa208fea5df7b5cfa24dd10e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -131,6 +131,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #26809: Add ``__all__`` to :mod:`string`.  Patch by Emanuel Barry.
+
 - Issue #26373: subprocess.Popen.communicate now correctly ignores
   BrokenPipeError when the child process dies before .communicate()
   is called in more/all circumstances.