mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
fix qa/ta - mandatory provider_choices was breaking functions that don't really require it w @IgorWounds
This commit is contained in:
@@ -111,6 +111,7 @@ class ParametersBuilder:
|
||||
|
||||
@staticmethod
|
||||
def update_provider_choices(
|
||||
func: Callable,
|
||||
command_coverage: Dict[str, List[str]],
|
||||
route: str,
|
||||
kwargs: Dict[str, Any],
|
||||
@@ -118,6 +119,11 @@ class ParametersBuilder:
|
||||
) -> Dict[str, Any]:
|
||||
"""Update the provider choices with the available providers and set default provider."""
|
||||
|
||||
def _needs_provider(func: Callable) -> bool:
|
||||
"""Check if the function needs a provider."""
|
||||
parameters = signature(func).parameters.keys()
|
||||
return "provider_choices" in parameters
|
||||
|
||||
def _has_provider(kwargs: Dict[str, Any]) -> bool:
|
||||
"""Check if the kwargs already have a provider."""
|
||||
if (
|
||||
@@ -146,7 +152,7 @@ class ParametersBuilder:
|
||||
|
||||
return command_cov_provider
|
||||
|
||||
if not _has_provider(kwargs):
|
||||
if not _has_provider(kwargs) and _needs_provider(func):
|
||||
provider = (
|
||||
_get_default_provider(
|
||||
command_coverage,
|
||||
@@ -210,6 +216,7 @@ class ParametersBuilder:
|
||||
user_settings=user_settings,
|
||||
)
|
||||
kwargs = cls.update_provider_choices(
|
||||
func=func,
|
||||
command_coverage=command_map.command_coverage,
|
||||
route=route,
|
||||
kwargs=kwargs,
|
||||
|
||||
Reference in New Issue
Block a user