참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1,28 @@
"""
Utility functions for batch processing.
This module contains helper functions for filtering, extracting, and manipulating
batch results.
"""
from .models import BatchResult, BatchSuccess, BatchError, T
def filter_successful(results: list[BatchResult]) -> list[BatchSuccess[T]]:
"""Filter to only successful results"""
return [r for r in results if r.success]
def filter_errors(results: list[BatchResult]) -> list[BatchError]:
"""Filter to only error results"""
return [r for r in results if not r.success]
def extract_results(results: list[BatchResult]) -> list[T]:
"""Extract just the result objects from successful results"""
return [r.result for r in results if r.success]
def get_results_by_custom_id(results: list[BatchResult]) -> dict[str, BatchResult]:
"""Create a dictionary mapping custom_id to results"""
return {r.custom_id: r for r in results}