parameters: (self, block, lineno, indent, filename)
return_statement: return block
docstring: Refactors one doctest.
  
          A doctest is given as a block of lines, the first of which starts
          with ">>>" (possibly indented), while the remaining lines start
          with "..." (identically indented).
docstring_summary: Refactors one doctest.
docstring_tokens: Refactors one doctest .
function: def refactor_doctest(self, block, lineno, indent, filename):
          """Refactors one doctest.
  
          A doctest is given as a block of lines, the first of which starts
          with ">>>" (possibly indented), while the remaining lines start
          with "..." (identically indented).
  
          """
          try:
              tree = self.parse_block(block, lineno, indent)
          except Exception as err:
              if self.logger.isEnabledFor(logging.DEBUG):
                  for line in block:
                      self.log_debug("Source: %s", line.rstrip(u"\n"))
              self.log_error("Can't parse docstring in %s line %s: %s: %s",
                             filename, lineno, err.__class__.__name__, err)
              return block
          if self.refactor_tree(tree, filename):
              new = unicode(tree).splitlines(True)
              # Undo the adjustment of the line numbers in wrap_toks() below.
              clipped, new = new[:lineno-1], new[lineno-1:]
              assert clipped == [u"\n"] * (lineno-1), clipped
              if not new[-1].endswith(u"\n"):
                  new[-1] += u"\n"
              block = [indent + self.PS1 + new.pop(0)]
              if new:
                  block += [indent + self.PS2 + line for line in new]
          return block
function_tokens: def refactor_doctest ( self , block , lineno , indent , filename ) : try : tree = self . parse_block ( block , lineno , indent ) except Exception as err : if self . logger . isEnabledFor ( logging . DEBUG ) : for line in block : self . log_debug ( "Source: %s" , line . rstrip ( u"\n" ) ) self . log_error ( "Can't parse docstring in %s line %s: %s: %s" , filename , lineno , err . __class__ . __name__ , err ) return block if self . refactor_tree ( tree , filename ) : new = unicode ( tree ) . splitlines ( True ) # Undo the adjustment of the line numbers in wrap_toks() below. clipped , new = new [ : lineno - 1 ] , new [ lineno - 1 : ] assert clipped == [ u"\n" ] * ( lineno - 1 ) , clipped if not new [ - 1 ] . endswith ( u"\n" ) : new [ - 1 ] += u"\n" block = [ indent + self . PS1 + new . pop ( 0 ) ] if new : block += [ indent + self . PS2 + line for line in new ] return block