From dfe5e5830b40486e2a7eb53434d30f69d93d1375 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 5 Jun 2023 21:04:20 +0100 Subject: [PATCH] Tidying logging and comments --- src/pis.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pis.py b/src/pis.py index b00810b..f9ddce8 100644 --- a/src/pis.py +++ b/src/pis.py @@ -27,13 +27,16 @@ def requiresUpdate(): with open(file_location, "r") as f: text = f.read() newHash = hashlib.md5(text.encode()).hexdigest() + log.out(f"pis.requiresUpdate: Existing PIS Hash: {currentHash}","INFO") + log.out(f"pis.requiresUpdate: New PIS hash: {newHash}", "INFO") if currentHash is None or newHash != currentHash: - log.out(f"pis.requiresUpdate: currentHash: {currentHash}, newHash: {newHash}", "INFO") + log.out("pis.requiredUpdate: PIS Data requires updating", "INFO") mongo.putMetaHash("pis", newHash) return True + log.out("pis.requiredUpdate: PIS Data is up to date", "INFO") return False -def load(): # Programatically add a `toc` field to each entry. +def load(): with open(file_location, "r") as data: try: pis = yaml.safe_load(data) @@ -64,13 +67,11 @@ def parse(codeList): def getTiploc(crs :str): CRS = crs.upper() - #log.out(f"pis.getTiploc: Finding TIPLOC for {CRS}") query = { '3ALPHA': CRS } try: res = mongo.query("stations", query) - #print(res) if 'TIPLOC' in res: return res['TIPLOC'] except Exception as e: