This provides the necessary information to fix indentation when things
get moved around. E.g, if I want to move a node out of an "if" block to
the previous level, I need to know the indentation level of the outer
block and the indentation level of the inner statement so that the
prefixes can be corrected. The operations to make these corrections are
NOT included in this change, only the information is stored.
In addition, I'm changing how the block suffix is stored. Instead of
considering only one block suffix for a node, we'll store a block suffix
per suite that it contains. So, If nodes with an "else" else condition
will have a "block_suffix_body" and "block_suffix_orelse".
In a small related change, when retrieving formatting data,
ast_utils.prop(node, attr) will return None if the attribute is not
defined instead of an empty string.
This provides the necessary information to fix indentation when things get moved around. E.g, if I want to move a node out of an "if" block to the previous level, I need to know the indentation level of the outer block and the indentation level of the inner statement so that the prefixes can be corrected. The operations to make these corrections are NOT included in this change, only the information is stored.
In addition, I'm changing how the block suffix is stored. Instead of considering only one block suffix for a node, we'll store a block suffix per suite that it contains. So,
If
nodes with an "else" else condition will have a "block_suffix_body" and "block_suffix_orelse".In a small related change, when retrieving formatting data,
ast_utils.prop(node, attr)
will returnNone
if the attribute is not defined instead of an empty string.