diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-06 00:30:27 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-05-06 00:30:27 -0400 |
commit | 2f102b911f1ec87d58039c9a5beca9b23a6c5474 (patch) | |
tree | d14932e0756fba6e5eca2c1ff0f0457622eadbbc /cmd2/parsing.py | |
parent | 89397b5d0c1e768f6db2b5a7094e1d4541396858 (diff) | |
download | cmd2-git-2f102b911f1ec87d58039c9a5beca9b23a6c5474.tar.gz |
Fixed some warnings
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r-- | cmd2/parsing.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py index ccea18c9..f2c86ea8 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -81,7 +81,7 @@ class Statement(str): return rtn -class StatementParser(): +class StatementParser: """Parse raw text into command components. Shortcuts is a list of tuples with each tuple containing the shortcut and the expansion. @@ -93,7 +93,7 @@ class StatementParser(): multiline_commands=None, aliases=None, shortcuts=None, - ): + ): self.allow_redirection = allow_redirection if terminators is None: self.terminators = [';'] @@ -151,7 +151,6 @@ class StatementParser(): # multiple lines self.command_pattern = re.compile(r'\A\s*(\S+)(\s|\Z)+') - def tokenize(self, line: str) -> List[str]: """Lex a string into a list of tokens. @@ -369,7 +368,7 @@ class StatementParser(): # expand shortcuts for (shortcut, expansion) in self.shortcuts: - if line.startswith(shortcut): + if line.startswith(shortcut): # If the next character after the shortcut isn't a space, then insert one shortcut_len = len(shortcut) if len(line) == shortcut_len or line[shortcut_len] != ' ': @@ -397,7 +396,7 @@ class StatementParser(): if len(tokens) > 1: args = ' '.join(tokens[1:]) - return (command, args) + return command, args @staticmethod def _comment_replacer(match): @@ -414,7 +413,7 @@ class StatementParser(): # as word breaks when they are in unquoted strings. Each run of punctuation # characters is treated as a single token. - :param initial_tokens: the tokens as parsed by shlex + :param tokens: the tokens as parsed by shlex :return: the punctuated tokens """ punctuation = [] |