summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-14 20:06:42 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-14 20:06:42 -0400
commit0a0768977b4bd52f4615da80881e33d8ac2d4358 (patch)
tree3a807de3d5ce24824a878bc9eb1ff265286f63ad /cmd2/parsing.py
parenteb050d7ad09a4c17f4f2ef3d59735cf87272aded (diff)
downloadcmd2-git-0a0768977b4bd52f4615da80881e33d8ac2d4358.tar.gz
Made several attributes of StatementParser immutable
The following attributes within StatementParser were converted from mutable lists to immutable tuples: - terminators - multiline_commands - shortcuts
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r--cmd2/parsing.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index d72ca4ec..1ffd3f05 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -280,21 +280,21 @@ class StatementParser:
):
self.allow_redirection = allow_redirection
if terminators is None:
- self.terminators = [constants.MULTILINE_TERMINATOR]
+ self.terminators = (constants.MULTILINE_TERMINATOR,)
else:
- self.terminators = terminators
+ self.terminators = tuple(terminators)
if multiline_commands is None:
- self.multiline_commands = []
+ self.multiline_commands = ()
else:
- self.multiline_commands = multiline_commands
+ self.multiline_commands = tuple(multiline_commands)
if aliases is None:
self.aliases = {}
else:
self.aliases = aliases
if shortcuts is None:
- self.shortcuts = []
+ self.shortcuts = ()
else:
- self.shortcuts = shortcuts
+ self.shortcuts = tuple(shortcuts)
# commands have to be a word, so make a regular expression
# that matches the first word in the line. This regex has three