Fix error in list check
This commit is contained in:
parent
accf3980ba
commit
c97d3c6a02
1 changed files with 7 additions and 6 deletions
|
|
@ -7,14 +7,12 @@ from typing import Any, List, Optional, Tuple, Type
|
|||
|
||||
import orjson
|
||||
import yaml
|
||||
from langflow.services.settings.constants import VARIABLES_TO_GET_FROM_ENVIRONMENT
|
||||
from loguru import logger
|
||||
from pydantic import field_validator, validator
|
||||
from pydantic.fields import FieldInfo
|
||||
from pydantic_settings import BaseSettings, EnvSettingsSource, PydanticBaseSettingsSource, SettingsConfigDict
|
||||
|
||||
from langflow.services.settings.constants import VARIABLES_TO_GET_FROM_ENVIRONMENT
|
||||
from pydantic_settings import BaseSettings, EnvSettingsSource, PydanticBaseSettingsSource, SettingsConfigDict
|
||||
|
||||
# BASE_COMPONENTS_PATH = str(Path(__file__).parent / "components")
|
||||
BASE_COMPONENTS_PATH = str(Path(__file__).parent.parent.parent / "components")
|
||||
|
||||
|
|
@ -29,9 +27,12 @@ def is_list_of_any(field: FieldInfo) -> bool:
|
|||
Returns:
|
||||
bool: True if the field is a list or a list of any type, False otherwise.
|
||||
"""
|
||||
return field.annotation.__origin__ == list or any(
|
||||
arg.__origin__ == list for arg in field.annotation.__args__ if hasattr(arg, "__origin__")
|
||||
)
|
||||
try:
|
||||
return field.annotation.__origin__ == list or any(
|
||||
arg.__origin__ == list for arg in field.annotation.__args__ if hasattr(arg, "__origin__")
|
||||
)
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
|
||||
class MyCustomSource(EnvSettingsSource):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue