sdoc.sdoc2.node.TitleNode.TitleNode.get_command()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 0
Metric Value
eloc 2
dl 5
loc 5
ccs 1
cts 2
cp 0.5
rs 10
c 0
b 0
f 0
cc 1
nop 1
crap 1.125
1 1
from typing import Dict
2
3 1
from cleo.io.io import IO
4
5 1
from sdoc.sdoc2.node.Node import Node
6 1
from sdoc.sdoc2.NodeStore import NodeStore
7
8
9 1 View Code Duplication
class TitleNode(Node):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10
    """
11
    Node for title in sdoc document.
12
    """
13
14
    # ------------------------------------------------------------------------------------------------------------------
15 1
    def __init__(self, io: IO, options: Dict[str, str], argument: str):
16
        """
17
        Object constructor.
18
19
        :param OutputStyle io: The IO object.
20
        :param dict[str,str] options: The options of the title.
21
        :param str argument:
22
        """
23
        super().__init__(io, 'title', options, argument)
24
25
    # ------------------------------------------------------------------------------------------------------------------
26 1
    def get_command(self) -> str:
27
        """
28
        Returns the command of this node, i.e. title.
29
        """
30
        return 'title'
31
32
    # ------------------------------------------------------------------------------------------------------------------
33 1
    def get_hierarchy_level(self, parent_hierarchy_level: int = -1) -> int:
34
        """
35
        Returns 0.
36
        """
37
        return 0
38
39
    # ------------------------------------------------------------------------------------------------------------------
40 1
    def is_block_command(self) -> bool:
41
        """
42
        Returns False.
43
        """
44
        return False
45
46
    # ------------------------------------------------------------------------------------------------------------------
47 1
    def is_inline_command(self) -> bool:
48
        """
49
        Returns True.
50
        """
51
        return True
52
53
54
# ----------------------------------------------------------------------------------------------------------------------
55
NodeStore.register_inline_command('title', TitleNode)
56