mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
Add import statement for 're' module and fix regex pattern in linter.py.
This commit is contained in:
parent
9c28bbc98e
commit
a115e594c0
1 changed files with 2 additions and 2 deletions
|
@ -3,6 +3,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import warnings
|
import warnings
|
||||||
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -93,7 +94,6 @@ class Linter:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def py_lint(self, fname, rel_fname, code):
|
def py_lint(self, fname, rel_fname, code):
|
||||||
result = ""
|
|
||||||
basic_res = basic_lint(rel_fname, code)
|
basic_res = basic_lint(rel_fname, code)
|
||||||
compile_res = lint_python_compile(fname, code)
|
compile_res = lint_python_compile(fname, code)
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ import re
|
||||||
|
|
||||||
def find_filenames_and_linenums(text, fnames):
|
def find_filenames_and_linenums(text, fnames):
|
||||||
"""
|
"""
|
||||||
Search text for all occurrences of <filename>:\d+ and make a list of them
|
Search text for all occurrences of <filename>:\\d+ and make a list of them
|
||||||
where <filename> is one of the filenames in the list `fnames`.
|
where <filename> is one of the filenames in the list `fnames`.
|
||||||
"""
|
"""
|
||||||
pattern = re.compile(r"(\b(?:" + "|".join(re.escape(fname) for fname in fnames) + r"):\d+\b)")
|
pattern = re.compile(r"(\b(?:" + "|".join(re.escape(fname) for fname in fnames) + r"):\d+\b)")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue