From 876d46b719297c7bec9283cdb540a4d859d734f2 Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Fri, 24 Sep 2021 15:29:57 +0200 Subject: [PATCH] Nicer output --- papi/main.py | 3 +-- papi/utils.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/papi/main.py b/papi/main.py index 26ad98d..1379188 100644 --- a/papi/main.py +++ b/papi/main.py @@ -77,8 +77,7 @@ def historique(idsonde): if diff: for d in diff["changements"]: - line = date, *d - print(line) + line = date, *utils.clean_state(d) yield " ".join(line) else: print(f"no change for {date}") diff --git a/papi/utils.py b/papi/utils.py index fbc646e..9afaf2f 100644 --- a/papi/utils.py +++ b/papi/utils.py @@ -54,6 +54,11 @@ def compare(channels, previous, current): return res +def clean_state(state): + # Ote l'identifiant en début de chaine + return state[0].split("#", 1)[1], *state[1:] + + def list_channels(p, c): all_channels = sorted(set((*p["channels"], *c["channels"]))) return all_channels