Passed
Push — master ( 1ac98c...ed1e15 )
by P.R.
01:49
created

ChapterNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 9 1
A get_hierarchy_level() 0 7 1
A get_command() 0 7 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9 1
from sdoc.sdoc2.NodeStore import NodeStore
10 1
from sdoc.sdoc2.node.HeadingNode import HeadingNode
11
12
13 1
class ChapterNode(HeadingNode):
14
    """
15
    SDoc2 node for chapters.
16
    """
17
18
    # ------------------------------------------------------------------------------------------------------------------
19 1
    def __init__(self, io, options, argument):
20
        """
21
        Object constructor.
22
23
        :param None|cleo.styles.output_style.OutputStyle io: The IO object.
24
        :param dict[str,str] options: The options of this chapter.
25
        :param str argument: The title of this chapter.
26
        """
27 1
        super().__init__(io, 'chapter', options, argument)
28
29
    # ------------------------------------------------------------------------------------------------------------------
30 1
    def get_command(self):
31
        """
32
        Returns the command of this node, i.e. chapter.
33
34
        :rtype: str
35
        """
36 1
        return 'chapter'
37
38
    # ------------------------------------------------------------------------------------------------------------------
39 1
    def get_hierarchy_level(self, parent_hierarchy_level=-1):
40
        """
41
        Returns 1.
42
43
        :rtype: int
44
        """
45 1
        return 1
46
47
48
# ----------------------------------------------------------------------------------------------------------------------
49
NodeStore.register_inline_command('chapter', ChapterNode)
50