style: fix linting issues and format code

This commit is contained in:
Paul Gauthier (aider) 2024-10-25 16:10:56 -07:00
parent 0890b32425
commit ed2a2d7dc3
2 changed files with 6 additions and 14 deletions

View file

@ -378,7 +378,7 @@ class InputOutput:
if changed: if changed:
self.changed_files = changed self.changed_files = changed
#ai move all this ... # ai move all this ...
self.changed_files = process_file_changes(changed) self.changed_files = process_file_changes(changed)
self.interrupt_input() self.interrupt_input()
break break
@ -447,7 +447,7 @@ class InputOutput:
# Check if we were interrupted by a file change # Check if we were interrupted by a file change
if self.changed_files: if self.changed_files:
#ai ...down to here! # ai ...down to here!
changed = " ".join(self.changed_files) changed = " ".join(self.changed_files)
self.changed_files = None self.changed_files = None

View file

@ -135,24 +135,16 @@ def watch_source_files(
result[file] = comments result[file] = comments
yield result yield result
def process_file_changes(changed): def process_file_changes(changed):
"""Process file changes and handle special ! comments""" """Process file changes and handle special ! comments"""
if any( if any("!" in comment for comments in changed.values() if comments for comment in comments):
"!" in comment
for comments in changed.values()
if comments
for comment in comments
):
return [ return [
"\n".join( "\n".join(comment for comments in changed.values() if comments for comment in comments)
comment
for comments in changed.values()
if comments
for comment in comments
)
] ]
return list(changed.keys()) return list(changed.keys())
def get_ai_comment(filepath, encoding="utf-8"): def get_ai_comment(filepath, encoding="utf-8"):
"""Extract all AI comments from a file""" """Extract all AI comments from a file"""
comments = [] comments = []