From 6bb7e4c110f8779e550502c251648b7e7af93154 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Wed, 11 Jul 2018 19:46:48 -0400 Subject: Deleted the CmdResult helper class The CmdResult helper class was deprecated in the previous release. This commit deletes it. - The new CommandResult class is an improved replacement Also: - Deleted the namedtuple_with_two_defaults helper function which is now no longer used --- cmd2/utils.py | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'cmd2/utils.py') diff --git a/cmd2/utils.py b/cmd2/utils.py index 11d48b78..1f08b416 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -61,22 +61,6 @@ def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]], return T -def namedtuple_with_two_defaults(typename: str, field_names: Union[str, List[str]], - default_values: collections.Iterable=('', '')): - """Wrapper around namedtuple which lets you treat the last value as optional. - - :param typename: str - type name for the Named tuple - :param field_names: List[str] or space-separated string of field names - :param default_values: (optional) 2-element tuple containing the default values for last 2 parameters in named tuple - Defaults to an empty string for both of them - :return: namedtuple type - """ - T = collections.namedtuple(typename, field_names) - # noinspection PyUnresolvedReferences - T.__new__.__defaults__ = default_values - return T - - def cast(current: Any, new: str) -> Any: """Tries to force a new value into the same type as the current when trying to set the value for a parameter. -- cgit v1.2.1