pystratum_cli.application.StratumApplication   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 22
dl 0
loc 37
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A StratumApplication.render_error() 0 7 2
A StratumApplication.__init__() 0 10 1
1 1
from cleo.application import Application
2
from cleo.io.io import IO
3 1
from cleo.io.outputs.output import Verbosity
4
from pystratum_backend.StratumIO import StratumIO
5 1
6 1
from pystratum_cli.command.ConstantsCommand import ConstantsCommand
7 1
from pystratum_cli.command.RoutineLoaderCommand import RoutineLoaderCommand
8 1
from pystratum_cli.command.RoutineWrapperCommand import RoutineWrapperCommand
9
from pystratum_cli.command.StratumCommand import StratumCommand
10
11 1
12
class StratumApplication(Application):
13
    """
14
    The PyStratum application.
15
    """
16
17 1
    # ------------------------------------------------------------------------------------------------------------------
18
    def __init__(self):
19
        """
20
        Object constructor
21 1
        """
22
        Application.__init__(self, 'pystratum', '1.0.4')
23
24 1
        self.add(ConstantsCommand())
25
        self.add(RoutineLoaderCommand())
26
        self.add(StratumCommand())
27
        self.add(RoutineWrapperCommand())
28
29
    # ------------------------------------------------------------------------------------------------------------------
30 1
    def render_error(self, error: Exception, io: IO) -> None:
31
        if io.output.verbosity == Verbosity.NORMAL:
32 1
            my_io = StratumIO(io.input, io.output, io.error_output)
33 1
            lines = [error.__class__.__name__, str(error)]
34 1
            my_io.error(lines)
35 1
        else:
36
            Application.render_error(self, error, io)
37 1
38
# ----------------------------------------------------------------------------------------------------------------------
39