import sys
import os
# Add the pipeline/ directory to sys.path
script_dir = os.path.dirname(os.path.abspath(__file__))
pipeline_root = os.path.abspath(os.path.join(script_dir, ".."))
sys.path.insert(0, pipeline_root)

from app.agents.patch_utils import fix_function_body_indentation





def test():
    func_sig = """    def label(
        self,
        formatter: Formatter | None = None, *,
        like: str | Callable | None = None,
        base: int | None | Default = default,
        unit: str | None = None,
    ) -> Continuous:"""
    
    with open('REPOCOD/Tasks4Agents/seaborn/seaborn_0/output/seaborn_0_2025-06-03_10-18-15/output_0/patch_raw_3.md', 'r') as f:
        raw_patch = f.read()
    
    corrected_func_body = fix_function_body_indentation(func_sig, raw_patch)
    print(func_sig)
    print(corrected_func_body)

if __name__ == "__main__":
    test()
    # exp_str = '    def label('
    # print(exp_str.index('def '))