Passed
Branch master (1f5add)
by P.R.
08:44
created

DataTypeHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pystratum_common.helper.DataTypeHelper.DataTypeHelper.column_type_to_python_type_hint() 0 10 1
A pystratum_common.helper.DataTypeHelper.DataTypeHelper.column_type_to_python_type() 0 10 1
1
import abc
2
from typing import Any, Dict
3
4
5
class DataTypeHelper(metaclass=abc.ABCMeta):
6
    """
7
    Utility class for deriving information based on a DBMS native data type.
8
    """
9
10
    # ------------------------------------------------------------------------------------------------------------------
11
    @abc.abstractmethod
12
    def column_type_to_python_type(self, data_type_info: Dict[str, Any]) -> str:
13
        """
14
        Returns the corresponding Python data type of a DBMS native data type.
15
16
        :param dict data_type_info: The DBMS native data type metadata.
17
18
        :rtype: str
19
        """
20
        raise NotImplementedError()
21
22
    # ------------------------------------------------------------------------------------------------------------------
23
    @abc.abstractmethod
24
    def column_type_to_python_type_hint(self, data_type_info: Dict[str, Any]) -> str:
25
        """
26
        Returns the corresponding Python data type hint of a MySQL data type.
27
28
        :param dict data_type_info: The MySQL data type metadata.
29
30
        :rtype: str
31
        """
32
        raise NotImplementedError()
33
34
# ----------------------------------------------------------------------------------------------------------------------
35