15 lines
633 B
Python
15 lines
633 B
Python
"""Utilidades compartidas por los módulos del pipeline."""
|
|||
|
|
|
||
|
|
import os
|
||
|
|
|
||
|
|
|
||
|
|
def ruta_carpeta(subcarpeta: str) -> str:
|
||
|
|
"""Retorna la ruta absoluta de ``subcarpeta`` relativa a la raíz del proyecto."""
|
||
|
|
return os.path.join(os.path.dirname(__file__), subcarpeta)
|
||
|
|
|
||
|
|
|
||
|
|
def log(msg: str, level: int = 1, last: bool = False) -> None:
|
||
|
|
"""Imprime ``msg`` con la indentación de árbol usada en el log del pipeline."""
|
||
|
|
branch = " └── " if last else " ├── "
|
||
|
|
pfx = {1: branch, 2: f" │ {branch}", 3: f" │ │ {branch}", 4: f" │ │ │ {branch}"}.get(level, branch)
|
||
|
|
print(f"{pfx}{msg}")
|