Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

refactor: syntax cleanup (#172)

gasolinf08ee6420a70
diff --git a/embedchain/config/InitConfig.py b/embedchain/config/InitConfig.py
index 5fa9b032d..9bcaeb903 100644
--- a/embedchain/config/InitConfig.py
+++ b/embedchain/config/InitConfig.py
@@ -33,4 +33,4 @@ class InitConfig(BaseConfig):
def _set_embedding_function(self, ef):
self.ef = ef
- return
+ return
diff --git a/embedchain/utils.py b/embedchain/utils.py
index b6337147a..d7a893018 100644
--- a/embedchain/utils.py
+++ b/embedchain/utils.py
@@ -13,21 +13,20 @@ def clean_string(text):
"""
# Replacement of newline characters:
text = text.replace('\n', ' ')
-
+
# Stripping and reducing multiple spaces to single:
cleaned_text = re.sub(r'\s+', ' ', text.strip())
-
+
# Removing backslashes:
cleaned_text = cleaned_text.replace('\\', '')
-
+
# Replacing hash characters:
cleaned_text = cleaned_text.replace('#', ' ')
-
+
# Eliminating consecutive non-alphanumeric characters:
# This regex identifies consecutive non-alphanumeric characters (i.e., not a word character [a-zA-Z0-9_] and not a whitespace) in the string
# and replaces each group of such characters with a single occurrence of that character.
# For example, "!!! hello !!!" would become "! hello !".
cleaned_text = re.sub(r'([^\w\s])\1*', r'\1', cleaned_text)
-
- return cleaned_text
+ return cleaned_text