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

17 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-13 08:46 +0200

1import re 

2from abc import ABC 

3from typing import Any, Dict 

4 

5from pystratum_common.wrapper.Wrapper import Wrapper 

6 

7 

8class BulkWrapper(Wrapper, ABC): 

9 """ 

10 Wrapper method generator for stored procedures with designation type bulk. 

11 """ 

12 

13 # ------------------------------------------------------------------------------------------------------------------ 

14 def _return_type_hint(self) -> str: 

15 """ 

16 Returns the return type hint of the wrapper method. 

17 """ 

18 return 'int' 

19 

20 # ------------------------------------------------------------------------------------------------------------------ 

21 def _get_docstring_return_type(self) -> str: 

22 """ 

23 Returns the return type of the wrapper methods to be used in the docstring. 

24 """ 

25 return 'int' 

26 

27 # ------------------------------------------------------------------------------------------------------------------ 

28 @staticmethod 

29 def _get_wrapper_args(routine: Dict[str, Any]) -> str: 

30 """ 

31 Returns code for the parameters of the wrapper method for the stored routine. 

32 

33 :param routine: The routine metadata. 

34 """ 

35 parameters = Wrapper._get_wrapper_args(routine) 

36 

37 return re.sub(r'^self', 'self, bulk_handler', parameters) 

38 

39 # ------------------------------------------------------------------------------------------------------------------ 

40 def _write_docstring_parameters(self, routine: Dict[str, Any]) -> None: 

41 """ 

42 Writes the parameters part of the docstring for the wrapper method of a stored routine. 

43 

44 :param routine: The metadata of the stored routine. 

45 """ 

46 self._write_line('') 

47 self._write_line(':param pystratum.BulkHandler.BulkHandler bulk_handler: ' 

48 'The bulk handler for processing the selected rows.') 

49 

50 Wrapper._write_docstring_parameters(self, routine) 

51 

52# ----------------------------------------------------------------------------------------------------------------------