Skip to content

Commit

Permalink
fixed intendations
Browse files Browse the repository at this point in the history
  • Loading branch information
aashankhan2981 committed Aug 13, 2024
1 parent 92becce commit 97fafdf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
1 change: 1 addition & 0 deletions core/agents/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down
35 changes: 19 additions & 16 deletions core/state/state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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.
Expand Down
15 changes: 9 additions & 6 deletions core/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]):
Expand Down
5 changes: 2 additions & 3 deletions core/ui/ipc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 97fafdf

Please sign in to comment.