parameters: (comment_prefix,
                                comment_lineno,
                                comment_column,
                                standalone=False)
return_statement: return comments
docstring: Create pytree nodes to represent the given comment prefix.
  
    Args:
      comment_prefix: (unicode) the text of the comment from the node's prefix.
      comment_lineno: (int) the line number for the start of the comment.
      comment_column: (int) the column for the start of the comment.
      standalone: (bool) determines if the comment is standalone or not.
  
    Returns:
      The simple_stmt nodes if this is a standalone comment, otherwise a list of
      new COMMENT leafs. The prefix may consist of multiple comment blocks,
      separated by blank lines. Each block gets its own leaf.
docstring_summary: Create pytree nodes to represent the given comment prefix.
docstring_tokens: Create pytree nodes to represent the given comment prefix .
function: def _CreateCommentsFromPrefix(comment_prefix,
                                comment_lineno,
                                comment_column,
                                standalone=False):
    """Create pytree nodes to represent the given comment prefix.
  
    Args:
      comment_prefix: (unicode) the text of the comment from the node's prefix.
      comment_lineno: (int) the line number for the start of the comment.
      comment_column: (int) the column for the start of the comment.
      standalone: (bool) determines if the comment is standalone or not.
  
    Returns:
      The simple_stmt nodes if this is a standalone comment, otherwise a list of
      new COMMENT leafs. The prefix may consist of multiple comment blocks,
      separated by blank lines. Each block gets its own leaf.
    """
    # The comment is stored in the prefix attribute, with no lineno of its
    # own. So we only know at which line it ends. To find out at which line it
    # starts, look at how many newlines the comment itself contains.
    comments = []
  
    lines = comment_prefix.split('\n')
    index = 0
    while index < len(lines):
      comment_block = []
      while index < len(lines) and lines[index].lstrip().startswith('#'):
        comment_block.append(lines[index].strip())
        index += 1
  
      if comment_block:
        new_lineno = comment_lineno + index - 1
        comment_block[0] = comment_block[0].strip()
        comment_block[-1] = comment_block[-1].strip()
        comment_leaf = pytree.Leaf(
            type=token.COMMENT,
            value='\n'.join(comment_block),
            context=('', (new_lineno, comment_column)))
        comment_node = comment_leaf if not standalone else pytree.Node(
            pygram.python_symbols.simple_stmt, [comment_leaf])
        comments.append(comment_node)
  
      while index < len(lines) and not lines[index].lstrip():
        index += 1
  
    return comments
function_tokens: def _CreateCommentsFromPrefix ( comment_prefix , comment_lineno , comment_column , standalone = False ) : # The comment is stored in the prefix attribute, with no lineno of its # own. So we only know at which line it ends. To find out at which line it # starts, look at how many newlines the comment itself contains. comments = [ ] lines = comment_prefix . split ( '\n' ) index = 0 while index < len ( lines ) : comment_block = [ ] while index < len ( lines ) and lines [ index ] . lstrip ( ) . startswith ( '#' ) : comment_block . append ( lines [ index ] . strip ( ) ) index += 1 if comment_block : new_lineno = comment_lineno + index - 1 comment_block [ 0 ] = comment_block [ 0 ] . strip ( ) comment_block [ - 1 ] = comment_block [ - 1 ] . strip ( ) comment_leaf = pytree . Leaf ( type = token . COMMENT , value = '\n' . join ( comment_block ) , context = ( '' , ( new_lineno , comment_column ) ) ) comment_node = comment_leaf if not standalone else pytree . Node ( pygram . python_symbols . simple_stmt , [ comment_leaf ] ) comments . append ( comment_node ) while index < len ( lines ) and not lines [ index ] . lstrip ( ) : index += 1 return comments