From 4168a353560b92f188a9d987b74e5c29ae70a849 Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Tue, 14 Oct 2025 18:34:31 +0000 Subject: [PATCH] Small typing fixes. --- src/prompt_toolkit/formatted_text/base.py | 5 ++--- src/prompt_toolkit/lexers/pygments.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/prompt_toolkit/formatted_text/base.py b/src/prompt_toolkit/formatted_text/base.py index 5fee1f862..75f47d87a 100644 --- a/src/prompt_toolkit/formatted_text/base.py +++ b/src/prompt_toolkit/formatted_text/base.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Tuple, Union, cast +from typing import TYPE_CHECKING, Callable, Iterable, List, Tuple, Union, cast from prompt_toolkit.mouse_events import MouseEvent @@ -45,8 +45,7 @@ def __pt_formatted_text__(self) -> StyleAndTextTuples: ... str, "MagicFormattedText", StyleAndTextTuples, - # Callable[[], 'AnyFormattedText'] # Recursive definition not supported by mypy. - Callable[[], Any], + Callable[[], "AnyFormattedText"], None, ] diff --git a/src/prompt_toolkit/lexers/pygments.py b/src/prompt_toolkit/lexers/pygments.py index d5a39c499..ff972d4a8 100644 --- a/src/prompt_toolkit/lexers/pygments.py +++ b/src/prompt_toolkit/lexers/pygments.py @@ -104,7 +104,7 @@ def get_sync_start_position( return lineno, 0 @classmethod - def from_pygments_lexer_cls(cls, lexer_cls: PygmentsLexerCls) -> RegexSync: + def from_pygments_lexer_cls(cls, lexer_cls: type[PygmentsLexerCls]) -> RegexSync: """ Create a :class:`.RegexSync` instance for this Pygments lexer class. """