def getHelpStr(description, arguments):
    '''description should just be a string
    
    arguments should be a list of type CLArgument
    '''
    
    LEFT_COL_PADDING=25
    WRAP_SIZE = 50

    ostring = description + "\n\n"

    #descriptions can span multiple rows,
    #the first row contains the argument name
    #the next just and empty string
    def once(param, times=0):
        while True:
            if times == 0:
                times += 1
                yield param
            else:
                yield ""

    #add an empty string to the beginning of multiline descriptions
    #that are returned by 'wrap'
    wrap_s = WRAP_SIZE
    d =  reduce( add, map(lambda x: zip(once("-"+x.name),
                                        wrap(x.description, wrap_s)),arguments))

    pad = LEFT_COL_PADDING
    ostring += "\n".join(map(lambda (left,right): "".join((left.ljust(pad),right)), d))
    
    return ostring
dataset/ETHPy150Open jgurtowski/ectools/args.py/getHelpStr/original