@@ -430,8 +430,13 @@ async def read_code_mem(file_paths: List[str]) -> str:
430
430
"""
431
431
try :
432
432
if not file_paths or not isinstance (file_paths , list ):
433
- result = {"status" : "error" , "message" : "file_paths parameter is required and must be a list" }
434
- log_operation ("read_code_mem_error" , {"error" : "missing_or_invalid_file_paths" })
433
+ result = {
434
+ "status" : "error" ,
435
+ "message" : "file_paths parameter is required and must be a list" ,
436
+ }
437
+ log_operation (
438
+ "read_code_mem_error" , {"error" : "missing_or_invalid_file_paths" }
439
+ )
435
440
return json .dumps (result , ensure_ascii = False , indent = 2 )
436
441
437
442
# Remove duplicates while preserving order
@@ -449,10 +454,11 @@ async def read_code_mem(file_paths: List[str]) -> str:
449
454
"status" : "no_summary" ,
450
455
"file_paths" : unique_file_paths ,
451
456
"message" : "No summary file found." ,
452
- "results" : []
457
+ "results" : [],
453
458
}
454
459
log_operation (
455
- "read_code_mem" , {"file_paths" : unique_file_paths , "status" : "no_summary_file" }
460
+ "read_code_mem" ,
461
+ {"file_paths" : unique_file_paths , "status" : "no_summary_file" },
456
462
)
457
463
return json .dumps (result , ensure_ascii = False , indent = 2 )
458
464
@@ -465,37 +471,40 @@ async def read_code_mem(file_paths: List[str]) -> str:
465
471
"status" : "no_summary" ,
466
472
"file_paths" : unique_file_paths ,
467
473
"message" : "Summary file is empty." ,
468
- "results" : []
474
+ "results" : [],
469
475
}
470
476
log_operation (
471
- "read_code_mem" , {"file_paths" : unique_file_paths , "status" : "empty_summary" }
477
+ "read_code_mem" ,
478
+ {"file_paths" : unique_file_paths , "status" : "empty_summary" },
472
479
)
473
480
return json .dumps (result , ensure_ascii = False , indent = 2 )
474
481
475
482
# Process each file path and collect results
476
483
results = []
477
484
summaries_found = 0
478
-
485
+
479
486
for file_path in unique_file_paths :
480
487
# Extract file-specific section from summary
481
- file_section = _extract_file_section_from_summary (summary_content , file_path )
482
-
488
+ file_section = _extract_file_section_from_summary (
489
+ summary_content , file_path
490
+ )
491
+
483
492
if file_section :
484
493
file_result = {
485
494
"file_path" : file_path ,
486
495
"status" : "summary_found" ,
487
496
"summary_content" : file_section ,
488
- "message" : f"Summary information found for { file_path } "
497
+ "message" : f"Summary information found for { file_path } " ,
489
498
}
490
499
summaries_found += 1
491
500
else :
492
501
file_result = {
493
502
"file_path" : file_path ,
494
503
"status" : "no_summary" ,
495
504
"summary_content" : None ,
496
- "message" : f"No summary found for { file_path } "
505
+ "message" : f"No summary found for { file_path } " ,
497
506
}
498
-
507
+
499
508
results .append (file_result )
500
509
501
510
# Determine overall status
@@ -512,7 +521,7 @@ async def read_code_mem(file_paths: List[str]) -> str:
512
521
"total_requested" : len (unique_file_paths ),
513
522
"summaries_found" : summaries_found ,
514
523
"message" : f"Found summaries for { summaries_found } /{ len (unique_file_paths )} files" ,
515
- "results" : results
524
+ "results" : results ,
516
525
}
517
526
518
527
log_operation (
@@ -531,10 +540,14 @@ async def read_code_mem(file_paths: List[str]) -> str:
531
540
result = {
532
541
"status" : "error" ,
533
542
"message" : f"Failed to check code memory: { str (e )} " ,
534
- "file_paths" : file_paths if isinstance (file_paths , list ) else [str (file_paths )],
535
- "results" : []
543
+ "file_paths" : file_paths
544
+ if isinstance (file_paths , list )
545
+ else [str (file_paths )],
546
+ "results" : [],
536
547
}
537
- log_operation ("read_code_mem_error" , {"file_paths" : file_paths , "error" : str (e )})
548
+ log_operation (
549
+ "read_code_mem_error" , {"file_paths" : file_paths , "error" : str (e )}
550
+ )
538
551
return json .dumps (result , ensure_ascii = False , indent = 2 )
539
552
540
553
0 commit comments