From 0a0768977b4bd52f4615da80881e33d8ac2d4358 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 14 Mar 2019 20:06:42 -0400 Subject: Made several attributes of StatementParser immutable The following attributes within StatementParser were converted from mutable lists to immutable tuples: - terminators - multiline_commands - shortcuts --- cmd2/parsing.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cmd2/parsing.py') 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 -- cgit v1.2.1