4242from typing import Any , Callable , Dict , List , Mapping , Optional , Tuple , Type , Union , IO
4343
4444import colorama
45- from colorama import Fore
4645
4746from . import constants
4847from . import plugin
5958 rl_warning = "Readline features including tab completion have been disabled since no \n " \
6059 "supported version of readline was found. To resolve this, install \n " \
6160 "pyreadline on Windows or gnureadline on Mac.\n \n "
62- sys .stderr .write (Fore . LIGHTYELLOW_EX + rl_warning + Fore . RESET )
61+ sys .stderr .write (constants . WARNING_COLOR + rl_warning + constants . RESET_COLOR )
6362else :
6463 from .rl_utils import rl_force_redisplay , readline
6564
@@ -616,7 +615,7 @@ def poutput(self, msg: Any, end: str = '\n', color: str = '') -> None:
616615 if not msg_str .endswith (end ):
617616 msg_str += end
618617 if color :
619- msg_str = color + msg_str + Fore . RESET
618+ msg_str = color + msg_str + constants . RESET_COLOR
620619 self .decolorized_write (self .stdout , msg_str )
621620 except BrokenPipeError :
622621 # This occurs if a command's output is being piped to another
@@ -627,8 +626,8 @@ def poutput(self, msg: Any, end: str = '\n', color: str = '') -> None:
627626 if self .broken_pipe_warning :
628627 sys .stderr .write (self .broken_pipe_warning )
629628
630- def perror (self , err : Union [str , Exception ], traceback_war : bool = True , err_color : str = Fore . LIGHTRED_EX ,
631- war_color : str = Fore . LIGHTYELLOW_EX ) -> None :
629+ def perror (self , err : Union [str , Exception ], traceback_war : bool = True , err_color : str = constants . ERROR_COLOR ,
630+ war_color : str = constants . WARNING_COLOR ) -> None :
632631 """ Print error message to sys.stderr and if debug is true, print an exception Traceback if one exists.
633632
634633 :param err: an Exception or error message to print out
@@ -644,12 +643,12 @@ def perror(self, err: Union[str, Exception], traceback_war: bool = True, err_col
644643 err_msg = "EXCEPTION of type '{}' occurred with message: '{}'\n " .format (type (err ).__name__ , err )
645644 else :
646645 err_msg = "{}\n " .format (err )
647- err_msg = err_color + err_msg + Fore . RESET
646+ err_msg = err_color + err_msg + constants . RESET_COLOR
648647 self .decolorized_write (sys .stderr , err_msg )
649648
650649 if traceback_war and not self .debug :
651650 war = "To enable full traceback, run the following command: 'set debug true'\n "
652- war = war_color + war + Fore . RESET
651+ war = war_color + war + constants . RESET_COLOR
653652 self .decolorized_write (sys .stderr , war )
654653
655654 def pfeedback (self , msg : str ) -> None :
@@ -3745,7 +3744,7 @@ class TestMyAppCase(Cmd2TestCase):
37453744 test_results = runner .run (testcase )
37463745 if test_results .wasSuccessful ():
37473746 self .decolorized_write (sys .stderr , stream .read ())
3748- self .poutput ('Tests passed' , color = Fore . LIGHTGREEN_EX )
3747+ self .poutput ('Tests passed' , color = constants . SUCCESS_COLOR )
37493748 else :
37503749 # Strip off the initial traceback which isn't particularly useful for end users
37513750 error_str = stream .read ()
0 commit comments