Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 639ef9d

Browse files
committed
ruff
1 parent c0f6f6c commit 639ef9d

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

backend/graphrag_app/api/data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ async def upload_file_async(
9797

9898
# clean the output and upload to blob storage
9999
cleaned_result = clean_output(result.text_content)
100-
await converted_blob_client.upload_blob(cleaned_result, overwrite=overwrite)
100+
await converted_blob_client.upload_blob(
101+
cleaned_result, overwrite=overwrite
102+
)
101103

102104
# update the file cache
103105
await update_cache(filename, file_stream, container_client)

backend/graphrag_app/utils/common.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def desanitize_name(sanitized_container_name: str) -> str | None:
193193
raise HTTPException(
194194
status_code=500, detail="Error retrieving original container name."
195195
)
196-
196+
197197

198198
async def create_cache(container_client: ContainerClient) -> None:
199199
"""
@@ -203,9 +203,7 @@ async def create_cache(container_client: ContainerClient) -> None:
203203
cache_blob_client = container_client.get_blob_client("uploaded_files_cache.csv")
204204
if not await cache_blob_client.exists():
205205
# create the empty file cache csv
206-
headers = [
207-
['Filename', 'Hash']
208-
]
206+
headers = [["Filename", "Hash"]]
209207
with open("uploaded_files_cache.csv", "w", newline="") as f:
210208
writer = csv.writer(f, delimiter=",")
211209
writer.writerows(headers)
@@ -247,7 +245,9 @@ async def check_cache(file_stream: BinaryIO, container_client: ContainerClient)
247245
)
248246

249247

250-
async def update_cache(filename: str, file_stream: BinaryIO, container_client: ContainerClient) -> None:
248+
async def update_cache(
249+
filename: str, file_stream: BinaryIO, container_client: ContainerClient
250+
) -> None:
251251
"""
252252
Update the file cache with the new file by appending a new row to the cache.
253253
"""
@@ -274,9 +274,11 @@ async def update_cache(filename: str, file_stream: BinaryIO, container_client: C
274274

275275
# Upload the updated cache to Azure Blob Storage
276276
updated_cache_content.seek(0)
277-
await cache_blob_client.upload_blob(updated_cache_content.getvalue().encode("utf-8"), overwrite=True)
277+
await cache_blob_client.upload_blob(
278+
updated_cache_content.getvalue().encode("utf-8"), overwrite=True
279+
)
278280
except Exception:
279281
raise HTTPException(
280282
status_code=500,
281283
detail="Error updating file cache in Azure Blob Storage.",
282-
)
284+
)

notebooks/2-Advanced_Getting_Started.ipynb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@
290290
" return requests.post(\n",
291291
" url,\n",
292292
" files=prompts if len(prompts) > 0 else None,\n",
293-
" params={\"index_container_name\": index_name, \"storage_container_name\": storage_name},\n",
293+
" params={\n",
294+
" \"index_container_name\": index_name,\n",
295+
" \"storage_container_name\": storage_name,\n",
296+
" },\n",
294297
" headers=headers,\n",
295298
" )\n",
296299
"\n",
@@ -619,7 +622,9 @@
619622
" community_summarization_prompt = prompts[\"community_summarization_prompt\"]\n",
620623
" summarize_description_prompt = prompts[\"entity_summarization_prompt\"]\n",
621624
"else:\n",
622-
" entity_extraction_prompt = community_summarization_prompt = summarize_description_prompt = None\n",
625+
" entity_extraction_prompt = community_summarization_prompt = (\n",
626+
" summarize_description_prompt\n",
627+
" ) = None\n",
623628
"\n",
624629
"response = build_index(\n",
625630
" storage_name=storage_name,\n",

0 commit comments

Comments
 (0)