code styling

This commit is contained in:
Oscar Krause 2025-04-16 14:18:04 +02:00
parent 1d3255188e
commit cd5c2a6cb1

View File

@ -94,14 +94,17 @@ class DriverMatrix:
self.log = logging.getLogger(self.__class__.__name__) self.log = logging.getLogger(self.__class__.__name__)
if DriverMatrix.__DRIVER_MATRIX is None: if DriverMatrix.__DRIVER_MATRIX is None:
try: self.__load()
file = open(DriverMatrix.__DRIVER_MATRIX_FILENAME)
DriverMatrix.__DRIVER_MATRIX = json_load(file) def __load(self):
file.close() try:
self.log.debug(f'Successfully loaded "{DriverMatrix.__DRIVER_MATRIX_FILENAME}".') file = open(DriverMatrix.__DRIVER_MATRIX_FILENAME)
except Exception as e: DriverMatrix.__DRIVER_MATRIX = json_load(file)
DriverMatrix.__DRIVER_MATRIX = {} # init empty dict to not try open file everytime, just when restarting app file.close()
# self.log.warning(f'Failed to load "{NV.__DRIVER_MATRIX_FILENAME}": {e}') self.log.debug(f'Successfully loaded "{DriverMatrix.__DRIVER_MATRIX_FILENAME}".')
except Exception as e:
DriverMatrix.__DRIVER_MATRIX = {} # init empty dict to not try open file everytime, just when restarting app
# self.log.warning(f'Failed to load "{NV.__DRIVER_MATRIX_FILENAME}": {e}')
@staticmethod @staticmethod
def find(version: str) -> dict | None: def find(version: str) -> dict | None: