INNER CODE UNIT · Python
recorrer_archivos_de_texto
Hainrixz/whatsapp-agentkit · scripts/audit.py:151
def recorrer_archivos_de_texto(raiz: Path, excluir: set[Path]) -> list[Path]:
"""
Devuelve todos los archivos de texto del repo, salteando carpetas ignoradas,
binarios y las rutas de `excluir` (rutas ABSOLUTAS ya resueltas).
"""
encontrados: list[Path] = []
for carpeta, subcarpetas, archivos in os.walk(raiz):
subcarpetas[:] = [d for d in subcarpetas if d not in DIRS_IGNORADOS]
carpeta_path = Path(carpeta)
for nombre in archivos:
ruta = carpeta_path / nombre
try:
absoluta = ruta.resolve()
except OSError:
continue
# Comparacion por ruta absoluta: nunca por substring del nombre,
# asi este mismo script no se auto-reporta ni excluye a otros.
if absoluta in excluir: