X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=src%2Fpyutils%2Fansi.py;h=3c289f9b5b4371ad9af3762bd2c6ea48bc6ca6dd;hb=278d163705facc2276cd464414fb490ef6af50ab;hp=b29278be09069134fa9f0acdbc29b7a5f78e988a;hpb=8843e74c3195b3f420972dbed0c1eae0c859e865;p=pyutils.git diff --git a/src/pyutils/ansi.py b/src/pyutils/ansi.py index b29278b..3c289f9 100755 --- a/src/pyutils/ansi.py +++ b/src/pyutils/ansi.py @@ -15,7 +15,7 @@ import logging import re import sys from abc import abstractmethod -from typing import Any, Callable, Dict, Iterable, Literal, Optional, Tuple +from typing import Callable, Dict, Iterable, Optional, Tuple from overrides import overrides @@ -2255,10 +2255,9 @@ class _StdoutInterceptor(io.TextIOBase, contextlib.AbstractContextManager): sys.stdout = self return self - def __exit__(self, *args) -> Literal[False]: + def __exit__(self, *args) -> None: sys.stdout = self.saved_stdout print(self.buf) - return False class ProgrammableColorizer(_StdoutInterceptor): @@ -2285,7 +2284,7 @@ class ProgrammableColorizer(_StdoutInterceptor): def __init__( self, - patterns: Iterable[Tuple[re.Pattern, Callable[[Any, re.Pattern], str]]], + patterns: Iterable[Tuple[re.Pattern, Callable[[re.Match[str], str], str]]], ): """ Setup the programmable colorizing context; tell it how to operate.