Changeset View
Changeset View
Standalone View
Standalone View
swh/web/misc/badges.py
# Copyright (C) 2019-2021 The Software Heritage developers | # Copyright (C) 2019-2021 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.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 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.identifiers 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 | ||||
_orange = "#f36a24" | _orange = "#f36a24" | ||||
_blue = "#0172b2" | _blue = "#0172b2" | ||||
_red = "#cd5741" | _red = "#cd5741" | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |