mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
refactor: inline _parse_email_list in auth_checks to drop enterprise dep
The lazy import from litellm_enterprise inside _normalize_alert_emails coupled the core proxy auth path to an optional package. Core should not depend on enterprise, even lazily — it hides the dependency from static analysis and inverts the intended layering. Duplicate the 7-line parser locally. It's pure and unlikely to drift; the enterprise copy stays where it is for its own callers.
This commit is contained in:
parent
8b86a3b041
commit
029d9bcfc7
1 changed files with 9 additions and 4 deletions
|
|
@ -2946,6 +2946,15 @@ async def _virtual_key_soft_budget_check(
|
|||
)
|
||||
|
||||
|
||||
def _parse_email_list(raw: Any) -> List[str]:
|
||||
"""Parse emails from a list or comma-separated string."""
|
||||
if isinstance(raw, list):
|
||||
return [e.strip() for e in raw if isinstance(e, str) and e.strip()]
|
||||
elif isinstance(raw, str):
|
||||
return [e.strip() for e in raw.split(",") if e.strip()]
|
||||
return []
|
||||
|
||||
|
||||
def _normalize_alert_emails(
|
||||
cfg: Optional[Dict[str, Any]],
|
||||
) -> Dict[str, List[str]]:
|
||||
|
|
@ -2956,10 +2965,6 @@ def _normalize_alert_emails(
|
|||
"""
|
||||
if not cfg:
|
||||
return {}
|
||||
from litellm_enterprise.enterprise_callbacks.send_emails.base_email import (
|
||||
_parse_email_list,
|
||||
)
|
||||
|
||||
return {k: _parse_email_list(v) for k, v in cfg.items()}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue