Refactored files structures
This commit is contained in:
parent
935e43487f
commit
3bb1aee4b4
1 changed files with 0 additions and 33 deletions
33
cleaner.py
33
cleaner.py
|
|
@ -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")
|
|
||||||
Loading…
Reference in a new issue