sugarsdk/linting/pep287.py
def _check_raises(self, node):
        """
        Find out if a function raises something but
        is not documents that or vice versa.

        :param node: function node
        :return: None
        """
        exceptions = list(set(self.what_raises(node)))
        documented = 0
        self._check_raises_described(node, raised=exceptions)
        for line in node.doc.strip().split(os.linesep):
            line = line.strip()
            if line.startswith(":rais"):
                keyword = line.split(" ", 1)[0]
                if keyword == ":raise":  # This is actually an error
                    self.add_message("PEP287-doc-raises-instead-raise", node=node, args=(keyword, node.name,))
                elif keyword  != ":raises":
                    self.add_message("PEP287-doc-raises-instead-raise", node=node, args=(keyword, node.name,))
                exc_name = line.replace(":raises ", ":raise ").split(" ", 1)[-1].replace(":", "").split(" ")[0]
                if exc_name not in exceptions and '-' not in exceptions:
                    self.add_message("PEP287-superfluous-raises", node=node, args=(exc_name,))
                else:
                    documented += 1
                    if exc_name in exceptions:
                        exceptions.pop(exceptions.index(exc_name))
        for exc_name in exceptions:
            if exc_name.startswith("current exception") and documented:
                continue
            elif exc_name == "-":
                continue
            if not exc_name.startswith("current"):
                exc_name = '"{}"'.format(exc_name)
            self.add_message("PEP287-raises-missing", node=node, args=(exc_name,))
        # Here we check if there are only skippers, i.e. something is re-raised but never documented:
        if len([skp for skp in exceptions if skp == '-']) > documented:
            self.add_message("PEP287-raises-missing", node=node,
                             args=("an exception in the function '{}'".format(node.name),))

        Find out if a function raises something but
        is not documents that or vice versa.

        :param node: function node
        :return: None
        
Find out if a function raises something but
is not documents that or vice versa.
Find out if a function raises something but is not documents that or vice versa .
def _check_raises(self, node):
        exceptions = list(set(self.what_raises(node)))
        documented = 0
        self._check_raises_described(node, raised=exceptions)
        for line in node.doc.strip().split(os.linesep):
            line = line.strip()
            if line.startswith(":rais"):
                keyword = line.split(" ", 1)[0]
                if keyword == ":raise":  
                    self.add_message("PEP287-doc-raises-instead-raise", node=node, args=(keyword, node.name,))
                elif keyword  != ":raises":
                    self.add_message("PEP287-doc-raises-instead-raise", node=node, args=(keyword, node.name,))
                exc_name = line.replace(":raises ", ":raise ").split(" ", 1)[-1].replace(":", "").split(" ")[0]
                if exc_name not in exceptions and '-' not in exceptions:
                    self.add_message("PEP287-superfluous-raises", node=node, args=(exc_name,))
                else:
                    documented += 1
                    if exc_name in exceptions:
                        exceptions.pop(exceptions.index(exc_name))
        for exc_name in exceptions:
            if exc_name.startswith("current exception") and documented:
                continue
            elif exc_name == "-":
                continue
            if not exc_name.startswith("current"):
                exc_name = '"{}"'.format(exc_name)
            self.add_message("PEP287-raises-missing", node=node, args=(exc_name,))
        if len([skp for skp in exceptions if skp == '-']) > documented:
            self.add_message("PEP287-raises-missing", node=node,
                             args=("an exception in the function '{}'".format(node.name),))
def _check_raises ( self , node ) : exceptions = list ( set ( self . what_raises ( node ) ) ) documented = 0 self . _check_raises_described ( node , raised = exceptions ) for line in node . doc . strip ( ) . split ( os . linesep ) : line = line . strip ( ) if line . startswith ( ":rais" ) : keyword = line . split ( " " , 1 ) [ 0 ] if keyword == ":raise" : self . add_message ( "PEP287-doc-raises-instead-raise" , node = node , args = ( keyword , node . name , ) ) elif keyword != ":raises" : self . add_message ( "PEP287-doc-raises-instead-raise" , node = node , args = ( keyword , node . name , ) ) exc_name = line . replace ( ":raises " , ":raise " ) . split ( " " , 1 ) [ - 1 ] . replace ( ":" , "" ) . split ( " " ) [ 0 ] if exc_name not in exceptions and '-' not in exceptions : self . add_message ( "PEP287-superfluous-raises" , node = node , args = ( exc_name , ) ) else : documented += 1 if exc_name in exceptions : exceptions . pop ( exceptions . index ( exc_name ) ) for exc_name in exceptions : if exc_name . startswith ( "current exception" ) and documented : continue elif exc_name == "-" : continue if not exc_name . startswith ( "current" ) : exc_name = '"{}"' . format ( exc_name ) self . add_message ( "PEP287-raises-missing" , node = node , args = ( exc_name , ) ) if len ( [ skp for skp in exceptions if skp == '-' ] ) > documented : self . add_message ( "PEP287-raises-missing" , node = node , args = ( "an exception in the function '{}'" . format ( node . name ) , ) )
Find out if a function raises something but
is not documents that or vice versa.
Find out if a function raises something but is not documents that or vice versa .
"""
        Find out if a function raises something but
        is not documents that or vice versa.

        :param node: function node
        :return: None
        """ # This is actually an error # Here we check if there are only skippers, i.e. something is re-raised but never documented:
None
self
node
None