From a115e594c0f8f7f67b838b57f52ee3b349d30ae1 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 20 May 2024 08:56:21 -0700 Subject: [PATCH] Add import statement for 're' module and fix regex pattern in linter.py. --- aider/linter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/linter.py b/aider/linter.py index 1435b4113..b2e2fd2b4 100644 --- a/aider/linter.py +++ b/aider/linter.py @@ -3,6 +3,7 @@ import subprocess import sys import traceback import warnings +import re from dataclasses import dataclass from pathlib import Path @@ -93,7 +94,6 @@ class Linter: return res def py_lint(self, fname, rel_fname, code): - result = "" basic_res = basic_lint(rel_fname, code) compile_res = lint_python_compile(fname, code) @@ -210,7 +210,7 @@ import re def find_filenames_and_linenums(text, fnames): """ - Search text for all occurrences of :\d+ and make a list of them + Search text for all occurrences of :\\d+ and make a list of them where 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)")