code styling

This commit is contained in:
Oscar Krause 2025-04-16 15:01:14 +02:00
parent 59645d1daf
commit cd4c3d379a

View File

@ -1,5 +1,4 @@
import logging import logging
from json import load as json_load
from datetime import datetime, UTC, timedelta from datetime import datetime, UTC, timedelta
from json import loads as json_loads from json import loads as json_loads
from os.path import join, dirname, isfile from os.path import join, dirname, isfile
@ -338,9 +337,8 @@ class DriverMatrix:
def __load(self): def __load(self):
try: try:
file = open(DriverMatrix.__DRIVER_MATRIX_FILENAME) with open(DriverMatrix.__DRIVER_MATRIX_FILENAME, 'r') as f:
DriverMatrix.__DRIVER_MATRIX = json_load(file) DriverMatrix.__DRIVER_MATRIX = json_loads(f.read())
file.close()
self.log.debug(f'Successfully loaded "{DriverMatrix.__DRIVER_MATRIX_FILENAME}".') self.log.debug(f'Successfully loaded "{DriverMatrix.__DRIVER_MATRIX_FILENAME}".')
except Exception as e: except Exception as e:
DriverMatrix.__DRIVER_MATRIX = {} # init empty dict to not try open file everytime, just when restarting app DriverMatrix.__DRIVER_MATRIX = {} # init empty dict to not try open file everytime, just when restarting app