mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 10:06:43 +08:00
Fix error in list check
This commit is contained in:
@ -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):
|
||||
|
||||
Reference in New Issue
Block a user