Changeset View
Changeset View
Standalone View
Standalone View
swh/fuse/tests/api_url.py
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020 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 General Public License version 3, or any later version | # License: GNU 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 enum import Enum | from enum import Enum | ||||
from typing import Union | from typing import Union | ||||
from swh.model.hashutil import hash_to_hex | from swh.model.hashutil import hash_to_hex | ||||
from swh.model.identifiers import CoreSWHID, ObjectType | from swh.model.swhids import CoreSWHID, ObjectType | ||||
GRAPH_API_REQUEST = Enum("GRAPH_API_REQUEST", "HISTORY") | GRAPH_API_REQUEST = Enum("GRAPH_API_REQUEST", "HISTORY") | ||||
def swhid_to_web_url(swhid: Union[CoreSWHID, str], raw: bool = False) -> str: | def swhid_to_web_url(swhid: Union[CoreSWHID, str], raw: bool = False) -> str: | ||||
if isinstance(swhid, str): | if isinstance(swhid, str): | ||||
swhid = CoreSWHID.from_string(swhid) | swhid = CoreSWHID.from_string(swhid) | ||||
Show All 25 Lines |