Exemplo n.º 1
0
def _emit_snippet_class_doc_string(c):
    """Emits class doc string."""
    doc_string = "" if not c.doc_string else c.doc_string

    if doc_string:
        doc_string = "{0}{1}{2}".format(doc_string,
                                        gu.emit_line_return(2),
                                        gu.emit_indent())

    return "{0}{1}{2}".format(gu.emit_line_return(2),
                              gu.emit_indent(),
                              doc_string)
Exemplo n.º 2
0
def _emit_snippet_decoding(prp, decoding, type_):
    """Emits a class property decoding."""
    tmpl = '{0}(\'{1}\', {2}, {3}, \'{4}\'),'
    return tmpl.format(
        gu.emit_line_return() + gu.emit_indent(2),
        prp.name,
        prp.is_collection,
        _get_decoding_function(prp, type_),
        '' if decoding is None else decoding)
Exemplo n.º 3
0
 def get_code(p):
     return "{0}{1}{2}# {3} ({4}){5}".format(
         gu.emit_indent(2),
         pgu.get_property_ctor(p),
         ''.ljust(50 - len(pgu.get_property_ctor(p))),
         pgu.get_type_doc_name(p.type),
         p.cardinality,
         gu.emit_line_return()
     )
Exemplo n.º 4
0
 def get_code(cnt):
     prp = c.get_property(cnt[0])
     if prp is not None:
         return '{0}self.{1} = {2}("{3}"){4}'.format(
             gu.emit_indent(2),
             cnt[0],
             pgu.get_type_functional_name(prp.type),
             cnt[1],
             gu.emit_line_return()
         )
Exemplo n.º 5
0
    def emit_descriptions():
        def get_code(m):
            code = gu.emit_line_return()
            code += gu.emit_indent(2)
            code += '"{}"'.format(m.doc_string)

            return code

        code = gu.emit(e.members, get_code, joiner=",", sort=False)
        code += gu.emit_line_return()
        code += gu.emit_indent(2)

        return code
Exemplo n.º 6
0
    def emit_members():
        def get_code(m):
            code = gu.emit_line_return()
            code += gu.emit_indent(2)
            code += '"{}"'.format(m.name)

            return code

        code = gu.emit(e.members, get_code, joiner=",", sort=False)
        code += gu.emit_line_return()
        code += gu.emit_indent(2)

        return code
Exemplo n.º 7
0
        def get_code(m):
            code = gu.emit_line_return()
            code += gu.emit_indent(2)
            code += '"{}"'.format(m.doc_string)

            return code
Exemplo n.º 8
0
        def get_code(m):
            code = gu.emit_line_return()
            code += gu.emit_indent(2)
            code += '"{}"'.format(m.name)

            return code