11from abc import ABCMeta , abstractmethod
22from typing import TYPE_CHECKING
33
4- from prompt_toolkit .formatted_text import StyleAndTextTuples
4+ from prompt_toolkit .formatted_text import AnyFormattedText
55
66if TYPE_CHECKING :
77 from .python_input import PythonInput
@@ -15,12 +15,12 @@ class PromptStyle(metaclass=ABCMeta):
1515 """
1616
1717 @abstractmethod
18- def in_prompt (self ) -> StyleAndTextTuples :
18+ def in_prompt (self ) -> AnyFormattedText :
1919 " Return the input tokens. "
2020 return []
2121
2222 @abstractmethod
23- def in2_prompt (self , width : int ) -> StyleAndTextTuples :
23+ def in2_prompt (self , width : int ) -> AnyFormattedText :
2424 """
2525 Tokens for every following input line.
2626
@@ -30,7 +30,7 @@ def in2_prompt(self, width: int) -> StyleAndTextTuples:
3030 return []
3131
3232 @abstractmethod
33- def out_prompt (self ) -> StyleAndTextTuples :
33+ def out_prompt (self ) -> AnyFormattedText :
3434 " Return the output tokens. "
3535 return []
3636
@@ -43,17 +43,17 @@ class IPythonPrompt(PromptStyle):
4343 def __init__ (self , python_input : "PythonInput" ) -> None :
4444 self .python_input = python_input
4545
46- def in_prompt (self ) -> StyleAndTextTuples :
46+ def in_prompt (self ) -> AnyFormattedText :
4747 return [
4848 ("class:in" , "In [" ),
4949 ("class:in.number" , "%s" % self .python_input .current_statement_index ),
5050 ("class:in" , "]: " ),
5151 ]
5252
53- def in2_prompt (self , width : int ) -> StyleAndTextTuples :
53+ def in2_prompt (self , width : int ) -> AnyFormattedText :
5454 return [("class:in" , "...: " .rjust (width ))]
5555
56- def out_prompt (self ) -> StyleAndTextTuples :
56+ def out_prompt (self ) -> AnyFormattedText :
5757 return [
5858 ("class:out" , "Out[" ),
5959 ("class:out.number" , "%s" % self .python_input .current_statement_index ),
@@ -67,11 +67,11 @@ class ClassicPrompt(PromptStyle):
6767 The classic Python prompt.
6868 """
6969
70- def in_prompt (self ) -> StyleAndTextTuples :
70+ def in_prompt (self ) -> AnyFormattedText :
7171 return [("class:prompt" , ">>> " )]
7272
73- def in2_prompt (self , width : int ) -> StyleAndTextTuples :
73+ def in2_prompt (self , width : int ) -> AnyFormattedText :
7474 return [("class:prompt.dots" , "..." )]
7575
76- def out_prompt (self ) -> StyleAndTextTuples :
76+ def out_prompt (self ) -> AnyFormattedText :
7777 return []
0 commit comments