Example #1
0
 def _print_class_rst(self, clazz):
     self._print_header(clazz)
     # Body
     self.ctx.lvl_inc()
     self._print_bases(clazz=clazz)
     self._print_class_hierarchy(clazz)
     if clazz.stmt.search_one('presence') is not None:
         self._append('This class is a :ref:`presence class<presence-class>`\n')
     self._print_docstring(clazz, get_class_docstring(clazz))
     if not clazz.is_identity() and not clazz.is_grouping():
         self._print_class_config_method()
     self.ctx.lvl_dec()
Example #2
0
 def _print_class_rst(self, clazz):
     self._print_header(clazz)
     # Body
     self.ctx.lvl_inc()
     self._print_bases(clazz=clazz)
     self._print_class_hierarchy(clazz)
     if clazz.stmt.search_one('presence') is not None:
         self._append(
             'This class is a :ref:`presence class<presence-class>`\n')
     self._print_docstring(clazz, get_class_docstring(clazz))
     if not clazz.is_identity() and not clazz.is_grouping():
         self._print_class_config_method()
     self.ctx.lvl_dec()
Example #3
0
 def _print_class_rst(self, clazz):
     self._print_namespace(clazz)
     self._print_header(clazz)
     # Body
     self.ctx.lvl_inc()
     self._print_bases(clazz)
     self._print_class_hierarchy(clazz)
     if clazz.stmt.search_one('presence') is not None:
         self._append('This class is a :ref:`presence class<presence-class>`\n')
     if clazz.stmt.keyword != 'rpc':
         if is_config_stmt(clazz.stmt):
             self._append('This class represents configuration data.\n')
         else:
             self._append('This class represents state data.\n')
     else:
         self._append('This class defines parameters to the RPC operation\n')
     self._print_docstring(clazz, get_class_docstring(
         clazz, self.lang, identity_subclasses=self.identity_subclasses))
     self.ctx.lvl_dec()
Example #4
0
    def _print_class_rst(self, clazz):
        self._print_namespace(clazz)
        self._print_header(clazz)
        # Body
        self.ctx.lvl_inc()
        if self.lang != 'go':
            self._print_bases(clazz)
            self._print_class_hierarchy(clazz)
        if clazz.stmt.search_one('presence') is not None:
            self._append('This class is a :ref:`presence class<presence-class>`\n')
        if clazz.stmt.keyword != 'rpc':
            if is_config_stmt(clazz.stmt):
                self._append('This class represents configuration data.\n')
            else:
                self._append('This class represents state data.\n')
        else:
            self._append('This class defines parameters to the RPC operation\n')

        docstring = get_class_docstring(
            clazz, self.lang, identity_subclasses=self.identity_subclasses)
        self._print_docstring(clazz, docstring)
        self.ctx.lvl_dec()
Example #5
0
 def _print_class_docstring_text(self, clazz):
     class_docstring = get_class_docstring(clazz, 'py')
     if len(class_docstring) > 0:
         for line in class_docstring.split('\n'):
             self.ctx.writeln('%s' % line)
     self.ctx.bline()
    def _print_class_rst(self, clazz):
        class_docstring = get_class_docstring(clazz)

        # Title
        lines = []
        lines.append(clazz.name)
        lines.append('=' * len(clazz.name))
        lines.append('\n')
        self.ctx.writelns(lines)

        # TOC Tree
        self._write_toctree(clazz)

        lines = []
        lines.append('')
        lines.append('.. py:currentmodule:: %s' %
                         (clazz.get_py_mod_name()))
        lines.append('\n')

        # Class Header
        lines.append('.. py:class:: %s' % (clazz.qn()))
        lines.append('\n')

        self.ctx.writelns(lines)
        self.ctx.lvl_inc()

        # Bases
        lines = []
        bases = [':class:`object`']
        if clazz.extends:
            for item in clazz.extends:
                bases.append(':class:`%s`' % (item.name))
        lines.append('Bases: %s' % (', '.join(bases)))
        lines.append('\n')

        # Class Hierarchy
        if not clazz.is_identity() and not clazz.is_grouping():
            clazz_hierarchy = self._get_class_hierarchy(clazz)
            if clazz_hierarchy is not None:
                lines.append(clazz_hierarchy)
                lines.append('\n')

        # Presence Container
        lines.append('\n')
        if clazz.stmt.search_one('presence') is not None:
            line = """This class is a :ref:`presence class<presence-class>`"""
            lines.append(line)
            lines.append('\n')

        # Doc String
        if len(class_docstring) > 0:
            for line in class_docstring.split('\n'):
                if line.strip() != '':
                    lines.append(line)
                    lines.append('\n')

        if not clazz.is_identity() and not clazz.is_grouping():
            # Config Method
            lines.append('.. method:: is_config()\n')
            self.ctx.writelns(lines)
            self.ctx.lvl_inc()
            self.ctx.writeln("Returns True if this instance \
                represents config data else returns False")
            self.ctx.lvl_dec()
            self.ctx.bline()
        self.ctx.lvl_dec()
    def _print_class_rst(self, clazz):
        class_docstring = get_class_docstring(clazz)

        # Title
        lines = []
        lines.append(clazz.name)
        lines.append('=' * len(clazz.name))
        lines.append('\n')
        self.ctx.writelns(lines)

        # TOC Tree
        self._write_toctree(clazz)

        lines = []
        lines.append('')
        lines.append('.. py:currentmodule:: %s' % (clazz.get_py_mod_name()))
        lines.append('\n')

        # Class Header
        lines.append('.. py:class:: %s' % (clazz.qn()))
        lines.append('\n')

        self.ctx.writelns(lines)
        self.ctx.lvl_inc()

        # Bases
        lines = []
        bases = [':class:`object`']
        if clazz.extends:
            for item in clazz.extends:
                bases.append(':class:`%s`' % (item.name))
        lines.append('Bases: %s' % (', '.join(bases)))
        lines.append('\n')

        # Class Hierarchy
        if not clazz.is_identity() and not clazz.is_grouping():
            clazz_hierarchy = self._get_class_hierarchy(clazz)
            if clazz_hierarchy is not None:
                lines.append(clazz_hierarchy)
                lines.append('\n')

        # Presence Container
        lines.append('\n')
        if clazz.stmt.search_one('presence') is not None:
            line = """This class is a :ref:`presence class<presence-class>`"""
            lines.append(line)
            lines.append('\n')

        # Doc String
        if len(class_docstring) > 0:
            for line in class_docstring.split('\n'):
                if line.strip() != '':
                    lines.append(line)
                    lines.append('\n')

        if not clazz.is_identity() and not clazz.is_grouping():
            # Config Method
            lines.append('.. method:: is_config()\n')
            self.ctx.writelns(lines)
            self.ctx.lvl_inc()
            self.ctx.writeln("Returns True if this instance \
                represents config data else returns False")
            self.ctx.lvl_dec()
            self.ctx.bline()
        self.ctx.lvl_dec()