INNER CODE UNIT · Python

repair_tree

dedsec1121fk/DedSec · Compat/repair_unicode_names.py:27

def repair_tree(root: Path) -> tuple[int, int]:
    repaired = 0
    skipped = 0

    # Rename deepest paths first so children remain reachable while parents move.
    candidates = [p for p in root.rglob("*") if TOKEN_RE.search(p.name)]
    candidates.sort(key=lambda p: len(p.parts), reverse=True)

    for path in candidates:
        if not path.exists():
            continue
        decoded = decode_component(path.name)
        if decoded == path.name:
            continue
        target = path.with_name(decoded)
        if target.exists():
            print(
                f"[unicode-repair] Skipped collision: {path} -> {target}",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…