def search_and_replace_file()

in assets/scripts/setup.py [0:0]


def search_and_replace_file(file_path: str, search_pattern: str, new_line: str):
    try:
        with open(file_path, "r", encoding="utf-8") as f:
            file_content = f.read()
            updated_content = re.sub(search_pattern, new_line, file_content)
        with open(file_path, "w", encoding="utf-8") as f:
            f.write(updated_content)
        f.close()
    except FileNotFoundError:
        print(f"`{file_path}` file not found.")