mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
feat: Count and display copied exercises per language
This commit is contained in:
parent
8f84df44ab
commit
7410c6216c
1 changed files with 7 additions and 4 deletions
|
@ -255,11 +255,11 @@ def analyze_exercise_solutions(dirs=None, topn=None, copy_hard_set=False):
|
||||||
hard_set_pairs = {tuple(exercise.split("/")) 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
|
copied_by_lang = defaultdict(int)
|
||||||
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
|
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, lang) in hard_set_pairs:
|
if (problem_dir.name, lang) in hard_set_pairs:
|
||||||
|
@ -267,9 +267,12 @@ def analyze_exercise_solutions(dirs=None, topn=None, copy_hard_set=False):
|
||||||
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
|
copied_by_lang[lang] += 1
|
||||||
|
|
||||||
print(f"Copied {num_copied} hard set problems")
|
total_copied = sum(copied_by_lang.values())
|
||||||
|
print(f"\nCopied {total_copied} hard set problems:")
|
||||||
|
for lang in sorted(copied_by_lang):
|
||||||
|
print(f" {lang}: {copied_by_lang[lang]}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue