From 2098a11eb13acb9e413c55604d8ca0f62e9649ec Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Fri, 13 Mar 2026 12:36:24 -0700 Subject: [PATCH] Fix: text parser get_parser forwards logging_group, drops progress_callback TextDocumentParser.__init__ accepts logging_group: object = None, same as RemoteDocumentParser. The old shim incorrectly dropped it; fix to forward it as a positional arg and only drop progress_callback. Add type annotations and from __future__ import annotations for consistency with the remote parser signals shim. Co-Authored-By: Claude Sonnet 4.6 --- src/paperless_text/signals.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/paperless_text/signals.py b/src/paperless_text/signals.py index cf74d1c0e..c2c337b3b 100644 --- a/src/paperless_text/signals.py +++ b/src/paperless_text/signals.py @@ -1,16 +1,20 @@ -def get_parser(*args, **kwargs): +from __future__ import annotations + +from typing import Any + + +def get_parser(*args: Any, **kwargs: Any) -> Any: from paperless.parsers.text import TextDocumentParser - # The new TextDocumentParser does not accept the legacy logging_group / - # progress_callback kwargs injected by the old signal-based consumer. - # These are dropped here; Phase 4 will replace this signal path with the - # new ParserRegistry so the shim can be removed at that point. - kwargs.pop("logging_group", None) + # The new TextDocumentParser does not accept the progress_callback + # kwarg injected by the old signal-based consumer. logging_group is + # forwarded as a positional arg. + # Phase 4 will replace this signal path with the new ParserRegistry. kwargs.pop("progress_callback", None) - return TextDocumentParser() + return TextDocumentParser(*args, **kwargs) -def text_consumer_declaration(sender, **kwargs): +def text_consumer_declaration(sender: Any, **kwargs: Any) -> dict[str, Any]: return { "parser": get_parser, "weight": 10,