(self, rootTopic: Union[str, Topic] = None, fileObj: TextIO = None, width: int = 70,
                 indentStep: int = 4,
                 treeDoc: str = defaultTopicTreeSpecHeader, footer: str = defaultTopicTreeSpecFooter)
For formatting, can specify the width of output, the indent step, the
        header and footer to print to override defaults. The destination is fileObj;
        if none is given, then sys.stdout is used. If rootTopic is given, calls
        writeAll(rootTopic) at end of __init__.
For formatting, can specify the width of output, the indent step, the
        header and footer to print to override defaults. The destination is fileObj;
        if none is given, then sys.stdout is used. If rootTopic is given, calls
        writeAll(rootTopic) at end of __init__.
For formatting can specify the width of output the indent step the header and footer to print to override defaults . The destination is fileObj ; if none is given then sys . stdout is used . If rootTopic is given calls writeAll ( rootTopic ) at end of __init__ .
def __init__(self, rootTopic: Union[str, Topic] = None, fileObj: TextIO = None, width: int = 70,
                 indentStep: int = 4,
                 treeDoc: str = defaultTopicTreeSpecHeader, footer: str = defaultTopicTreeSpecFooter):
        """
        For formatting, can specify the width of output, the indent step, the
        header and footer to print to override defaults. The destination is fileObj;
        if none is given, then sys.stdout is used. If rootTopic is given, calls
        writeAll(rootTopic) at end of __init__.
        """
        self.__traverser = TopicTreeTraverser(self)

        import sys
        fileObj = fileObj or sys.stdout

        self.__destination = fileObj
        self.__output = []
        self.__header = self.__toDocString(treeDoc)
        self.__footer = dedent(footer)
        self.__lastWasAll = False  # True when last topic done was the ALL_TOPICS

        self.__width = width
        self.__wrapper = TextWrapper(width)
        self.__indentStep = indentStep
        self.__indent = 0

        args = dict(width=width, indentStep=indentStep, treeDoc=treeDoc,
                    footer=self.__footer, fileObj=fileObj)

        def fmItem(argName, argVal):
            if isinstance(argVal, str):
                MIN_OFFSET = 5
                lenAV = width - MIN_OFFSET - len(argName)
                if lenAV > 0:
                    argVal = repr(argVal[:lenAV] + '...')
            elif argName == 'fileObj':
                argVal = fileObj.__class__.__name__
            return '# - %s: %s' % (argName, argVal)

        fmtArgs = [fmItem(key, args[key]) for key in sorted(args.keys())]
        self.__comment = [
            '# Automatically generated by %s(**kwargs).' % self.__class__.__name__,
            '# The kwargs were:',
        ]
        self.__comment.extend(fmtArgs)
        self.__comment.extend([''])  # two empty line after comment

        if rootTopic is not None:
            self.writeAll(rootTopic)
def __init__ ( self , rootTopic : Union [ str , Topic ] = None , fileObj : TextIO = None , width : int = 70 , indentStep : int = 4 , treeDoc : str = defaultTopicTreeSpecHeader , footer : str = defaultTopicTreeSpecFooter ) : self . __traverser = TopicTreeTraverser ( self ) import sys fileObj = fileObj or sys . stdout self . __destination = fileObj self . __output = [ ] self . __header = self . __toDocString ( treeDoc ) self . __footer = dedent ( footer ) self . __lastWasAll = False # True when last topic done was the ALL_TOPICS self . __width = width self . __wrapper = TextWrapper ( width ) self . __indentStep = indentStep self . __indent = 0 args = dict ( width = width , indentStep = indentStep , treeDoc = treeDoc , footer = self . __footer , fileObj = fileObj ) def fmItem ( argName , argVal ) : if isinstance ( argVal , str ) : MIN_OFFSET = 5 lenAV = width - MIN_OFFSET - len ( argName ) if lenAV > 0 : argVal = repr ( argVal [ : lenAV ] + '...' ) elif argName == 'fileObj' : argVal = fileObj . __class__ . __name__ return '# - %s: %s' % ( argName , argVal ) fmtArgs = [ fmItem ( key , args [ key ] ) for key in sorted ( args . keys ( ) ) ] self . __comment = [ '# Automatically generated by %s(**kwargs).' % self . __class__ . __name__ , '# The kwargs were:' , ] self . __comment . extend ( fmtArgs ) self . __comment . extend ( [ '' ] ) # two empty line after comment if rootTopic is not None : self . writeAll ( rootTopic )