File tree 1 file changed +7
-3
lines changed
src/backend/base/langflow/utils
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
import ast
2
2
import contextlib
3
3
import importlib
4
+ import warnings
4
5
from types import FunctionType
5
6
from typing import Optional , Union
6
7
8
+ from langchain_core ._api .deprecation import LangChainDeprecationWarning
7
9
from loguru import logger
8
10
from pydantic import ValidationError
9
11
@@ -221,9 +223,11 @@ def prepare_global_scope(code, module):
221
223
raise ModuleNotFoundError (msg ) from e
222
224
elif isinstance (node , ast .ImportFrom ) and node .module is not None :
223
225
try :
224
- imported_module = importlib .import_module (node .module )
225
- for alias in node .names :
226
- exec_globals [alias .name ] = getattr (imported_module , alias .name )
226
+ with warnings .catch_warnings ():
227
+ warnings .simplefilter ("ignore" , LangChainDeprecationWarning )
228
+ imported_module = importlib .import_module (node .module )
229
+ for alias in node .names :
230
+ exec_globals [alias .name ] = getattr (imported_module , alias .name )
227
231
except ModuleNotFoundError as e :
228
232
msg = f"Module { node .module } not found. Please install it and try again"
229
233
raise ModuleNotFoundError (msg ) from e
You can’t perform that action at this time.
0 commit comments