style: Format code with linter and improve readability

This commit is contained in:
Paul Gauthier (aider) 2025-03-11 17:31:22 -07:00
parent a7a21757bc
commit 1f874b654d

View file

@ -77,7 +77,7 @@ class Commands:
self.help = None self.help = None
self.editor = editor self.editor = editor
# Store the original read-only filenames provided via args.read # Store the original read-only filenames provided via args.read
self.original_read_only_fnames = set(original_read_only_fnames or []) self.original_read_only_fnames = set(original_read_only_fnames or [])
@ -359,14 +359,17 @@ class Commands:
def _drop_all_files(self): def _drop_all_files(self):
self.coder.abs_fnames = set() self.coder.abs_fnames = set()
# When dropping all files, keep those that were originally provided via args.read # When dropping all files, keep those that were originally provided via args.read
if hasattr(self, 'original_read_only_fnames') and self.original_read_only_fnames: if hasattr(self, "original_read_only_fnames") and self.original_read_only_fnames:
# Keep only the original read-only files # Keep only the original read-only files
to_keep = set() to_keep = set()
for abs_fname in self.coder.abs_read_only_fnames: for abs_fname in self.coder.abs_read_only_fnames:
rel_fname = self.coder.get_rel_fname(abs_fname) rel_fname = self.coder.get_rel_fname(abs_fname)
if abs_fname in self.original_read_only_fnames or rel_fname in self.original_read_only_fnames: if (
abs_fname in self.original_read_only_fnames
or rel_fname in self.original_read_only_fnames
):
to_keep.add(abs_fname) to_keep.add(abs_fname)
self.coder.abs_read_only_fnames = to_keep self.coder.abs_read_only_fnames = to_keep
else: else:
@ -838,7 +841,9 @@ class Commands:
if not args.strip(): if not args.strip():
if self.original_read_only_fnames: if self.original_read_only_fnames:
self.io.tool_output("Dropping all files from the chat session except originally read-only files.") self.io.tool_output(
"Dropping all files from the chat session except originally read-only files."
)
else: else:
self.io.tool_output("Dropping all files from the chat session.") self.io.tool_output("Dropping all files from the chat session.")
self._drop_all_files() self._drop_all_files()