mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
refactor: remove redundant encoding parameter from FileWatcher
This commit is contained in:
parent
78c20a8c25
commit
769a31b7e3
1 changed files with 3 additions and 4 deletions
|
@ -63,10 +63,9 @@ def load_gitignores(gitignore_paths: list[Path]) -> Optional[PathSpec]:
|
||||||
class FileWatcher:
|
class FileWatcher:
|
||||||
"""Watches source files for changes and AI comments"""
|
"""Watches source files for changes and AI comments"""
|
||||||
|
|
||||||
def __init__(self, coder, encoding="utf-8", gitignores=None, verbose=False):
|
def __init__(self, coder, gitignores=None, verbose=False):
|
||||||
self.coder = coder
|
self.coder = coder
|
||||||
self.io = coder.io
|
self.io = coder.io
|
||||||
self.encoding = encoding
|
|
||||||
self.root = Path(coder.root)
|
self.root = Path(coder.root)
|
||||||
self.verbose = verbose # or True
|
self.verbose = verbose # or True
|
||||||
self.stop_event = None
|
self.stop_event = None
|
||||||
|
@ -133,7 +132,7 @@ class FileWatcher:
|
||||||
changed_files = {str(Path(change[1])) for change in changes}
|
changed_files = {str(Path(change[1])) for change in changes}
|
||||||
result = {}
|
result = {}
|
||||||
for file in changed_files:
|
for file in changed_files:
|
||||||
if comments := self.get_ai_comment(file, encoding=self.encoding):
|
if comments := self.get_ai_comment(file):
|
||||||
result[file] = comments
|
result[file] = comments
|
||||||
|
|
||||||
self.changed_files.update(result)
|
self.changed_files.update(result)
|
||||||
|
@ -196,7 +195,7 @@ class FileWatcher:
|
||||||
dump(res)
|
dump(res)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_ai_comment(self, filepath, encoding="utf-8"):
|
def get_ai_comment(self, filepath):
|
||||||
"""Extract all AI comments from a file"""
|
"""Extract all AI comments from a file"""
|
||||||
comments = []
|
comments = []
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue