From db984de915944d6421e70b2064400fb3c0ec2f9c Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 26 Jun 2019 00:24:08 -0400 Subject: Removed unneeded (optional) text from docstrings --- cmd2/cmd2.py | 42 +++++++++++++++++++++--------------------- cmd2/history.py | 6 +++--- cmd2/parsing.py | 10 +++++----- cmd2/utils.py | 6 +++--- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 69b55d80..f89274f4 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -337,20 +337,20 @@ class Cmd(cmd.Cmd): terminators: Optional[List[str]] = None, shortcuts: Optional[Dict[str, str]] = None) -> None: """An easy but powerful framework for writing line-oriented command interpreters, extends Python's cmd package. - :param completekey: (optional) readline name of a completion key, default to Tab - :param stdin: (optional) alternate input file object, if not specified, sys.stdin is used - :param stdout: (optional) alternate output file object, if not specified, sys.stdout is used - :param persistent_history_file: (optional) file path to load a persistent cmd2 command history from - :param persistent_history_length: (optional) max number of history items to write to the persistent history file - :param startup_script: (optional) file path to a script to execute at startup - :param use_ipython: (optional) should the "ipy" command be included for an embedded IPython shell - :param allow_cli_args: (optional) if True, then cmd2 will process command line arguments as either - commands to be run or, if -t is specified, transcript files to run. - This should be set to False if your application parses its own arguments. - :param transcript_files: (optional) allows running transcript tests when allow_cli_args is False - :param allow_redirection: (optional) should output redirection and pipes be allowed - :param multiline_commands: (optional) list of commands allowed to accept multi-line input - :param shortcuts: (optional) dictionary containing shortcuts for commands + :param completekey: readline name of a completion key, default to Tab + :param stdin: alternate input file object, if not specified, sys.stdin is used + :param stdout: alternate output file object, if not specified, sys.stdout is used + :param persistent_history_file: file path to load a persistent cmd2 command history from + :param persistent_history_length: max number of history items to write to the persistent history file + :param startup_script: file path to a script to execute at startup + :param use_ipython: should the "ipy" command be included for an embedded IPython shell + :param allow_cli_args: if True, then cmd2 will process command line arguments as either + commands to be run or, if -t is specified, transcript files to run. + This should be set to False if your application parses its own arguments. + :param transcript_files: allow running transcript tests when allow_cli_args is False + :param allow_redirection: should output redirection and pipes be allowed + :param multiline_commands: list of commands allowed to accept multi-line input + :param shortcuts: dictionary containing shortcuts for commands """ # If use_ipython is False, make sure the do_ipy() method doesn't exit if not use_ipython: @@ -595,7 +595,7 @@ class Cmd(cmd.Cmd): cmd2 command is finished executing. :param msg: message to print (anything convertible to a str with '{}'.format() is OK) - :param end: (optional) string appended after the end of the message, default a newline + :param end: string appended after the end of the message, default a newline """ try: self._decolorized_write(self.stdout, "{}{}".format(msg, end)) @@ -612,9 +612,9 @@ class Cmd(cmd.Cmd): """Print message to sys.stderr :param msg: message to print (anything convertible to a str with '{}'.format() is OK) - :param end: (optional) string appended after the end of the message, default a newline - :param add_color: (optional) If True, then color will be added to the message text. Set to False in cases where - the message text already has the desired style. Defaults to True. + :param end: string appended after the end of the message, default a newline + :param add_color: If True, then color will be added to the message text. Set to False in cases where + the message text already has the desired style. Defaults to True. """ if add_color: final_msg = utils.style(msg, fg='lightred') @@ -626,9 +626,9 @@ class Cmd(cmd.Cmd): """Print Exception message to sys.stderr. If debug is true, print exception traceback if one exists. :param msg: message or Exception to print - :param end: (optional) string appended after the end of the message, default a newline - :param add_color: (optional) If True, then color will be added to the message text. Set to False in cases where - the message text already has the desired style. Defaults to True. + :param end: string appended after the end of the message, default a newline + :param add_color: If True, then color will be added to the message text. Set to False in cases where + the message text already has the desired style. Defaults to True. """ if self.debug and sys.exc_info() != (None, None, None): import traceback diff --git a/cmd2/history.py b/cmd2/history.py index da16285d..dbc9a3a4 100644 --- a/cmd2/history.py +++ b/cmd2/history.py @@ -153,7 +153,7 @@ class History(list): """Return an index or slice of the History list, :param span: string containing an index or a slice - :param include_persisted: (optional) if True, then retrieve full results including from persisted history + :param include_persisted: if True, then retrieve full results including from persisted history :return: a list of HistoryItems This method can accommodate input in any of these forms: @@ -227,7 +227,7 @@ class History(list): """Find history items which contain a given string :param search: the string to search for - :param include_persisted: (optional) if True, then search full history including persisted history + :param include_persisted: if True, then search full history including persisted history :return: a list of history items, or an empty list if the string was not found """ def isin(history_item): @@ -244,7 +244,7 @@ class History(list): """Find history items which match a given regular expression :param regex: the regular expression to search for. - :param include_persisted: (optional) if True, then search full history including persisted history + :param include_persisted: if True, then search full history including persisted history :return: a list of history items, or an empty list if the string was not found """ regex = regex.strip() diff --git a/cmd2/parsing.py b/cmd2/parsing.py index f705128c..86087db1 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -257,11 +257,11 @@ class StatementParser: * multiline commands * shortcuts - :param allow_redirection: (optional) should redirection and pipes be allowed? - :param terminators: (optional) iterable containing strings which should terminate multiline commands - :param multiline_commands: (optional) iterable containing the names of commands that accept multiline input - :param aliases: (optional) dictionary contaiing aliases - :param shortcuts (optional) an iterable of tuples with each tuple containing the shortcut and the expansion + :param allow_redirection: should redirection and pipes be allowed? + :param terminators: iterable containing strings which should terminate multiline commands + :param multiline_commands: iterable containing the names of commands that accept multiline input + :param aliases: dictionary containing aliases + :param shortcuts: an iterable of tuples with each tuple containing the shortcut and the expansion """ self.allow_redirection = allow_redirection if terminators is None: diff --git a/cmd2/utils.py b/cmd2/utils.py index 92261c62..ae3bb535 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -41,8 +41,8 @@ def style(text: Any, *, fg: str = '', bg: str = '') -> str: Applies style to text :param text: Any object compatible with str.format() - :param fg: (optional) Foreground color. Accepts color names like 'red' or 'blue' - :param bg: (optional) Background color. Accepts color names like 'red' or 'blue' + :param fg: Foreground color. Accepts color names like 'red' or 'blue' + :param bg: Background color. Accepts color names like 'red' or 'blue' """ values = [] @@ -411,7 +411,7 @@ def center_text(msg: str, *, pad: str = ' ') -> str: """Centers text horizontally for display within the current terminal, optionally padding both sides. :param msg: message to display in the center - :param pad: (optional) if provided, the first character will be used to pad both sides of the message + :param pad: if provided, the first character will be used to pad both sides of the message :return: centered message, optionally padded on both sides with pad_char """ term_width = shutil.get_terminal_size().columns -- cgit v1.2.1