typedargs/doc_parser.py
def wrap_and_format(self, width=None, include_params=False, include_return=False, excluded_params=None):
        """Wrap, format and print this docstring for a specific width.

        Args:
            width (int): The number of characters per line.  If set to None
                this will be inferred from the terminal width and default
                to 80 if not passed or if passed as None and the terminal
                width cannot be determined.
            include_return (bool): Include the return information section
                in the output.
            include_params (bool): Include a parameter information section
                in the output.
            excluded_params (list): An optional list of parameter names to exclude.
                Options for excluding things are, for example, 'self' or 'cls'.
        """

        if excluded_params is None:
            excluded_params = []

        out = StringIO()
        if width is None:
            width, _height = get_terminal_size()

        for line in self.maindoc:
            if isinstance(line, Line):
                out.write(fill(line.contents, width=width))
                out.write('\n')
            elif isinstance(line, BlankLine):
                out.write('\n')
            elif isinstance(line, ListItem):
                out.write(fill(line.contents, initial_indent=" %s " % line.marker[0], subsequent_indent="   ", width=width))
                out.write('\n')

        if include_params:
            included_params = set(self.param_info) - set(excluded_params)
            if len(included_params) > 0:
                out.write("\nParameters:\n")

                for param in included_params:
                    info = self.param_info[param]
                    out.write(" - %s (%s):\n" % (param, info.type_name))
                    out.write(fill(info.desc, initial_indent="   ", subsequent_indent="   ", width=width))
                    out.write('\n')

        if include_return:
            print("Returns:")
            print("    " + self.return_info.type_name)
            #pylint:disable=fixme; Issue tracked in #32
            # TODO: Also include description information here

        return out.getvalue()
def wrap_and_format(self, width=None, include_params=False, include_return=False, excluded_params=None):
        if excluded_params is None:
            excluded_params = []

        out = StringIO()
        if width is None:
            width, _height = get_terminal_size()

        for line in self.maindoc:
            if isinstance(line, Line):
                out.write(fill(line.contents, width=width))
                out.write('\n')
            elif isinstance(line, BlankLine):
                out.write('\n')
            elif isinstance(line, ListItem):
                out.write(fill(line.contents, initial_indent=" %s " % line.marker[0], subsequent_indent="   ", width=width))
                out.write('\n')

        if include_params:
            included_params = set(self.param_info) - set(excluded_params)
            if len(included_params) > 0:
                out.write("\nParameters:\n")

                for param in included_params:
                    info = self.param_info[param]
                    out.write(" - %s (%s):\n" % (param, info.type_name))
                    out.write(fill(info.desc, initial_indent="   ", subsequent_indent="   ", width=width))
                    out.write('\n')

        if include_return:
            print("Returns:")
            print("    " + self.return_info.type_name)
            #pylint:disable=fixme; Issue tracked in #32
            # TODO: Also include description information here

        return out.getvalue()
def wrap_and_format ( self , width = None , include_params = False , include_return = False , excluded_params = None ) : if excluded_params is None : excluded_params = [ ] out = StringIO ( ) if width is None : width , _height = get_terminal_size ( ) for line in self . maindoc : if isinstance ( line , Line ) : out . write ( fill ( line . contents , width = width ) ) out . write ( '\n' ) elif isinstance ( line , BlankLine ) : out . write ( '\n' ) elif isinstance ( line , ListItem ) : out . write ( fill ( line . contents , initial_indent = " %s " % line . marker [ 0 ] , subsequent_indent = "   " , width = width ) ) out . write ( '\n' ) if include_params : included_params = set ( self . param_info ) - set ( excluded_params ) if len ( included_params ) > 0 : out . write ( "\nParameters:\n" ) for param in included_params : info = self . param_info [ param ] out . write ( " - %s (%s):\n" % ( param , info . type_name ) ) out . write ( fill ( info . desc , initial_indent = "   " , subsequent_indent = "   " , width = width ) ) out . write ( '\n' ) if include_return : print ( "Returns:" ) print ( "    " + self . return_info . type_name ) #pylint:disable=fixme; Issue tracked in #32 # TODO: Also include description information here return out . getvalue ( )
Wrap, format and print this docstring for a specific width.

        Args:
            width (int): The number of characters per line.  If set to None
                this will be inferred from the terminal width and default
                to 80 if not passed or if passed as None and the terminal
                width cannot be determined.
            include_return (bool): Include the return information section
                in the output.
            include_params (bool): Include a parameter information section
                in the output.
            excluded_params (list): An optional list of parameter names to exclude.
                Options for excluding things are, for example, 'self' or 'cls'.
Wrap format and print this docstring for a specific width .