INNER CODE UNIT · Python

data

i3T4AN/KADATH · kadath/engine.py:118

                data = stream.read(1024 * 1024)
                if not data: break
                size += len(data); hasher.update(data)
        return size, hasher.hexdigest()
    finally:
        os.close(descriptor)


def copy_tree_without_symlinks(source: Path, destination: Path) -> None:
    destination.mkdir(parents=True, exist_ok=True)
    for item in sorted(source.rglob("*")):
        try: mode = item.lstat().st_mode
        except OSError: continue
        if stat.S_ISLNK(mode): continue
        target = destination / item.relative_to(source)
        if stat.S_ISDIR(mode): target.mkdir(parents=True, exist_ok=True)
        elif stat.S_ISREG(mode):
            target.parent.mkdir(parents=True, exist_ok=True); shutil.copy2(item, target, follow_symlinks=False)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…