"""Intended to traverse through a user's given file content and find, collect all appropriate lines that should be sent to the REPL in case of smart selection.
This could be exact statement such as just a single line print statement,
or a multiline dictionary, or differently styled multi-line list comprehension, etc.
Then call the normalize_lines function to normalize our smartly selected code block.
"""
parsed_file_content=None
try:
parsed_file_content=ast.parse(whole_file_content)
exceptException:
# Handle case where user is attempting to run code where file contains deprecated Python code.
# Let typescript side know and show warning message.
return {
"normalized_smart_result": "deprecated",
"which_line_next": 0,
}
smart_code=""
should_run_top_blocks= []
# Purpose of this loop is to fetch and collect all the
# AST top level nodes, and its node.body as child nodes.
# Individual nodes will contain information like
# the start line, end line and get source segment information
# that will be used to smartly select, and send normalized code.