2025-12-10 20:52:44 +08:00
|
|
|
"""
|
|
|
|
|
Provider 服务模块
|
|
|
|
|
|
|
|
|
|
包含 Provider 管理、格式处理、传输层等功能。
|
|
|
|
|
"""
|
|
|
|
|
|
2026-02-10 17:53:04 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from src.services.provider.format import normalize_endpoint_signature
|
|
|
|
|
from src.services.provider.service import ProviderService
|
|
|
|
|
from src.services.provider.transport import build_provider_url
|
2025-12-10 20:52:44 +08:00
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
"ProviderService",
|
2026-02-01 17:28:00 +08:00
|
|
|
"normalize_endpoint_signature",
|
2025-12-10 20:52:44 +08:00
|
|
|
"build_provider_url",
|
|
|
|
|
]
|
2026-02-10 17:53:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def __getattr__(name: str) -> Any:
|
|
|
|
|
"""Lazy attribute access to avoid import-time side effects.
|
|
|
|
|
|
|
|
|
|
Importing `src.services.provider` should not eagerly import the whole provider
|
|
|
|
|
service stack (which can create circular imports during test collection).
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
if name == "ProviderService":
|
|
|
|
|
from src.services.provider.service import ProviderService as _ProviderService
|
|
|
|
|
|
|
|
|
|
return _ProviderService
|
|
|
|
|
if name == "normalize_endpoint_signature":
|
|
|
|
|
from src.services.provider.format import (
|
|
|
|
|
normalize_endpoint_signature as _normalize_endpoint_signature,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return _normalize_endpoint_signature
|
|
|
|
|
if name == "build_provider_url":
|
|
|
|
|
from src.services.provider.transport import build_provider_url as _build_provider_url
|
|
|
|
|
|
|
|
|
|
return _build_provider_url
|
|
|
|
|
|
|
|
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|