| title | PyCommentGroup |
|---|---|
| sidebarTitle | PyCommentGroup |
| icon | |
| description | A group of related symbols that represent a comment or docstring in Python For example: ``` # Comment 1 # Comment 2 # Comment 3 ``` would be 3 individual comments (accessible via `symbols`), but together they form a `CommentGroup` (accessible via `self`). |
import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; import {Return} from '/snippets/Return.mdx'; import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx';
CommentGroup, SymbolGroup, Editable
### extended SymbolGroup } description="Returns a SymbolGroup of all extended nodes associated with this element." /> str } description="Returns the source text representation of all extended nodes." /> SourceFile } description="The file object that this Editable instance belongs to." /> NodeId } description=" " /> str } description="The file path of the file that this Editable instance belongs to." /> list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> Editable | None } description="Returns the next named sibling of the last symbol in the group." /> Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> NodeType } description=" " /> Editable } description=" " /> Class | None } description="Find the class this node is contained in" /> Function | None } description="Find the function this node is contained in" /> Statement | None } description="Find the statement this node is contained in" /> str } description="Returns the concatenated source code of all symbols in the group." /> list[ Editable ] } description="Returns the list of symbols in the group." /> str } description="Return the text content of all comments in the comment block." /> TSNode } description=" " /> list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ### ancestors Find all ancestors of the node of the given type. Does not return itself<Return return_type={ <>list[ <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable ]</> } description=""/>
Replace the source of this node with new text.
str } description="The new source text to replace the current text with." defaultValue="" /> bool, optional } description="Adjusts the indentation of new_src to match the current text's indentation. Defaults to False." defaultValue="False" /> int, optional } description="Priority of the edit operation. Higher priority edits take precedence. Defaults to 0." defaultValue="0" /> bool, optional } description="Prevents duplicate edits at the same location. Defaults to True." defaultValue="True" /><Return return_type={ None } description=""/>
Replace the text content of a comment group with new text.
str } description="The new text content to replace the existing comment text." defaultValue="" /><Return return_type={ None } description=""/>
Search for substrings in the given symbols that match strings_to_match.
<Return return_type={ <>list[ <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable ]</> } description="A list of Editable objects representing each match found."/>
Search for string literals matching given strings in the SymbolGroup.
list[str] } description="List of strings to search for in string literals." defaultValue="" /> bool, optional } description="If True, performs fuzzy matching instead of exact matching." defaultValue="False" /><Return return_type={ <>list[ <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable ]</> } description="List of Editable nodes representing the matching string literals found within the symbols."/>
Adds a visual flag comment to the end of this Editable's source text.
<Return return_type={ <>CodeFlag[ <a href="/api-reference/python/PyCommentGroup" style={ {fontWeight: "inherit", fontSize: "inherit"} }>PyCommentGroup ]</> } description=""/>
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
str } description="The variable name to search for." defaultValue="" /> bool } description="If True, matches variables where var_name is a substring. If False, requires exact match. Defaults to False." defaultValue="False" /><Return return_type={ <>list[ <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable ]</> } description="List of Editable objects representing variable usage nodes matching the given name."/>
Inserts source code after this node in the codebase.
str } description="The source code to insert." defaultValue="" /> bool, optional } description="Adjust indentation to match current text." defaultValue="False" /> bool, optional } description="Add a newline before the inserted code." defaultValue="True" /> int, optional } description="Priority of the edit operation." defaultValue="0" /> bool, optional } description="Deduplicate identical edits." defaultValue="True" /><Return return_type={ None } description=""/>
Inserts source code before this symbol group.
str } description="The source code to insert." defaultValue="" /> bool, optional } description="Whether to adjust the indentation of the inserted code to match the current code. Defaults to False." defaultValue="False" /> bool, optional } description="Whether to add a newline after the inserted code. Defaults to True." defaultValue="True" /> int, optional } description="The priority of this edit operation. Higher priority edits are applied first. Defaults to 0." defaultValue="0" /> bool, optional } description="Whether to prevent duplicate insertions of the same code. Defaults to True." defaultValue="True" /><Return return_type={ None } description=""/>
Check if this node is contained another node of the given class
<Return return_type={ bool } description=""/>
Find the first ancestor of the node of the given type. Does not return itself
<Return return_type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable | None</> } description=""/>
Reduces an editable to the following condition
<Return return_type={ None } description=""/>
Removes this node and its related extended nodes from the codebase.
bool, optional } description="Whether to delete related extended nodes like decorators and comments. Defaults to True." defaultValue="True" /> int, optional } description="Priority level of the removal operation. Defaults to 0." defaultValue="0" /> bool, optional } description="Whether to deduplicate removal operations. Defaults to True." defaultValue="True" /><Return return_type={ None } description=""/>
Replaces all instances of a string with a new string in all symbols within the group.
str } description="The string to be replaced." defaultValue="" /> str } description="The string to replace with." defaultValue="" /> int, optional } description="Maximum number of replacements to make. Defaults to -1 (replace all)." defaultValue="-1" /> int, optional } description="Priority of the replacement operation. Defaults to 0." defaultValue="0" /><Return return_type={ int } description="Number of replacements made."/>
Searches for regex matches in the codebase.
str } description="The regular expression pattern to search for." defaultValue="" /> bool, optional } description="Whether to include string literals in the search. Defaults to True." defaultValue="True" /> bool, optional } description="Whether to include comments in the search. Defaults to True." defaultValue="True" /><Return return_type={ <>list[ <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable ]</> } description="A list of Editable objects representing matched text nodes in the codebase."/>
Convert a comment group into a Google-style docstring.
PyFunction } description="The Python function whose signature will be used to extract parameter and return type information." defaultValue="" /><Return return_type={ str } description="A formatted Google-style docstring string that includes the function's description, parameters, and return value information."/>