Tidying logging and comments
This commit is contained in:
parent
2ca5a86030
commit
dfe5e5830b
@ -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:
|
||||
|
Reference in New Issue
Block a user