mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
style: fix import order and whitespace per linting rules
This commit is contained in:
parent
45e95d1d00
commit
e5fe5199a3
1 changed files with 9 additions and 8 deletions
|
@ -1,9 +1,9 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Set, Optional
|
from typing import Optional, Set
|
||||||
|
|
||||||
from watchfiles import watch
|
|
||||||
from pathspec import PathSpec
|
from pathspec import PathSpec
|
||||||
from pathspec.patterns import GitWildMatchPattern
|
from pathspec.patterns import GitWildMatchPattern
|
||||||
|
from watchfiles import watch
|
||||||
|
|
||||||
|
|
||||||
def is_source_file(path: Path) -> bool:
|
def is_source_file(path: Path) -> bool:
|
||||||
|
@ -46,24 +46,25 @@ def load_gitignore(gitignore_path: Path) -> Optional[PathSpec]:
|
||||||
"""Load and parse a .gitignore file"""
|
"""Load and parse a .gitignore file"""
|
||||||
if not gitignore_path.exists():
|
if not gitignore_path.exists():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
with open(gitignore_path) as f:
|
with open(gitignore_path) as f:
|
||||||
patterns = f.readlines()
|
patterns = f.readlines()
|
||||||
|
|
||||||
return PathSpec.from_lines(GitWildMatchPattern, patterns)
|
return PathSpec.from_lines(GitWildMatchPattern, patterns)
|
||||||
|
|
||||||
|
|
||||||
def watch_source_files(directory: str, gitignore: str = None) -> Set[str]:
|
def watch_source_files(directory: str, gitignore: str = None) -> Set[str]:
|
||||||
"""
|
"""
|
||||||
Watch for changes to source files in the given directory and its subdirectories.
|
Watch for changes to source files in the given directory and its subdirectories.
|
||||||
Returns a set of changed file paths whenever changes are detected.
|
Returns a set of changed file paths whenever changes are detected.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
directory: Root directory to watch
|
directory: Root directory to watch
|
||||||
gitignore: Path to .gitignore file (optional)
|
gitignore: Path to .gitignore file (optional)
|
||||||
"""
|
"""
|
||||||
root = Path(directory)
|
root = Path(directory)
|
||||||
gitignore_spec = None
|
gitignore_spec = None
|
||||||
|
|
||||||
if gitignore:
|
if gitignore:
|
||||||
gitignore_spec = load_gitignore(Path(gitignore))
|
gitignore_spec = load_gitignore(Path(gitignore))
|
||||||
|
|
||||||
|
@ -83,9 +84,9 @@ def watch_source_files(directory: str, gitignore: str = None) -> Set[str]:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Example usage of the file watcher"""
|
"""Example usage of the file watcher"""
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Watch source files for changes")
|
parser = argparse.ArgumentParser(description="Watch source files for changes")
|
||||||
parser.add_argument("directory", help="Directory to watch")
|
parser.add_argument("directory", help="Directory to watch")
|
||||||
parser.add_argument("--gitignore", help="Path to .gitignore file")
|
parser.add_argument("--gitignore", help="Path to .gitignore file")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue