mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 20:35:00 +00:00
fix: Copy hard set problems by language and exercise
This commit is contained in:
parent
892fd5a6ef
commit
82f21b6734
1 changed files with 8 additions and 5 deletions
|
@ -251,22 +251,25 @@ def analyze_exercise_solutions(dirs=None, topn=None, copy_hard_set=False):
|
||||||
|
|
||||||
print(f"\nCopying hard set problems to {dst_dir}...")
|
print(f"\nCopying hard set problems to {dst_dir}...")
|
||||||
|
|
||||||
# Get the base names of hard set problems
|
# Create a set of (exercise, language) pairs from hard_set
|
||||||
hard_set_bases = {exercise.split("/")[0] for exercise in hard_set}
|
hard_set_pairs = {tuple(exercise.split("/")) for exercise in hard_set}
|
||||||
|
|
||||||
# Copy each hard set problem's directory
|
# Copy each hard set problem's directory
|
||||||
|
num_copied = 0
|
||||||
for lang_dir in src_dir.glob("*/exercises/practice"):
|
for lang_dir in src_dir.glob("*/exercises/practice"):
|
||||||
if not lang_dir.is_dir():
|
if not lang_dir.is_dir():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
lang = lang_dir.parts[-3] # Get language from path
|
||||||
for problem_dir in lang_dir.glob("*"):
|
for problem_dir in lang_dir.glob("*"):
|
||||||
if problem_dir.name in hard_set_bases:
|
if (problem_dir.name, lang) in hard_set_pairs:
|
||||||
rel_path = problem_dir.relative_to(src_dir)
|
rel_path = problem_dir.relative_to(src_dir)
|
||||||
dst_path = dst_dir / rel_path
|
dst_path = dst_dir / rel_path
|
||||||
dst_path.parent.mkdir(parents=True, exist_ok=True)
|
dst_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
shutil.copytree(problem_dir, dst_path)
|
shutil.copytree(problem_dir, dst_path)
|
||||||
|
num_copied += 1
|
||||||
|
|
||||||
print("Done copying hard set problems")
|
print(f"Copied {num_copied} hard set problems")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue