Changeset View
Changeset View
Standalone View
Standalone View
swh/web/misc/badges.py
# Copyright (C) 2019-2021 The Software Heritage developers | # Copyright (C) 2019-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 base64 import b64encode | from base64 import b64encode | ||||
from typing import Optional, cast | from typing import Optional, cast | ||||
from pybadges import badge | from pybadges import badge | ||||
from django.conf.urls import url | |||||
from django.contrib.staticfiles import finders | from django.contrib.staticfiles import finders | ||||
from django.http import HttpRequest, HttpResponse | from django.http import HttpRequest, HttpResponse | ||||
from django.urls import re_path as url | |||||
from swh.model.exceptions import ValidationError | from swh.model.exceptions import ValidationError | ||||
from swh.model.hashutil import hash_to_bytes, hash_to_hex | from swh.model.hashutil import hash_to_bytes, hash_to_hex | ||||
from swh.model.swhids import CoreSWHID, ObjectType, QualifiedSWHID | from swh.model.swhids import CoreSWHID, ObjectType, QualifiedSWHID | ||||
from swh.web.common import archive | from swh.web.common import archive | ||||
from swh.web.common.exc import BadInputExc, NotFoundExc | from swh.web.common.exc import BadInputExc, NotFoundExc | ||||
from swh.web.common.identifiers import parse_object_type, resolve_swhid | from swh.web.common.identifiers import parse_object_type, resolve_swhid | ||||
from swh.web.common.utils import reverse | from swh.web.common.utils import reverse | ||||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |