mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-28 20:23:36 +00:00
[BugFix] Revamp the usage of list syntax on routines (#6450)
* using list syntax on routines * black * ruff * simplify * black
This commit is contained in:
@@ -799,11 +799,22 @@ class BaseController(metaclass=ABCMeta):
|
||||
return None
|
||||
|
||||
try:
|
||||
# If the user uses a comma separated list of arguments, split them
|
||||
for index, arg in enumerate(other_args):
|
||||
if "," in arg:
|
||||
parts = arg.split(",")
|
||||
other_args[index : index + 1] = parts
|
||||
# Determine the index of the routine arguments
|
||||
routine_args_index = next(
|
||||
(
|
||||
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]
|
||||
),
|
||||
-1,
|
||||
)
|
||||
# Split comma-separated arguments, except for the argument at routine_args_index
|
||||
other_args = [
|
||||
part
|
||||
for index, arg in enumerate(other_args)
|
||||
for part in (arg.split(",") if index != routine_args_index else [arg])
|
||||
]
|
||||
|
||||
(ns_parser, l_unknown_args) = parser.parse_known_args(other_args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user