mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
refac
This commit is contained in:
parent
4c745c3cdd
commit
1239d3e30c
1 changed files with 12 additions and 21 deletions
|
@ -9,13 +9,10 @@ from aider.coders import Coder
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
|
|
||||||
# from git import Repo
|
|
||||||
|
|
||||||
|
|
||||||
# from tempfile import TemporaryDirectory
|
# from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
|
|
||||||
def create_temp_repo(dirname, tempdir):
|
def copy_exercise(dirname, tempdir):
|
||||||
# Copy all files from dirname to tempdir
|
# Copy all files from dirname to tempdir
|
||||||
for item in os.listdir(dirname):
|
for item in os.listdir(dirname):
|
||||||
s = os.path.join(dirname, item)
|
s = os.path.join(dirname, item)
|
||||||
|
@ -31,17 +28,6 @@ def create_temp_repo(dirname, tempdir):
|
||||||
if "test" not in file and os.path.isfile(full_path):
|
if "test" not in file and os.path.isfile(full_path):
|
||||||
add_files.append(file)
|
add_files.append(file)
|
||||||
|
|
||||||
"""
|
|
||||||
# Create a new git repo in tempdir
|
|
||||||
repo = Repo.init(tempdir)
|
|
||||||
|
|
||||||
for rel_path in add_files:
|
|
||||||
repo.git.add(rel_path)
|
|
||||||
|
|
||||||
# Commit with message "initial"
|
|
||||||
repo.git.commit(m="initial")
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Copy .docs subdir to tempdir as 'docs'
|
# Copy .docs subdir to tempdir as 'docs'
|
||||||
docs_src = os.path.join(dirname, ".docs")
|
docs_src = os.path.join(dirname, ".docs")
|
||||||
docs_dst = os.path.join(tempdir, "docs")
|
docs_dst = os.path.join(tempdir, "docs")
|
||||||
|
@ -50,14 +36,22 @@ def create_temp_repo(dirname, tempdir):
|
||||||
return add_files
|
return add_files
|
||||||
|
|
||||||
|
|
||||||
def main(tempdir):
|
def main():
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print("Usage: python benchmark.py <dirname>")
|
print("Usage: python benchmark.py <dirname>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
dirname = sys.argv[1]
|
dirname = sys.argv[1]
|
||||||
|
|
||||||
fnames = create_temp_repo(dirname, tempdir)
|
# with TemporaryDirectory() as tempdir:
|
||||||
|
tempdir = "tmp.benchmark"
|
||||||
|
os.mkdir(tempdir)
|
||||||
|
|
||||||
|
run_test(dirname, tempdir)
|
||||||
|
|
||||||
|
|
||||||
|
def run_test(dirname, tempdir):
|
||||||
|
fnames = copy_exercise(dirname, tempdir)
|
||||||
os.chdir(tempdir)
|
os.chdir(tempdir)
|
||||||
|
|
||||||
instructions = Path("docs/instructions.md").read_text()
|
instructions = Path("docs/instructions.md").read_text()
|
||||||
|
@ -105,7 +99,4 @@ def run_tests():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# with TemporaryDirectory() as tempdir:
|
main()
|
||||||
tempdir = "tmp.benchmark"
|
|
||||||
os.mkdir(tempdir)
|
|
||||||
main(tempdir)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue