Coverage for pystratum_common/wrapper/BulkWrapper.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import re
2from abc import ABC
3from typing import Any, Dict
5from pystratum_common.wrapper.Wrapper import Wrapper
8class BulkWrapper(Wrapper, ABC):
9 """
10 Wrapper method generator for stored procedures with designation type bulk.
11 """
13 # ------------------------------------------------------------------------------------------------------------------
14 def _return_type_hint(self) -> str:
15 """
16 Returns the return type hint of the wrapper method.
18 :rtype: str
19 """
20 return 'int'
22 # ------------------------------------------------------------------------------------------------------------------
23 def _get_docstring_return_type(self) -> str:
24 """
25 Returns the return type of the wrapper methods the be used in the docstring.
27 :rtype: str
28 """
29 return 'int'
31 # ------------------------------------------------------------------------------------------------------------------
32 @staticmethod
33 def _get_wrapper_args(routine: Dict[str, Any]) -> str:
34 """
35 Returns code for the parameters of the wrapper method for the stored routine.
37 :param dict[str,*] routine: The routine metadata.
39 :rtype: str
40 """
41 parameters = Wrapper._get_wrapper_args(routine)
43 return re.sub(r'^self', 'self, bulk_handler', parameters)
45 # ------------------------------------------------------------------------------------------------------------------
46 def _write_docstring_parameters(self, routine: Dict[str, Any]) -> None:
47 """
48 Writes the parameters part of the docstring for the wrapper method of a stored routine.
50 :param dict routine: The metadata of the stored routine.
51 """
52 self._write_line('')
53 self._write_line(':param pystratum.BulkHandler.BulkHandler bulk_handler: '
54 'The bulk handler for processing the selected rows.')
56 Wrapper._write_docstring_parameters(self, routine)
58# ----------------------------------------------------------------------------------------------------------------------