sugarsdk/linting/pep287.py
def _check_explanation_block(self, node):
        """
        Docstring should contain explanation block.

        :param node: function node
        :return: None
        """
        docmap = []
        kw_ident = -1
        for idx, line in enumerate(node.doc.rstrip().split(os.linesep)):
            if not idx:
                continue  # Skip newline after triple-quotes
            s_line = line.strip()
            if not s_line:
                docmap.append("-")
            elif s_line.startswith(":") and s_line.split(" ", 1)[0].strip(":") in self.param_keywords:
                docmap.append(":")
                kw_ident = max(self._get_ident_len(line), kw_ident)
            else:
                # a = self._get_ident_len(line)
                docmap.append(":" if kw_ident > -1 and self._get_ident_len(line) > kw_ident else "#")
        docmap = ''.join(docmap)

        if "#:" in docmap or "--:" in docmap:
            self.add_message("PEP287-line-after-main-explanation", node=node, args=(node.name,))

        if "#" not in docmap:
            self.add_message("PEP287-main-explanation-missing", node=node, args=(node.name,))

        if not (docmap.strip(":") + ":").endswith("-:"):
            self.add_message("PEP287-params-block-last", node=node, args=(node.name,))

        Docstring should contain explanation block.

        :param node: function node
        :return: None
        
Docstring should contain explanation block.
Docstring should contain explanation block .
def _check_explanation_block(self, node):
        docmap = []
        kw_ident = -1
        for idx, line in enumerate(node.doc.rstrip().split(os.linesep)):
            if not idx:
                continue  
            s_line = line.strip()
            if not s_line:
                docmap.append("-")
            elif s_line.startswith(":") and s_line.split(" ", 1)[0].strip(":") in self.param_keywords:
                docmap.append(":")
                kw_ident = max(self._get_ident_len(line), kw_ident)
            else:
                docmap.append(":" if kw_ident > -1 and self._get_ident_len(line) > kw_ident else "#")
        docmap = ''.join(docmap)
        if "#:" in docmap or "--:" in docmap:
            self.add_message("PEP287-line-after-main-explanation", node=node, args=(node.name,))
        if "#" not in docmap:
            self.add_message("PEP287-main-explanation-missing", node=node, args=(node.name,))
        if not (docmap.strip(":") + ":").endswith("-:"):
            self.add_message("PEP287-params-block-last", node=node, args=(node.name,))
def _check_explanation_block ( self , node ) : docmap = [ ] kw_ident = - 1 for idx , line in enumerate ( node . doc . rstrip ( ) . split ( os . linesep ) ) : if not idx : continue s_line = line . strip ( ) if not s_line : docmap . append ( "-" ) elif s_line . startswith ( ":" ) and s_line . split ( " " , 1 ) [ 0 ] . strip ( ":" ) in self . param_keywords : docmap . append ( ":" ) kw_ident = max ( self . _get_ident_len ( line ) , kw_ident ) else : docmap . append ( ":" if kw_ident > - 1 and self . _get_ident_len ( line ) > kw_ident else "#" ) docmap = '' . join ( docmap ) if "#:" in docmap or "--:" in docmap : self . add_message ( "PEP287-line-after-main-explanation" , node = node , args = ( node . name , ) ) if "#" not in docmap : self . add_message ( "PEP287-main-explanation-missing" , node = node , args = ( node . name , ) ) if not ( docmap . strip ( ":" ) + ":" ) . endswith ( "-:" ) : self . add_message ( "PEP287-params-block-last" , node = node , args = ( node . name , ) )
Docstring should contain explanation block.
Docstring should contain explanation block .
"""
        Docstring should contain explanation block.

        :param node: function node
        :return: None
        """ # Skip newline after triple-quotes # a = self._get_ident_len(line)
None
self
node
None