"""Utility classes for command line functionality."""__author__='Paul Landes'importsys
[docs]classDocUtil(object):"""A utility class to format API documentation parsed from the class. """
[docs]@staticmethoddefnormalize(text:str)->str:"""Lower case and remove punctuation."""doc=text.lower()ifdoc[-1]=='.':doc=doc[0:-1]returndoc
[docs]@staticmethoddefunnormalize(text:str)->str:"""Return a normalized doc string back to a (more) typical English syntax. """returntext[0].upper()+text[1:]+'.'
[docs]@classmethoddefmodule_name(cls)->str:"""Return the ``config`` (parent) module name."""ifnothasattr(cls,'_mod_name')isNone:mname=sys.modules[__name__].__name__parts=mname.split('.')iflen(parts)>1:mname='.'.join(parts[:-1])cls._mod_name=mnamereturncls._mod_name