Completed
Push — master ( 0ea567...c0c100 )
by P.R.
02:52
created

DateNode   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 53.85%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
dl 0
loc 60
ccs 7
cts 13
cp 0.5385
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A is_inline_command() 0 7 1
A __init__() 0 9 1
A get_command() 0 7 1
A is_block_command() 0 7 1
A get_hierarchy_level() 0 7 1
A is_phrasing() 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.Node import Node
11
12
13 1
class DateNode(Node):
14
    """
15
    Node for date in sdoc document.
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 the date.
25
        :param str argument:
26
        """
27
        super().__init__(io, 'date', options, argument)
28
29
    # ------------------------------------------------------------------------------------------------------------------
30 1
    def get_command(self):
31
        """
32
        Returns the command of this node, i.e. date.
33
34
        :rtype: str
35
        """
36
        return 'date'
37
38
    # ------------------------------------------------------------------------------------------------------------------
39 1
    def get_hierarchy_level(self, parent_hierarchy_level=-1):
40
        """
41
        Returns 0.
42
43
        :rtype: int
44
        """
45
        return 0
46
47
    # ------------------------------------------------------------------------------------------------------------------
48 1
    def is_block_command(self):
49
        """
50
        Returns False.
51
52
        :rtype: bool
53
        """
54
        return False
55
56
    # ------------------------------------------------------------------------------------------------------------------
57 1
    def is_inline_command(self):
58
        """
59
        Returns True.
60
61
        :rtype: bool
62
        """
63
        return True
64
65
    # ------------------------------------------------------------------------------------------------------------------
66 1
    def is_phrasing(self):
67
        """
68
        Returns True.
69
70
        :rtype: bool
71
        """
72
        return True
73
74
# ----------------------------------------------------------------------------------------------------------------------
75
NodeStore.register_inline_command('date', DateNode)
76