File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 66"""
77
88import functools
9+ import string
910import textwrap
1011import warnings
1112from inspect import Parameter , signature
@@ -442,6 +443,13 @@ def fmt_docstring(module_func):
442443 <BLANKLINE>
443444 """ # noqa: D410,D411
444445
446+ class _MyTemplate (string .Template ):
447+ """
448+ A Template subclass that allows missing placeholders in docstrings.
449+ """
450+
451+ delimiter = ""
452+
445453 class _Placeholder (dict ):
446454 """
447455 A dict subclass that allows missing placeholders in docstrings.
@@ -455,8 +463,7 @@ def __missing__(self, key):
455463 """
456464 return "{" + key + "}"
457465
458- filler_text = _Placeholder ()
459-
466+ filler_text = {}
460467 if hasattr (module_func , "aliases" ):
461468 aliases = ["**Aliases:**\n " ]
462469 aliases .append (".. hlist::" )
@@ -481,7 +488,7 @@ def __missing__(self, key):
481488 # Dedent the docstring to make it all match the option text.
482489 docstring = textwrap .dedent (module_func .__doc__ )
483490
484- module_func .__doc__ = docstring . format_map ( filler_text )
491+ module_func .__doc__ = _MyTemplate ( docstring ). safe_substitute ( ** filler_text )
485492 return module_func
486493
487494
You can’t perform that action at this time.
0 commit comments