Spaces:
Paused
Paused
Harshit Harshit-65 commited on
fix: python.lang.security.audit.eval-detected.eval-detected-python-helpers-memory.py (#444)
Browse files- python/helpers/memory.py +2 -1
python/helpers/memory.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from datetime import datetime
|
| 2 |
from typing import Any, List, Sequence
|
| 3 |
from langchain.storage import InMemoryByteStore, LocalFileStore
|
|
@@ -391,7 +392,7 @@ class Memory:
|
|
| 391 |
def _get_comparator(condition: str):
|
| 392 |
def comparator(data: dict[str, Any]):
|
| 393 |
try:
|
| 394 |
-
return
|
| 395 |
except Exception as e:
|
| 396 |
# PrintStyle.error(f"Error evaluating condition: {e}")
|
| 397 |
return False
|
|
|
|
| 1 |
+
import ast
|
| 2 |
from datetime import datetime
|
| 3 |
from typing import Any, List, Sequence
|
| 4 |
from langchain.storage import InMemoryByteStore, LocalFileStore
|
|
|
|
| 392 |
def _get_comparator(condition: str):
|
| 393 |
def comparator(data: dict[str, Any]):
|
| 394 |
try:
|
| 395 |
+
return ast.literal_eval(condition, {}, data)
|
| 396 |
except Exception as e:
|
| 397 |
# PrintStyle.error(f"Error evaluating condition: {e}")
|
| 398 |
return False
|