PgSqlRoutineWrapperGeneratorWorker.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 3
dl 0
loc 8
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 1
from configparser import ConfigParser
2 1
from typing import Dict
3
4 1
from pystratum_backend.StratumStyle import StratumStyle
5 1
from pystratum_common.backend.CommonRoutineWrapperGeneratorWorker import CommonRoutineWrapperGeneratorWorker
6
7 1
from pystratum_pgsql.backend.PgSqlWorker import PgSqlWorker
8 1
from pystratum_pgsql.wrapper import create_routine_wrapper
9
10
11 1
class PgSqlRoutineWrapperGeneratorWorker(PgSqlWorker, CommonRoutineWrapperGeneratorWorker):
12
    """
13
    Class for generating a class with wrapper methods for calling stored routines in a PostgreSQL database.
14
    """
15
16
    # ------------------------------------------------------------------------------------------------------------------
17 1
    def __init__(self, io: StratumStyle, config: ConfigParser):
18
        """
19
        Object constructor.
20
21
        :param PyStratumStyle io: The output decorator.
22
        """
23 1
        PgSqlWorker.__init__(self, io, config)
24 1
        CommonRoutineWrapperGeneratorWorker.__init__(self, io, config)
25
26
    # ------------------------------------------------------------------------------------------------------------------
27 1
    def _write_routine_function(self, routine: Dict) -> None:
28
        """
29
        Generates a complete wrapper method for a stored routine.
30
31
        :param dict routine: The metadata of the stored routine.
32
        """
33 1
        wrapper = create_routine_wrapper(routine, self._lob_as_string_flag)
34 1
        self._code += wrapper.write_routine_method(routine)
35
36
# ----------------------------------------------------------------------------------------------------------------------
37