Refactored files structures

This commit is contained in:
fanilo 2025-12-31 09:23:54 +01:00
parent 935e43487f
commit 3bb1aee4b4

View file

@ -1,33 +0,0 @@
from pathlib import Path
def supprimer_lignes_logger(fichier: str) -> None:
path = Path(fichier)
lignes_filtrees = []
skip_block = False
parentheses_balance = 0
with path.open("r", encoding="utf-8") as f:
for ligne in f:
stripped = ligne.lstrip()
# Détection du début d'un appel logger
if not skip_block and stripped.startswith("logger"):
skip_block = True
parentheses_balance += ligne.count("(") - ligne.count(")")
continue
if skip_block:
parentheses_balance += ligne.count("(") - ligne.count(")")
if parentheses_balance <= 0:
skip_block = False
parentheses_balance = 0
continue
lignes_filtrees.append(ligne)
path.write_text("".join(lignes_filtrees), encoding="utf-8")
if __name__ == "__main__":
supprimer_lignes_logger("sage_connector.py")