mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-29 04:32:43 +00:00
[Feature] Optional choices (#6463)
* using the custom argument to leverage validation * restructure * better handling of variables and props * optional choices * utilities module * proper handling of optional choices attr * setattr --------- Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
This commit is contained in:
@@ -807,7 +807,11 @@ class BaseController(metaclass=ABCMeta):
|
||||
i + 1
|
||||
for i, arg in enumerate(other_args)
|
||||
if arg in ("-i", "--input")
|
||||
and "routine_args" in [action.dest for action in parser._actions]
|
||||
and "routine_args"
|
||||
in [
|
||||
action.dest
|
||||
for action in parser._actions # pylint: disable=protected-access
|
||||
]
|
||||
),
|
||||
-1,
|
||||
)
|
||||
@@ -818,6 +822,11 @@ class BaseController(metaclass=ABCMeta):
|
||||
for part in (arg.split(",") if index != routine_args_index else [arg])
|
||||
]
|
||||
|
||||
# Check if the action has optional choices, if yes, remove them
|
||||
for action in parser._actions: # pylint: disable=protected-access
|
||||
if hasattr(action, "optional_choices") and action.optional_choices:
|
||||
action.choices = None
|
||||
|
||||
(ns_parser, l_unknown_args) = parser.parse_known_args(other_args)
|
||||
|
||||
if export_allowed in [
|
||||
|
||||
Reference in New Issue
Block a user