quiz_element   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 17
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A QuizElement.__init__() 0 11 2
A QuizElement.__str__() 0 5 2
1
from .illustrations.illustration import Illustration  # type: ignore
2
3
4
class QuizElement:
5
    def __init__(
6
        self,
7
        text: str,
8
        illustration: Illustration | None = None,
9
    ) -> None:
10
        assert isinstance(text, str)
11
        self.text = text
12
13
        if illustration:
14
            assert isinstance(illustration, Illustration)
15
        self.illustration = illustration
16
17
    def __str__(self) -> str:
18
        text = self.text
19
        if self.illustration:
20
            text += str(self.illustration)
21
        return text
22