pylint/checkers/raw_metrics.py
def get_type(tokens, start_index):
    """return the line type : docstring, comment, code, empty"""
    i = start_index
    tok_type = tokens[i][0]
    start = tokens[i][2]
    pos = start
    line_type = None
    while i < len(tokens) and tokens[i][2][0] == start[0]:
        tok_type = tokens[i][0]
        pos = tokens[i][3]
        if line_type is None:
            if tok_type == tokenize.STRING:
                line_type = "docstring_lines"
            elif tok_type == tokenize.COMMENT:
                line_type = "comment_lines"
            elif tok_type in JUNK:
                pass
            else:
                line_type = "code_lines"
        i += 1
    if line_type is None:
        line_type = "empty_lines"
    elif i < len(tokens) and tokens[i][0] == tokenize.NEWLINE:
        i += 1
    return i, pos[0] - start[0] + 1, line_type
def get_type(tokens, start_index):
    """return the line type : docstring, comment, code, empty"""
    i = start_index
    tok_type = tokens[i][0]
    start = tokens[i][2]
    pos = start
    line_type = None
    while i < len(tokens) and tokens[i][2][0] == start[0]:
        tok_type = tokens[i][0]
        pos = tokens[i][3]
        if line_type is None:
            if tok_type == tokenize.STRING:
                line_type = "docstring_lines"
            elif tok_type == tokenize.COMMENT:
                line_type = "comment_lines"
            elif tok_type in JUNK:
                pass
            else:
                line_type = "code_lines"
        i += 1
    if line_type is None:
        line_type = "empty_lines"
    elif i < len(tokens) and tokens[i][0] == tokenize.NEWLINE:
        i += 1
    return i, pos[0] - start[0] + 1, line_type
def get_type ( tokens , start_index ) : i = start_index tok_type = tokens [ i ] [ 0 ] start = tokens [ i ] [ 2 ] pos = start line_type = None while i < len ( tokens ) and tokens [ i ] [ 2 ] [ 0 ] == start [ 0 ] : tok_type = tokens [ i ] [ 0 ] pos = tokens [ i ] [ 3 ] if line_type is None : if tok_type == tokenize . STRING : line_type = "docstring_lines" elif tok_type == tokenize . COMMENT : line_type = "comment_lines" elif tok_type in JUNK : pass else : line_type = "code_lines" i += 1 if line_type is None : line_type = "empty_lines" elif i < len ( tokens ) and tokens [ i ] [ 0 ] == tokenize . NEWLINE : i += 1 return i , pos [ 0 ] - start [ 0 ] + 1 , line_type
return the line type : docstring, comment, code, empty
return the line type : docstring comment code empty