pymodeler/parameter.py
def defaults_docstring(defaults, header=None, indent=None, footer=None):
    """Return a docstring from a list of defaults.
    """
    if indent is None:
        indent = ''
    if header is None:
        header = ''
    if footer is None:
        footer = ''

    width = 60
    #hbar = indent + width * '=' + '\n'  # horizontal bar
    hbar = '\n'

    s = hbar + (header) + hbar
    for key, value, desc in defaults:
        if isinstance(value, basestring):
            value = "'" + value + "'"
        if hasattr(value, '__call__'):
            value = "<" + value.__name__ + ">"

        s += indent +'%-12s\n' % ("%s :" % key)
        s += indent + indent + (indent + 23 * ' ').join(desc.split('\n'))
        s += ' [%s]\n\n' % str(value)
    s += hbar
    s += footer
    return s
def defaults_docstring(defaults, header=None, indent=None, footer=None):
    if indent is None:
        indent = ''
    if header is None:
        header = ''
    if footer is None:
        footer = ''

    width = 60
    #hbar = indent + width * '=' + '\n'  # horizontal bar
    hbar = '\n'

    s = hbar + (header) + hbar
    for key, value, desc in defaults:
        if isinstance(value, basestring):
            value = "'" + value + "'"
        if hasattr(value, '__call__'):
            value = "<" + value.__name__ + ">"

        s += indent +'%-12s\n' % ("%s :" % key)
        s += indent + indent + (indent + 23 * ' ').join(desc.split('\n'))
        s += ' [%s]\n\n' % str(value)
    s += hbar
    s += footer
    return s
def defaults_docstring ( defaults , header = None , indent = None , footer = None ) : if indent is None : indent = '' if header is None : header = '' if footer is None : footer = '' width = 60 #hbar = indent + width * '=' + '\n'  # horizontal bar hbar = '\n' s = hbar + ( header ) + hbar for key , value , desc in defaults : if isinstance ( value , basestring ) : value = "'" + value + "'" if hasattr ( value , '__call__' ) : value = "<" + value . __name__ + ">" s += indent + '%-12s\n' % ( "%s :" % key ) s += indent + indent + ( indent + 23 * ' ' ) . join ( desc . split ( '\n' ) ) s += ' [%s]\n\n' % str ( value ) s += hbar s += footer return s
Return a docstring from a list of defaults.
Return a docstring from a list of defaults .