summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-07-12 01:09:05 -0400
committerGitHub <noreply@github.com>2018-07-12 01:09:05 -0400
commit131e0d2e6481dfde4e061c0ae4afdff3edf01851 (patch)
tree85e0a26fdbcc79c5e3f402f43924bae5e1127fce /cmd2/utils.py
parentd52fe23f70cddfb53005d0e9f05f1a7dceea8fbb (diff)
parentea7a4bbd14a41b0e9bdde8d34c666eb35df60c4a (diff)
downloadcmd2-git-131e0d2e6481dfde4e061c0ae4afdff3edf01851.tar.gz
Merge branch 'master' into history
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py16
1 files changed, 0 insertions, 16 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index ff8e034e..d03e7f6f 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.