mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-05 20:25:01 +00:00
refac
This commit is contained in:
parent
3ecf008478
commit
43b79b0c2d
2 changed files with 26 additions and 12 deletions
|
@ -3,6 +3,9 @@ import math
|
|||
|
||||
from difflib import SequenceMatcher
|
||||
from pathlib import Path
|
||||
from pygments.util import ClassNotFound
|
||||
from pygments.lexers import guess_lexer_for_filename
|
||||
from pygments.token import Token
|
||||
|
||||
# from aider.dump import dump
|
||||
|
||||
|
@ -263,6 +266,17 @@ def find_original_update_blocks(content):
|
|||
raise ValueError(f"{processed}\n^^^ Error parsing ORIGINAL/UPDATED block.")
|
||||
|
||||
|
||||
def get_name_identifiers(fname):
|
||||
with open(fname, "r") as f:
|
||||
content = f.read()
|
||||
try:
|
||||
lexer = guess_lexer_for_filename(fname, content)
|
||||
except ClassNotFound:
|
||||
return list()
|
||||
tokens = list(lexer.get_tokens(content))
|
||||
return set(token[1] for token in tokens if token[0] in Token.Name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
edit = """
|
||||
Here's the change:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue