Download apps/message_hub/services/__init__.py from jun2024/fc: direct link, hf CLI and curl.
- Browser
- Download file 829 Bytes
-
https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/message_hub/services/__init__.py
- Command line
-
hf download hf://spaces/jun2024/fc/apps/message_hub/services/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/message_hub/services/__init__.py
829 Bytes
| """Services init — fetcher 工厂。""" | |
| from __future__ import annotations | |
| from apps.message_hub.services.base import MessageFetcher | |
| def get_fetcher(source_type: str) -> MessageFetcher: | |
| from apps.message_hub.models import SourceType | |
| from apps.message_hub.services.court.court_fetcher import CourtInboxFetcher | |
| from apps.message_hub.services.court.court_schedule_fetcher import CourtScheduleFetcher | |
| from apps.message_hub.services.imap.imap_fetcher import ImapFetcher | |
| if source_type == SourceType.IMAP: | |
| return ImapFetcher() | |
| if source_type == SourceType.COURT_INBOX: | |
| return CourtInboxFetcher() | |
| if source_type == SourceType.COURT_SCHEDULE: | |
| return CourtScheduleFetcher() | |
| raise ValueError(f"未知来源类型: {source_type}") | |
| __all__ = ["MessageFetcher", "get_fetcher"] | |