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:
Paul Gauthier 2024-05-18 19:36:23 -07:00
parent 9e0f20bb9a
commit d8f3d155e6

View file

@ -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():
"""