def _has_valid_type_annotation(self, tokens, i):
if not self._inside_brackets("<STR_LIT:(>"):<EOL><INDENT>return False<EOL><DEDENT>bracket_level = <NUM_LIT:0><EOL>for token in tokens[i - <NUM_LIT:1> :: -<NUM_LIT:1>]:<EOL><INDENT>if token[<NUM_LIT:1>] == "<STR_LIT::>":<EOL><INDENT>return True<EOL><DEDENT>if token[<NUM_LIT:1>] == "<STR_LIT:(>":<EOL><INDENT>return False<EOL><DEDENT>if token[<NUM_LIT:1>] == "<STR_LIT:]>":<EOL><INDENT>bracket_level += <NUM_LIT:1><EOL><DEDENT>elif token[<NUM_LIT:1>] == "<STR_LIT:[>":<EOL><INDENT>bracket_level -= <NUM_LIT:1><EOL><DEDENT>elif token[<NUM_LIT:1>] == "<STR_LIT:U+002C>":<EOL><INDENT>if not bracket_level:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>elif token[<NUM_LIT:1>] in ("<STR_LIT:.>", "<STR_LIT>"):<EOL><INDENT>continue<EOL><DEDENT>elif token[<NUM_LIT:0>] not in (tokenize.NAME, tokenize.STRING, tokenize.NL):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return False<EOL>
Extended check of PEP-484 type hint presence