Пример #1
0
def make_doc_function(node):
    """ Makes the doc of the node node"""

    # first case : it is a dict function
    # FIXME : to be improved, what do we want ?
    if util.use_parameter_class(node):
        member_list = CL.get_members(util.get_decl_param_class(node), True)
        member_list2 = treat_member_list(member_list)
        h = ['Parameter Name','Type','Default', 'Documentation']
        l = [(m.spelling,m.ctype, m.initializer.replace("res.",""), m.doc) for m in member_list2]
        table =  make_table(h, l)
        doc = doc + '\n' + table
        return doc
    
    # General case
    p = ProcessedDoc(node) # general treatment and analysis, common with cpp2rst

    doc = "%s\n\n%s\n"%(p.brief_doc, p.doc)
   
    params = p.elements['params'] # parameters of the function
    if params:
        doc += "Parameters\n----------\n"
       for p in params:
           name, comment = (p + '  ').split(' ',1)
           doc += "%s \n%s\n"%(name, decal(comment))

    if p.elements['return']:
        _type = '' # FIXME : deduce the type ?
        doc += "Returns\n-------\n%s\n%s"(_type, decal(comment))
    
    return doc
Пример #2
0
def make_doc(node):
    """ process doc of node"""

    doc = process_doc(node.raw_comment)
    if util.use_parameter_class(node):
        doc = doc + '\n' + doc_format_param(
            CL.get_members(util.get_decl_param_class(node), True))

    return replace_latex(replace_cpp_keywords_by_py_keywords(doc))
Пример #3
0
def make_doc_function(node):
    """ Makes the doc of the node node"""
    pdoc = ProcessedDoc(
        node)  # general treatment and analysis, common with cpp2rst

    # first case : it is a dict function
    # FIXME : to be improved, what do we want ?
    if util.use_parameter_class(node):
        member_list = CL.get_members(util.get_decl_param_class(node), True)
        table = doc_param_dict_format(member_list)
        return "%s\n\n%s\n\n%s\n" % (pdoc.brief_doc, pdoc.doc, table)

        # member_list2 = treat_member_list(member_list)
        # h = ['Parameter Name','Type','Default', 'Documentation']
        # l = [(m.spelling,m.ctype, m.initializer.replace("res.",""), m.doc) for m in member_list2]
        # table =  make_table(h, *l)
        # doc = clean_doc_string(node.raw_comment) + '\n' + table
        # return doc

    # General case

    doc = "\n%s\n%s" % (pdoc.brief_doc, pdoc.doc)
    doc = doc.strip() + "\n"

    params = pdoc.elements.pop('param', None)  # parameters of the function
    if params:
        doc += "\nParameters\n----------\n"
        for p in params:
            name, comment = (p + '  ').split(' ', 1)
            doc += "%s \n%s\n\n" % (name, decal(comment))

    ret = pdoc.elements.pop('return', None)
    if ret:
        _type = ''  # FIXME : deduce the type ?
        doc += "Returns\n-------\nout  %s\n%s\n\n" % (_type, decal(ret))

    return doc.strip()
Пример #4
0
Файл: doc.py Проект: TRIQS/triqs
def make_doc_function(node):
    """ Makes the doc of the node node"""
    pdoc = ProcessedDoc(node) # general treatment and analysis, common with cpp2rst

    # first case : it is a dict function
    # FIXME : to be improved, what do we want ?
    if util.use_parameter_class(node):
        member_list = CL.get_members(util.get_decl_param_class(node), True)
        table = doc_param_dict_format(member_list)
        return "%s\n\n%s\n\n%s\n"%( pdoc.brief_doc, pdoc.doc, table) 

        # member_list2 = treat_member_list(member_list)
        # h = ['Parameter Name','Type','Default', 'Documentation']
        # l = [(m.spelling,m.ctype, m.initializer.replace("res.",""), m.doc) for m in member_list2]
        # table =  make_table(h, *l)
        # doc = clean_doc_string(node.raw_comment) + '\n' + table
        # return doc
    
    # General case

    doc = "\n%s\n%s"%(pdoc.brief_doc, pdoc.doc)
    doc = doc.strip() + "\n"
   
    params = pdoc.elements.pop('param', None) # parameters of the function
    if params:
       doc += "\nParameters\n----------\n"
       for p in params:
           name, comment = (p + '  ').split(' ',1)
           doc += "%s \n%s\n\n"%(name, decal(comment))

    ret = pdoc.elements.pop('return', None)
    if ret:
        _type = '' # FIXME : deduce the type ?
        doc += "Returns\n-------\nout  %s\n%s\n\n"%(_type, decal(ret))
   
    return doc.strip()
Пример #5
0
 def get_all_param_classes(self):
     """ yields all param classes """
     for f in self.get_all_functions_and_methods():
         r = util.get_decl_param_class(f)
         if r:
             yield r
Пример #6
0
 def get_all_param_classes(self):
     """ yields all param classes """
     for f in self.get_all_functions_and_methods():
         r = util.get_decl_param_class(f)
         if r : 
             yield r