Skip to content

Commit 779aa41

Browse files
committed
lint: fix lint
1 parent 5839328 commit 779aa41

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

pandasai/ee/vectorstores/milvus.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Milvus(VectorStore):
2525
default=384, description="default embedding model dimension"
2626
)
2727

28-
# Initializes the Milvus object with collection names, a URI for the Milvus database,
28+
# Initializes the Milvus object with collection names, a URI for the Milvus database,
2929
# a logger, and the embedding function.
3030
def __init__(
3131
self,
@@ -86,10 +86,7 @@ def add_question_answer(
8686
collection_name=self.qa_collection_name,
8787
data=data,
8888
)
89-
9089
return milvus_ids
91-
92-
9390

9491
# Adds documents to the Milvus collection.
9592
# It accepts documents, optional IDs, and metadata, and stores them in the document collection.
@@ -124,7 +121,7 @@ def add_docs(
124121
collection_name=self.docs_collection_name,
125122
data=data,
126123
)
127-
124+
128125
return milvus_ids
129126

130127
# Retrieves the most relevant question-answer pairs from the QA collection
@@ -146,7 +143,6 @@ def get_relevant_question_answers(self, question: str, k: int = 1) -> List[Dict]
146143
filter="",
147144
output_fields=[DOCUMENT],
148145
)
149-
150146
return self._convert_search_response(response)
151147

152148
# Retrieves the most relevant documents from the document collection
@@ -166,7 +162,6 @@ def get_relevant_docs(self, question: str, k: int = 1) -> List[Dict]:
166162
limit=k,
167163
output_fields=[DOCUMENT],
168164
)
169-
170165
return self._convert_search_response(response)
171166

172167
# Converts the search response returned by Milvus into a list of dictionaries
@@ -271,7 +266,6 @@ def get_relevant_question_answers_by_id(self, ids: Iterable[str]) -> List[Dict]:
271266
ids=milvus_ids,
272267
output_fields=[DOCUMENT, ID, "distance", "entity"],
273268
)
274-
275269
return self._convert_search_response(response)["documents"]
276270

277271
# Deletes documents from the document collection based on a list of document IDs.
@@ -388,4 +382,4 @@ def _is_valid_uuid(self, id: str):
388382

389383
# Generates a list of random UUIDs.
390384
def generate_random_uuids(self, n):
391-
return [str(uuid.uuid4()) for _ in range(n)]
385+
return [str(uuid.uuid4()) for _ in range(n)]

pandasai/pipelines/chat/code_cleaning.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ def _is_malicious_code(self, code) -> bool:
176176
"(chr",
177177
"b64decode",
178178
]
179-
return any(re.search(r'\b'+re.escape(module)+r'\b',code) for module in dangerous_modules)
179+
return any(
180+
re.search(r"\b" + re.escape(module) + r"\b", code)
181+
for module in dangerous_modules
182+
)
180183

181184
def _is_jailbreak(self, node: ast.stmt) -> bool:
182185
"""

0 commit comments

Comments
 (0)