mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-13 04:41:24 +00:00
fix bug with generic
This commit is contained in:
@@ -416,7 +416,7 @@ class ProviderInterface:
|
||||
types_list.append(ret)
|
||||
|
||||
if types_list:
|
||||
returns[model_name] = Union[*types_list] # type: ignore
|
||||
returns[model_name] = Union[tuple(types_list)] # type: ignore
|
||||
|
||||
return returns
|
||||
|
||||
@@ -455,7 +455,8 @@ class ProviderInterface:
|
||||
)
|
||||
|
||||
ReturnType = merged_return_type.get(model_name, GenericDataType)
|
||||
result[model_name] = ReturnType[ReturnModel] # type: ignore
|
||||
n_params = len(getattr(ReturnType, "__parameters__", ()))
|
||||
result[model_name] = ReturnType[tuple([ReturnModel] * n_params)] # type: ignore
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Abstract class for the fetcher."""
|
||||
|
||||
|
||||
from abc import abstractmethod
|
||||
from typing import Any, Dict, Generic, List, Optional, TypeVar, Union
|
||||
|
||||
from openbb_provider.abstract.data import Data
|
||||
@@ -77,6 +78,8 @@ class Fetcher(
|
||||
# pylint: disable=E1101
|
||||
return self.__orig_bases__[0].__args__[3]
|
||||
|
||||
# TODO: Create abstract class attribute for generic return type
|
||||
# @property
|
||||
# @abstractmethod
|
||||
# def generic_return_type(self):
|
||||
# """Get the type of the generic return."""
|
||||
# raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user