mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
aider: Refactored the code to turn the matches into a list of (filename, linenum)
pairs.
# Aider chat conversation: USER: turn the matches into a list of (filename, linenum) where linenum is int ASSISTANT: Here is the *SEARCH/REPLACE* block to turn the matches into a list of `(filename, linenum)` where `linenum` is an integer: aider/linter.py ```python <<<<<<< SEARCH return matches ======= result = [] for match in matches: fname, linenum = match.rsplit(':', 1) result.append((fname, int(linenum))) return result >>>>>>> REPLACE ```
This commit is contained in:
parent
9e0f20bb9a
commit
d8f3d155e6
1 changed files with 5 additions and 1 deletions
|
@ -171,7 +171,11 @@ def find_filenames_and_linenums(text, fnames):
|
|||
"""
|
||||
pattern = re.compile(r'(\b(?:' + '|'.join(re.escape(fname) for fname in fnames) + r'):\d+\b)')
|
||||
matches = pattern.findall(text)
|
||||
return matches
|
||||
result = []
|
||||
for match in matches:
|
||||
fname, linenum = match.rsplit(':', 1)
|
||||
result.append((fname, int(linenum)))
|
||||
return result
|
||||
|
||||
def main():
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue