(self, blockOrBlockNumber, column)
return not any(recursive_is_type(token_type, non_code_token)
                       for non_code_token
                       in (Token.Comment, Token.String))
Check if text at given position is a code.

        If language is not known, or text is not parsed yet, ``True`` is returned
Check if text at given position is a code.
Check if text at given position is a code .
def isCode(self, blockOrBlockNumber, column):
        """Check if text at given position is a code.

        If language is not known, or text is not parsed yet, ``True`` is returned
        """
        if isinstance(blockOrBlockNumber, QTextBlock):
            block = blockOrBlockNumber
        else:
            block = self.document().findBlockByNumber(blockOrBlockNumber)

        # here, pygments' highlighter is implemented, so the dataobject
        # that is originally defined in Qutepart isn't the same

        # so I'm using pygments' parser, storing it in the data object

        dataObject = block.userData()
        if dataObject is None:
            return True
        if len(dataObject.syntax_stack) > 1:
            return False

        token_type = self._get_token_at(block, column)

        def recursive_is_type(token, parent_token):
            if token.parent is None:
                return False
            if token.parent is parent_token:
                return True
            return recursive_is_type(token.parent, parent_token)

        return not any(recursive_is_type(token_type, non_code_token)
                       for non_code_token
                       in (Token.Comment, Token.String))
def isCode ( self , blockOrBlockNumber , column ) : if isinstance ( blockOrBlockNumber , QTextBlock ) : block = blockOrBlockNumber else : block = self . document ( ) . findBlockByNumber ( blockOrBlockNumber ) # here, pygments' highlighter is implemented, so the dataobject # that is originally defined in Qutepart isn't the same # so I'm using pygments' parser, storing it in the data object dataObject = block . userData ( ) if dataObject is None : return True if len ( dataObject . syntax_stack ) > 1 : return False token_type = self . _get_token_at ( block , column ) def recursive_is_type ( token , parent_token ) : if token . parent is None : return False if token . parent is parent_token : return True return recursive_is_type ( token . parent , parent_token ) return not any ( recursive_is_type ( token_type , non_code_token ) for non_code_token in ( Token . Comment , Token . String ) )