Download apps/client/services/query/client_get_query_service.py from jun2024/fc: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/client/services/query/client_get_query_service.py
- Command line
-
hf download hf://spaces/jun2024/fc/apps/client/services/query/client_get_query_service.py
-
curl -L -o client_get_query_service.py https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/client/services/query/client_get_query_service.py
1.02 kB
| """当事人单条查询服务。""" | |
| from typing import Any | |
| from django.utils.translation import gettext_lazy as _ | |
| from apps.client.models import Client | |
| from apps.client.services.client_internal_query_service import ClientInternalQueryService | |
| from apps.core.exceptions import NotFoundError | |
| class ClientGetQueryService: | |
| def __init__(self, internal_query_service: ClientInternalQueryService | None = None) -> None: | |
| self._internal_query_service = internal_query_service | |
| def internal_query_service(self) -> ClientInternalQueryService: | |
| if self._internal_query_service is None: | |
| self._internal_query_service = ClientInternalQueryService() | |
| return self._internal_query_service | |
| def get_client(self, *, client_id: int, user: Any | None = None) -> Client: | |
| client = self.internal_query_service.get_client(client_id=client_id) | |
| if not client: | |
| raise NotFoundError(message=_("客户不存在"), code="CLIENT_NOT_FOUND") | |
| return client | |