From da713fcdac9d2c32ed6b60b788de31a765c1644a Mon Sep 17 00:00:00 2001 From: Jostein Solaas <33114722+jsolaas@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:16:06 +0200 Subject: [PATCH] chore: enable mypy for cli (#189) --- .pre-commit-config.yaml | 2 +- src/ecalc/cli/cli/logger.py | 4 ++-- src/ecalc/cli/cli/types.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b001491e7a..609ad370ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: rev: v1.4.1 hooks: - id: mypy - files: ^(src/ecalc/libraries/) + files: ^(src/ecalc/) exclude: tests|conftest.py args: ['--config-file=./pyproject.toml'] additional_dependencies: diff --git a/src/ecalc/cli/cli/logger.py b/src/ecalc/cli/cli/logger.py index 6f2beb5f0c..308e785b43 100644 --- a/src/ecalc/cli/cli/logger.py +++ b/src/ecalc/cli/cli/logger.py @@ -4,7 +4,7 @@ from datetime import date from logging.config import dictConfig from pathlib import Path -from typing import Optional +from typing import Any, Dict, Optional class LogLevel(str, enum.Enum): @@ -57,7 +57,7 @@ def set_log_path(self, log_path: Path): self.__configure_logger() def __configure_logger(self): - log_config = { + log_config: Dict[str, Any] = { "version": 1, "disable_existing_loggers": True, # ie keep root logger ++ "formatters": { diff --git a/src/ecalc/cli/cli/types.py b/src/ecalc/cli/cli/types.py index 1e9e1575f7..8875050e8a 100644 --- a/src/ecalc/cli/cli/types.py +++ b/src/ecalc/cli/cli/types.py @@ -16,4 +16,4 @@ class DateFormat(str, enum.Enum): """DD_MM_YYYY""" -Frequency = enum.Enum("Frequency", {e.name: e.name for e in time_utils.Frequency}) +Frequency = enum.Enum("Frequency", {e.name: e.name for e in time_utils.Frequency}) # type: ignore