Improve PEP8 adherance using flake8 linter

This commit is contained in:
Pim Nelissen
2026-02-05 14:19:49 +01:00
parent dcc3be1c22
commit c23ea40ec6
8 changed files with 117 additions and 81 deletions

View File

@ -3,18 +3,19 @@ import pathlib
import yaml
def setup_logger(log_level: str = "WARNING"):
levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
if not log_level in levels:
if log_level not in levels:
raise ValueError(f"Log level must be one of {levels}.")
base_dir = pathlib.Path(__file__).resolve().parent
config_file = base_dir / "configs" / "logging.yml"
with open(config_file) as f:
config = yaml.safe_load(f)
config["loggers"]["root"]["level"] = log_level
logging.config.dictConfig(config)
logging.config.dictConfig(config)