(
source_cache_key: Union[str, List[str]],
)
| 2517 | |
| 2518 | |
| 2519 | async def _get_source_cache_base_spend( |
| 2520 | source_cache_key: Union[str, List[str]], |
| 2521 | ) -> float: |
| 2522 | source_cache_keys = [source_cache_key] if isinstance(source_cache_key, str) else source_cache_key |
| 2523 | for cache_key in source_cache_keys: |
| 2524 | source = await user_api_key_cache.async_get_cache(key=cache_key) |
| 2525 | if source is None: |
| 2526 | continue |
| 2527 | if isinstance(source, dict): |
| 2528 | return float(source.get("spend", 0.0) or 0.0) |
| 2529 | return float(getattr(source, "spend", 0.0) or 0.0) |
| 2530 | return 0.0 |
| 2531 | |
| 2532 | |
| 2533 | async def _ensure_window_spend_counter_initialized( |
no test coverage detected