pylint/checkers/format.py
def _has_valid_type_annotation(self, tokens, i):
        """Extended check of PEP-484 type hint presence"""
        if not self._inside_brackets("("):
            return False
        # token_info
        # type string start end line
        #  0      1     2    3    4
        bracket_level = 0
        for token in tokens[i - 1 :: -1]:
            if token[1] == ":":
                return True
            if token[1] == "(":
                return False
            if token[1] == "]":
                bracket_level += 1
            elif token[1] == "[":
                bracket_level -= 1
            elif token[1] == ",":
                if not bracket_level:
                    return False
            elif token[1] in (".", "..."):
                continue
            elif token[0] not in (tokenize.NAME, tokenize.STRING, tokenize.NL):
                return False
        return False
def _has_valid_type_annotation(self, tokens, i):
        if not self._inside_brackets("("):
            return False
        # token_info
        # type string start end line
        #  0      1     2    3    4
        bracket_level = 0
        for token in tokens[i - 1 :: -1]:
            if token[1] == ":":
                return True
            if token[1] == "(":
                return False
            if token[1] == "]":
                bracket_level += 1
            elif token[1] == "[":
                bracket_level -= 1
            elif token[1] == ",":
                if not bracket_level:
                    return False
            elif token[1] in (".", "..."):
                continue
            elif token[0] not in (tokenize.NAME, tokenize.STRING, tokenize.NL):
                return False
        return False
def _has_valid_type_annotation ( self , tokens , i ) : if not self . _inside_brackets ( "(" ) : return False # token_info # type string start end line #  0      1     2    3    4 bracket_level = 0 for token in tokens [ i - 1 : : - 1 ] : if token [ 1 ] == ":" : return True if token [ 1 ] == "(" : return False if token [ 1 ] == "]" : bracket_level += 1 elif token [ 1 ] == "[" : bracket_level -= 1 elif token [ 1 ] == "," : if not bracket_level : return False elif token [ 1 ] in ( "." , "..." ) : continue elif token [ 0 ] not in ( tokenize . NAME , tokenize . STRING , tokenize . NL ) : return False return False
Extended check of PEP-484 type hint presence
Extended check of PEP - 484 type hint presence