PgSqlSingleton1Wrapper._write_result_handler()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 8
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 1
from typing import Any, Dict
2
3 1
from pystratum_common.wrapper.Singleton1Wrapper import Singleton1Wrapper
4
5 1
from pystratum_pgsql.wrapper.PgSqlWrapper import PgSqlWrapper
6
7
8 1
class PgSqlSingleton1Wrapper(PgSqlWrapper, Singleton1Wrapper):
9
    """
10
    Wrapper method generator for stored procedures that are selecting 1 row with one column only.
11
    """
12
13
    # ------------------------------------------------------------------------------------------------------------------
14 1
    def _write_result_handler(self, routine: Dict[str, Any]) -> None:
15
        """
16
        Generates code of the return statement of the wrapper method for invoking a stored routine.
17
18
        :param dict routine: Metadata of the stored routine.
19
        """
20 1
        self._write_line(
21
                'return self.execute_sp_singleton1({0!s})'.format(str(self._generate_command(routine))))
22
23
# ----------------------------------------------------------------------------------------------------------------------
24