From af6530819f220b41e443815c4b445d1b9aac4cb2 Mon Sep 17 00:00:00 2001 From: "F. Muenkel" <25496279+fmuenkel@users.noreply.github.com> Date: Fri, 24 Jan 2025 20:08:57 +0100 Subject: [PATCH 1/3] Complete typing for logger_utils.py --- manim/_config/logger_utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/manim/_config/logger_utils.py b/manim/_config/logger_utils.py index 9205635eef..427cf41ca0 100644 --- a/manim/_config/logger_utils.py +++ b/manim/_config/logger_utils.py @@ -16,7 +16,7 @@ import copy import json import logging -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any from rich import color, errors from rich import print as printf @@ -91,7 +91,7 @@ def make_logger( # set the rich handler rich_handler = RichHandler( console=console, - show_time=parser.getboolean("log_timestamps"), + show_time=parser.getboolean("log_timestamps", fallback=False), keywords=HIGHLIGHTED_KEYWORDS, ) @@ -108,7 +108,7 @@ def make_logger( return logger, console, error_console -def parse_theme(parser: configparser.SectionProxy) -> Theme: +def parse_theme(parser: configparser.SectionProxy) -> Theme | None: """Configure the rich style of logger and console output. Parameters @@ -126,7 +126,7 @@ def parse_theme(parser: configparser.SectionProxy) -> Theme: :func:`make_logger`. """ - theme = {key.replace("_", "."): parser[key] for key in parser} + theme: dict[str, Any] = {key.replace("_", "."): parser[key] for key in parser} theme["log.width"] = None if theme["log.width"] == "-1" else int(theme["log.width"]) theme["log.height"] = ( @@ -188,8 +188,11 @@ def format(self, record: logging.LogRecord) -> str: """Format the record in a custom JSON format.""" record_c = copy.deepcopy(record) if record_c.args: - for arg in record_c.args: - record_c.args[arg] = "<>" + if isinstance(record_c.args, dict): + for arg in record_c.args: + record_c.args[arg] = "<>" + else: + record_c.args = ("<>",) * len(record_c.args) return json.dumps( { "levelname": record_c.levelname, From 5970c6754e5d9c2352cba618e3f392b576804d40 Mon Sep 17 00:00:00 2001 From: "F. Muenkel" <25496279+fmuenkel@users.noreply.github.com> Date: Wed, 26 Mar 2025 02:15:05 -0300 Subject: [PATCH 2/3] Stop ignoring manim._config erros in mypy.ini --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 80571869be..e10653a13d 100644 --- a/mypy.ini +++ b/mypy.ini @@ -49,7 +49,7 @@ warn_return_any = True # disable_recursive_aliases = True [mypy-manim._config.*] -ignore_errors = True +ignore_errors = False disable_error_code = return-value [mypy-manim.animation.*] From 762859c56d52d95328905b816fc881c66cdcd885 Mon Sep 17 00:00:00 2001 From: "F. Muenkel" <25496279+fmuenkel@users.noreply.github.com> Date: Thu, 22 May 2025 21:34:11 -0300 Subject: [PATCH 3/3] Ignore manim._config errors in mypy.ini --- mypy.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index e10653a13d..4b5f718509 100644 --- a/mypy.ini +++ b/mypy.ini @@ -49,9 +49,12 @@ warn_return_any = True # disable_recursive_aliases = True [mypy-manim._config.*] -ignore_errors = False +ignore_errors = True disable_error_code = return-value +[mypy-manim._config.logger_utils] +ignore_errors = False + [mypy-manim.animation.*] ignore_errors = True