Inherits from
CodeBlock, Expression, EditableAttributes
assignment_statements
assignments
attributes
comments
extended
extended_source
file
filepath
function_calls
if_blocks
level
local_var_assignments
parent
parent_block
parent_class
parent_function
parent_statement
resolved_value
return_statements
source
statements
symbol_statements
variable_usages
with_statements
Methods
ancestors
Find all ancestors of the node of the given type. Does not return itselfedit
Replace the source of thisEditable with new_src.
find
Find and return matching nodes or substrings within an Editable instance.find_string_literals
Returns a list of string literals within this node’s source that match any of the givenflag
Adds a visual flag comment to the end of this Editable’s source text.get_assignments
Returns a list of assignments with the specified variable name.get_attributes
Returns attributes from the code block, with the option to include or exclude privateget_comment
Gets the first comment statement containing a specific text string.get_local_var_assignment
Returns the first code statement that assigns a local variable with the specified name.get_local_var_assignments
Returns all instances of local variable assignments that match the specified variableget_statements
Returns all statements of a given type up to the specified block level.get_variable_usages
Returns all instances of variable usages in a code block.get_with_statements
Gets with statements at a specific block level.indent
Adjusts the indentation level of the entire code block.insert_after
Inserts source code at the bottom of the code block.insert_before
Inserts new source code at the top of the code block.is_child_of
Checks if this node is a descendant of the given editable instance in the AST.is_wrapped_in
Check if this node is contained another node of the given classparent_of_type
Find the first ancestor of the node of the given type. Does not return itselfparent_of_types
Find the first ancestor of the node of the given type. Does not return itselfreduce_condition
Reduces an editable to the following conditionremove
Deletes this Node and its related extended nodes (e.g. decorators, comments).rename_variable_usages
Renames all instances of variable usages in the code block.replace
Search and replace occurrences of text within this node’s source and its extended nodes.search
Returns a list of all regex match ofregex_pattern, similar to python’s re.search().