Arslan1997 commited on
Commit
a80a131
·
1 Parent(s): 5133bfc
Files changed (1) hide show
  1. scripts/format_response.py +6 -0
scripts/format_response.py CHANGED
@@ -659,6 +659,12 @@ def execute_code_from_markdown(code_str, datasets=None):
659
  # Clear captured outputs for each block
660
  captured_outputs.clear()
661
 
 
 
 
 
 
 
662
  with stdoutIO() as s:
663
  exec(block_code, context) # Execute the block
664
 
 
659
  # Clear captured outputs for each block
660
  captured_outputs.clear()
661
 
662
+ # Fix indentation issues before execution
663
+ try:
664
+ block_code = textwrap.dedent(block_code)
665
+ except Exception as dedent_error:
666
+ logger.log_message(f"Failed to dedent code block '{block_name}': {str(dedent_error)}", level=logging.WARNING)
667
+
668
  with stdoutIO() as s:
669
  exec(block_code, context) # Execute the block
670