From 97fafdf5d58dcea587015af323f8f43437996f05 Mon Sep 17 00:00:00 2001 From: aashankhan2981 Date: Tue, 13 Aug 2024 22:03:41 +0500 Subject: [PATCH] fixed intendations --- core/agents/orchestrator.py | 1 + core/state/state_manager.py | 35 +++++++++++++++++++---------------- core/ui/base.py | 15 +++++++++------ core/ui/ipc_client.py | 5 ++--- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/core/agents/orchestrator.py b/core/agents/orchestrator.py index 457eb83e7..c9ebc25c6 100644 --- a/core/agents/orchestrator.py +++ b/core/agents/orchestrator.py @@ -102,6 +102,7 @@ async def offline_changes_check(self): "Clicking 'No' means Pythagora will restore (overwrite) all files to the last stored state.\n", ] ) + use_changes = await self.ask_question( question="Would you like to keep your changes?", buttons={ diff --git a/core/state/state_manager.py b/core/state/state_manager.py index 0e3c16adc..8d15b4964 100644 --- a/core/state/state_manager.py +++ b/core/state/state_manager.py @@ -495,13 +495,13 @@ async def get_modified_files(self) -> list[str]: modified_files.append(db_file.path) return modified_files - + async def get_modified_files_with_content(self) -> list[dict]: """ - Return a list of new or modified files from the file system, + Return a list of new or modified files from the file system, including their paths, old content, and new content. - :return: List of dictionaries containing paths, old content, + :return: List of dictionaries containing paths, old content, and new content for new or modified files. """ @@ -514,28 +514,31 @@ async def get_modified_files_with_content(self) -> list[dict]: # If there's a saved file, serialize its content; otherwise, set it to None saved_file_content = saved_file.content.content if saved_file else None - if saved_file_content == content: continue - - modified_files.append({ - "path": path, - "file_old": saved_file_content, # Serialized content - "file_new": content - }) + + modified_files.append( + { + "path": path, + "file_old": saved_file_content, # Serialized content + "file_new": content, + } + ) # Handle files removed from disk await self.current_state.awaitable_attrs.files for db_file in self.current_state.files: if db_file.path not in files_in_workspace: - modified_files.append({ - "path": db_file.path, - "file_old": db_file.content.content, # Serialized content - "file_new": "" # Empty string as the file is removed - }) + modified_files.append( + { + "path": db_file.path, + "file_old": db_file.content.content, # Serialized content + "file_new": "", # Empty string as the file is removed + } + ) return modified_files - + def workspace_is_empty(self) -> bool: """ Returns whether the workspace has any files in them or is empty. diff --git a/core/ui/base.py b/core/ui/base.py index 919fd5413..86b438d4d 100644 --- a/core/ui/base.py +++ b/core/ui/base.py @@ -230,16 +230,18 @@ async def send_step_progress( :param task_source: Source of the task, one of: 'app', 'feature', 'debugger', 'troubleshooting', 'review'. """ raise NotImplementedError() + async def send_modified_files( self, - modified_files: dict[str, str,str], + modified_files: dict[str, str, str], ): - """ - Send a list of modified files to the UI. + """ + Send a list of modified files to the UI. + + :param modified_files: List of modified files. + """ + raise NotImplementedError() - :param modified_files: List of modified files. - """ - raise NotImplementedError() async def send_run_command(self, run_command: str): """ Send a run command to the UI. @@ -299,6 +301,7 @@ async def send_project_description(self, description: str): :param description: Project description. """ + raise NotImplementedError() async def send_features_list(self, features: list[str]): diff --git a/core/ui/ipc_client.py b/core/ui/ipc_client.py index ff9634f1f..07a6e7980 100644 --- a/core/ui/ipc_client.py +++ b/core/ui/ipc_client.py @@ -312,15 +312,14 @@ async def send_task_progress( "all_tasks": tasks, }, ) + async def send_modified_files( self, modified_files: dict[str, str, str], ): await self._send( MessageType.MODIFIED_FILES, - content={ - "files": modified_files - }, + content={"files": modified_files}, ) async def send_step_progress(