Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/typing.py
# Copyright (C) 2020-2022 The Software Heritage developers | # Copyright (C) 2020-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from typing import Any, Dict, List, Optional, TypeVar, Union | from typing import Any, Dict, List, Optional, TypeVar | ||||
from typing_extensions import TypedDict | from typing_extensions import TypedDict | ||||
from django.http import QueryDict | |||||
from swh.core.api.classes import PagedResult as CorePagedResult | from swh.core.api.classes import PagedResult as CorePagedResult | ||||
from swh.model.swhids import ObjectType | from swh.model.swhids import ObjectType | ||||
QueryParameters = Union[Dict[str, Any], QueryDict] | |||||
class OriginInfo(TypedDict): | class OriginInfo(TypedDict): | ||||
url: str | url: str | ||||
"""URL of the origin""" | """URL of the origin""" | ||||
class OriginMetadataInfo(TypedDict): | class OriginMetadataInfo(TypedDict): | ||||
url: str | url: str | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | class SnapshotContext(TypedDict): | ||||
branches_url: str | branches_url: str | ||||
"""snapshot branches list browse URL""" | """snapshot branches list browse URL""" | ||||
is_empty: bool | is_empty: bool | ||||
"""indicates if the snapshot is empty""" | """indicates if the snapshot is empty""" | ||||
origin_info: Optional[OriginInfo] | origin_info: Optional[OriginInfo] | ||||
"""optional origin info associated to the snapshot""" | """optional origin info associated to the snapshot""" | ||||
origin_visits_url: Optional[str] | origin_visits_url: Optional[str] | ||||
"""optional origin visits URL""" | """optional origin visits URL""" | ||||
query_params: QueryParameters | query_params: Dict[str, Optional[str]] | ||||
"""common query parameters when browsing snapshot content""" | """common query parameters when browsing snapshot content""" | ||||
release: Optional[str] | release: Optional[str] | ||||
"""optional release name set when browsing snapshot in that scope""" | """optional release name set when browsing snapshot in that scope""" | ||||
release_alias: bool | release_alias: bool | ||||
"""indicates if the focused release is an alias""" | """indicates if the focused release is an alias""" | ||||
release_id: Optional[str] | release_id: Optional[str] | ||||
"""optional release identifier set when browsing snapshot in that scope""" | """optional release identifier set when browsing snapshot in that scope""" | ||||
releases: List[SnapshotReleaseInfo] | releases: List[SnapshotReleaseInfo] | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |