Test Failed
Push — master ( 7c9493...8a6195 )
by P.R.
09:18
created

pystratum_mysql.wrapper.MySqlRowsWrapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 27
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A MySqlRowsWrapper._write_result_handler() 0 5 1
A MySqlRowsWrapper._return_type_hint() 0 7 1
1 1
from typing import Dict, Any
2
3 1
from pystratum_common.wrapper.RowsWrapper import RowsWrapper
4 1
from pystratum_mysql.wrapper.MySqlWrapper import MySqlWrapper
5
6
7 1
class MySqlRowsWrapper(MySqlWrapper, RowsWrapper):
8
    """
9
    Wrapper method generator for stored procedures that are selecting 0, 1, or more rows.
10
    """
11
12
    # ------------------------------------------------------------------------------------------------------------------
13 1
    def _return_type_hint(self) -> str:
14
        """
15
        Returns the return type hint of the wrapper method.
16
17
        :rtype: str
18
        """
19
        return 'List[Dict[str, Any]]'
20
21
    # ------------------------------------------------------------------------------------------------------------------
22 1
    def _write_result_handler(self, routine: Dict[str, Any]) -> None:
23
        """
24
        Generates code for calling the stored routine in the wrapper method.
25
        """
26
        self._write_line('return self.execute_sp_rows({0!s})'.format(self._generate_command(routine)))
27
28
29
# ----------------------------------------------------------------------------------------------------------------------
30