Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_syncmaster /syncmaster /schemas /v1 /page.py
| # SPDX-FileCopyrightText: 2023-present MTS PJSC | |
| # SPDX-License-Identifier: Apache-2.0 | |
| import abc | |
| from typing import Any | |
| from pydantic import BaseModel | |
| from syncmaster.db.utils import Pagination | |
| class MetaPageSchema(BaseModel): | |
| page: int | |
| pages: int | |
| total: int | |
| page_size: int | |
| has_next: bool | |
| has_previous: bool | |
| next_page: int | None = None | |
| previous_page: int | None = None | |
| class PageSchema(BaseModel, abc.ABC): | |
| meta: MetaPageSchema | |
| items: list[Any] | |
| def from_pagination(cls, pagination: Pagination): | |
| return cls( | |
| meta=MetaPageSchema( | |
| page=pagination.page, | |
| pages=pagination.pages, | |
| page_size=pagination.page_size, | |
| total=pagination.total, | |
| has_next=pagination.has_next, | |
| has_previous=pagination.has_previous, | |
| next_page=pagination.next_page, | |
| previous_page=pagination.previous_page, | |
| ), | |
| items=pagination.items, | |
| ) | |
Xet Storage Details
- Size:
- 1.05 kB
- Xet hash:
- fd08e80d799b6b9afd288904f50187dcae499054ca9bf07d54301b3b42d277f4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.