def iter_logical_lines(self, blob):
    """Returns an iterator of (start_line, stop_line, indent) for logical lines """
    indent_stack = []
    contents = []
    line_number_start = None
    for token in self.iter_tokens(blob):
      token_type, token_text, token_start = token[0:3]
      if token_type == tokenize.INDENT:
        indent_stack.append(token_text)
      if token_type == tokenize.DEDENT:
        indent_stack.pop()
      if token_type in self.SKIP_TOKENS:
        continue
      contents.append(token_text)
      if line_number_start is None:
        line_number_start = token_start[0]
      elif token_type in (tokenize.NEWLINE, tokenize.ENDMARKER):
        yield self.translate_logical_line(
            line_number_start,
            token_start[0] + (1 if token_type is tokenize.NEWLINE else -1),
            [_f for _f in contents if _f],
            indent_stack,
            endmarker=token_type == tokenize.ENDMARKER)
        contents = []
        line_number_start = None
def iter_logical_lines ( self , blob ) : indent_stack = [ ] contents = [ ] line_number_start = None for token in self . iter_tokens ( blob ) : token_type , token_text , token_start = token [ 0 : 3 ] if token_type == tokenize . INDENT : indent_stack . append ( token_text ) if token_type == tokenize . DEDENT : indent_stack . pop ( ) if token_type in self . SKIP_TOKENS : continue contents . append ( token_text ) if line_number_start is None : line_number_start = token_start [ 0 ] elif token_type in ( tokenize . NEWLINE , tokenize . ENDMARKER ) : yield self . translate_logical_line ( line_number_start , token_start [ 0 ] + ( 1 if token_type is tokenize . NEWLINE else - 1 ) , [ _f for _f in contents if _f ] , indent_stack , endmarker = token_type == tokenize . ENDMARKER ) contents = [ ] line_number_start = None
Returns an iterator of (start_line, stop_line, indent) for logical lines