| from __future__ import annotations | |
| from importlib import import_module | |
| from typing import TYPE_CHECKING, Any | |
| from .domain import ( | |
| Candidate, | |
| CandidateScoringError, | |
| RankedCandidate, | |
| RerankConfig, | |
| RerankRequest, | |
| RerankResult, | |
| ) | |
| from .keyboard_typo import KeyboardTypoConfig, KeyboardTypoCorrector | |
| from .reranker import Reranker | |
| from .romaji_ime import ( | |
| RomajiImeEngine, | |
| RomajiImeResult, | |
| RomajiInputError, | |
| TypoCorrection, | |
| WindowsImeBestOneProvider, | |
| WindowsImeProviderError, | |
| ) | |
| if TYPE_CHECKING: | |
| from .sidecar_client import ( | |
| CandidateSource, | |
| SidecarClient, | |
| SidecarControlResult, | |
| SidecarResult, | |
| ) | |
| _LAZY_SIDECAR_EXPORTS = frozenset( | |
| {"CandidateSource", "SidecarClient", "SidecarControlResult", "SidecarResult"} | |
| ) | |
| def __getattr__(name: str) -> Any: | |
| if name not in _LAZY_SIDECAR_EXPORTS: | |
| raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | |
| value = getattr(import_module(".sidecar_client", __name__), name) | |
| globals()[name] = value | |
| return value | |
| __all__ = [ | |
| "Candidate", | |
| "CandidateScoringError", | |
| "CandidateSource", | |
| "KeyboardTypoConfig", | |
| "KeyboardTypoCorrector", | |
| "RankedCandidate", | |
| "RerankConfig", | |
| "RerankRequest", | |
| "RerankResult", | |
| "Reranker", | |
| "RomajiImeEngine", | |
| "RomajiImeResult", | |
| "RomajiInputError", | |
| "SidecarClient", | |
| "SidecarControlResult", | |
| "SidecarResult", | |
| "TypoCorrection", | |
| "WindowsImeBestOneProvider", | |
| "WindowsImeProviderError", | |
| ] | |