From 0817978fcd67bc8e84369d163aff55c1a614b711 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Fri, 21 Sep 2018 10:08:05 -0400 Subject: Removed remaining type hints in docstrings --- examples/python_scripting.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/python_scripting.py') diff --git a/examples/python_scripting.py b/examples/python_scripting.py index 069bcff5..ab5ecc2b 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -35,12 +35,12 @@ class CmdLineApp(cmd2.Cmd): self.cwd = os.getcwd() self.prompt = self.colorize('{!r} $ '.format(self.cwd), 'cyan') - def postcmd(self, stop, line): + def postcmd(self, stop: bool, line: str) -> bool: """Hook method executed just after a command dispatch is finished. - :param stop: bool - if True, the command has indicated the application should exit - :param line: str - the command line text for this command - :return: bool - if this is True, the application will exit after this command and the postloop() will run + :param stop: if True, the command has indicated the application should exit + :param line: the command line text for this command + :return: if this is True, the application will exit after this command and the postloop() will run """ """Override this so prompt always displays cwd.""" self._set_prompt() -- cgit v1.2.1 From a2ad70bd79a78123d2bb67b1ff1ed0b815dd721d Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Mon, 24 Sep 2018 11:13:42 -0400 Subject: Added optional color argument to poutput() for providing a color escape code to colorize the output with Also: - Added optional err_color and war_color arguments to perror() for providing color escape codes - Removed usage of deprecated colorize() method within the examples --- examples/python_scripting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/python_scripting.py') diff --git a/examples/python_scripting.py b/examples/python_scripting.py index ab5ecc2b..b6700cb7 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -17,6 +17,8 @@ This application and the "scripts/conditional.py" script serve as an example for import argparse import os +from colorama import Fore + import cmd2 @@ -33,7 +35,7 @@ class CmdLineApp(cmd2.Cmd): def _set_prompt(self): """Set prompt so it displays the current working directory.""" self.cwd = os.getcwd() - self.prompt = self.colorize('{!r} $ '.format(self.cwd), 'cyan') + self.prompt = Fore.CYAN + '{!r} $ '.format(self.cwd) + Fore.RESET def postcmd(self, stop: bool, line: str) -> bool: """Hook method executed just after a command dispatch is finished. -- cgit v1.2.1 From 4c5c66633271c2d1968de4e437397a6d27f77ab7 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 25 Sep 2018 09:59:43 -0400 Subject: Removed a Python3-only comment from an example since Python 2 is no longer supported --- examples/python_scripting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/python_scripting.py') diff --git a/examples/python_scripting.py b/examples/python_scripting.py index ab5ecc2b..4c959f58 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -27,7 +27,7 @@ class CmdLineApp(cmd2.Cmd): # Enable the optional ipy command if IPython is installed by setting use_ipython=True super().__init__(use_ipython=True) self._set_prompt() - self.intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 (Python 3 only) 💩' + self.intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 💩' self.locals_in_py = True def _set_prompt(self): -- cgit v1.2.1