Linter fixes

This commit is contained in:
Orsiris de Jong 2023-01-28 19:42:38 +01:00
parent 6e9c8525e2
commit ca2602e60b

View file

@ -26,14 +26,13 @@ from ofunctions.process import kill_childs
import PySimpleGUI as sg import PySimpleGUI as sg
from npbackup.customization import ( from npbackup.customization import (
PYSIMPLEGUI_THEME, PYSIMPLEGUI_THEME,
OEM_ICON, OEM_ICON,
LICENSE_TEXT, LICENSE_TEXT,
LICENSE_FILE, LICENSE_FILE,
) )
import npbackup.configuration as configuration from npbackup import configuration
from npbackup.windows.task import create_scheduled_task from npbackup.windows.task import create_scheduled_task
from npbackup.gui.config import config_gui from npbackup.gui.config import config_gui
from npbackup.gui.main import main_gui from npbackup.gui.main import main_gui
@ -45,7 +44,8 @@ del sys.path[0]
# Nuitka compat, see https://stackoverflow.com/a/74540217 # Nuitka compat, see https://stackoverflow.com/a/74540217
try: try:
from charset_normalizer import md__mypyc # pylint: disable=W0611 (unused-import)
from charset_normalizer import md__mypyc # noqa
except ImportError: except ImportError:
pass pass
@ -86,8 +86,8 @@ def execution_logs(start_time: datetime) -> None:
log_level_reached = "errors" log_level_reached = "errors"
elif logger_worst_level >= 30: elif logger_worst_level >= 30:
log_level_reached = "warnings" log_level_reached = "warnings"
except: except AttributeError as exc:
pass logger.error("Cannot get worst log level reached: {}".format(exc))
logger.info( logger.info(
"ExecTime = {}, finished, state is: {}.".format( "ExecTime = {}, finished, state is: {}.".format(
end_time - start_time, log_level_reached end_time - start_time, log_level_reached
@ -97,7 +97,6 @@ def execution_logs(start_time: datetime) -> None:
def interface(): def interface():
global logger
global _DEBUG global _DEBUG
global _VERBOSE global _VERBOSE
global CONFIG_FILE global CONFIG_FILE
@ -223,7 +222,7 @@ This is free software, and you are welcome to redistribute it under certain cond
if args.license: if args.license:
try: try:
with open(LICENSE_FILE, "r") as file_handle: with open(LICENSE_FILE, "r", 'utf-8') as file_handle:
print(file_handle.read()) print(file_handle.read())
except OSError: except OSError:
print(LICENSE_TEXT) print(LICENSE_TEXT)