Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 87.5% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """ |
||
12 | 1 | class Format: |
|
1 ignored issue
–
show
|
|||
13 | """ |
||
14 | Abstract parent class for all formatters for generating output documents in a certain format. |
||
15 | """ |
||
16 | |||
17 | # ------------------------------------------------------------------------------------------------------------------ |
||
18 | 1 | def __init__(self, io, config): |
|
1 ignored issue
–
show
|
|||
19 | """ |
||
20 | Object constructor. |
||
21 | |||
22 | :param cleo.styles.output_style.OutputStyle io: The IO object. |
||
23 | :param configparser.SectionProxy config: The section in the config file for the target_format. |
||
24 | """ |
||
25 | 1 | self._io = io |
|
26 | """ |
||
27 | The IO object. |
||
28 | |||
29 | :type: cleo.styles.output_style.OutputStyle |
||
30 | """ |
||
31 | |||
32 | 1 | self._errors = 0 |
|
33 | 1 | """ |
|
34 | The error count. |
||
35 | |||
36 | :type: int |
||
37 | """ |
||
38 | |||
39 | # ------------------------------------------------------------------------------------------------------------------ |
||
40 | 1 | @property |
|
41 | def errors(self): |
||
42 | """ |
||
43 | Getter for the error count. |
||
44 | |||
45 | :rtype: int |
||
46 | """ |
||
47 | return self._errors |
||
48 | |||
49 | # ------------------------------------------------------------------------------------------------------------------ |
||
50 | 1 | @abc.abstractmethod |
|
51 | def generate(self): |
||
52 | """ |
||
53 | Starts generating HTML file. |
||
54 | """ |
||
55 | raise NotImplementedError() |
||
56 | |||
58 |
Abstract classes which are used only once can usually be inlined into the class which already uses this abstract class.