🔥 refactor(cache/base.py): remove empty pass statement in BaseCache abstract method
🔥 refactor(utils/validate.py): remove try-except block in create_function method
The pass statement in the BaseCache abstract method is redundant and can be removed. Similarly, the try-except block in the create_function method is not necessary as the exception is being suppressed.
This commit is contained in:
parent
93d1c10888
commit
a099fd05ad
2 changed files with 2 additions and 5 deletions
1
src/backend/langflow/cache/base.py
vendored
1
src/backend/langflow/cache/base.py
vendored
|
|
@ -27,7 +27,6 @@ class BaseCache(abc.ABC):
|
||||||
key: The key of the item.
|
key: The key of the item.
|
||||||
value: The value to cache.
|
value: The value to cache.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def delete(self, key):
|
def delete(self, key):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import ast
|
import ast
|
||||||
|
import contextlib
|
||||||
import importlib
|
import importlib
|
||||||
import types
|
import types
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
@ -147,11 +148,8 @@ def create_function(code, function_name):
|
||||||
code_obj = compile(
|
code_obj = compile(
|
||||||
ast.Module(body=[function_code], type_ignores=[]), "<string>", "exec"
|
ast.Module(body=[function_code], type_ignores=[]), "<string>", "exec"
|
||||||
)
|
)
|
||||||
try:
|
with contextlib.suppress(Exception):
|
||||||
exec(code_obj, exec_globals, locals())
|
exec(code_obj, exec_globals, locals())
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
exec_globals[function_name] = locals()[function_name]
|
exec_globals[function_name] = locals()[function_name]
|
||||||
|
|
||||||
# Return a function that imports necessary modules and calls the target function
|
# Return a function that imports necessary modules and calls the target function
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue