style: fix linting issues in watch.py

This commit is contained in:
Paul Gauthier (aider) 2024-12-01 07:22:16 -08:00
parent bb1b3fdca1
commit 78c20a8c25

View file

@ -59,6 +59,7 @@ def load_gitignores(gitignore_paths: list[Path]) -> Optional[PathSpec]:
return PathSpec.from_lines(GitWildMatchPattern, patterns) if patterns else None return PathSpec.from_lines(GitWildMatchPattern, patterns) if patterns else None
class FileWatcher: class FileWatcher:
"""Watches source files for changes and AI comments""" """Watches source files for changes and AI comments"""
@ -175,13 +176,16 @@ class FileWatcher:
has_bangs = any( has_bangs = any(
comment.strip().endswith("!") comment.strip().endswith("!")
for comments in self.changed_files.values() for comments in self.changed_files.values()
if comments for comment in comments if comments
for comment in comments
) )
if not has_bangs: if not has_bangs:
return "" return ""
res = "\n".join(comment for comments in self.changed_files.values() if comments for comment in comments) res = "\n".join(
comment for comments in self.changed_files.values() if comments for comment in comments
)
res = """The "ai" comments below can be found in the code above. res = """The "ai" comments below can be found in the code above.
They contain your instructions. They contain your instructions.
Make the requested changes. Make the requested changes.