def from_bugzilla()

in jobs/webcompat-kb/webcompat_kb/bugzilla.py [0:0]


    def from_bugzilla(cls, bug: bugdantic.bugzilla.Bug) -> Self:
        assert bug.id is not None
        assert bug.summary is not None
        assert bug.status is not None
        assert bug.resolution is not None
        assert bug.product is not None
        assert bug.component is not None
        assert bug.creator is not None
        assert bug.see_also is not None
        assert bug.depends_on is not None
        assert bug.blocks is not None
        assert bug.priority is not None
        assert bug.severity is not None
        assert bug.creation_time is not None
        assert bug.assigned_to is not None
        assert bug.keywords is not None
        assert bug.url is not None
        assert bug.last_change_time is not None
        assert bug.whiteboard is not None
        assert bug.cf_user_story is not None

        return cls(
            id=bug.id,
            summary=bug.summary,
            status=bug.status,
            resolution=bug.resolution,
            product=bug.product,
            component=bug.component,
            see_also=bug.see_also,
            depends_on=bug.depends_on,
            blocks=bug.blocks,
            priority=extract_int_from_field(
                bug.priority,
                value_map={
                    "--": None,
                },
            ),
            severity=extract_int_from_field(
                bug.severity,
                value_map={
                    "n/a": None,
                    "--": None,
                    "blocker": 1,
                    "critical": 1,
                    "major": 2,
                    "normal": 3,
                    "minor": 4,
                    "trivial": 4,
                    "enhancement": 4,
                },
            ),
            creation_time=bug.creation_time,
            assigned_to=bug.assigned_to
            if bug.assigned_to != "nobody@mozilla.org"
            else None,
            keywords=bug.keywords,
            url=bug.url,
            user_story=bug.cf_user_story,
            last_resolved=bug.cf_last_resolved,
            last_change_time=bug.last_change_time,
            whiteboard=bug.whiteboard,
            creator=bug.creator,
            size_estimate=(
                bug.cf_size_estimate if bug.cf_size_estimate != "---" else None
            ),
            webcompat_priority=(
                bug.cf_webcompat_priority
                if bug.cf_webcompat_priority != "---"
                else None
            ),
            webcompat_score=extract_int_from_field(
                bug.cf_webcompat_score,
                value_map={
                    "---": None,
                    "?": None,
                },
            ),
        )