diff options
Diffstat (limited to 'cli/openbb_cli/argparse_translator/utils.py')
-rw-r--r-- | cli/openbb_cli/argparse_translator/utils.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/openbb_cli/argparse_translator/utils.py b/cli/openbb_cli/argparse_translator/utils.py index 20b2de27178..d9ab81c5327 100644 --- a/cli/openbb_cli/argparse_translator/utils.py +++ b/cli/openbb_cli/argparse_translator/utils.py @@ -59,9 +59,12 @@ def get_argument_optional_choices(parser: ArgumentParser, argument_name: str) -> """Get the optional_choices attribute of an argument from an ArgumentParser.""" for action in parser._actions: # pylint: disable=protected-access opts = action.option_strings - if (opts and opts[0] == argument_name) or action.dest == argument_name: - if hasattr(action, "optional_choices"): - return action.optional_choices + if ( + (opts and opts[0] == argument_name) + or action.dest == argument_name + and hasattr(action, "optional_choices") + ): + return action.optional_choices return False |