pystratum_mysql.MySqlConnector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A MySqlConnector.connect() 0 6 1
A MySqlConnector.disconnect() 0 6 1
A MySqlConnector.is_alive() 0 6 1
1 1
import abc
2
3 1
from mysql.connector import MySQLConnection
4
5
6 1
class MySqlConnector:
7
    """
8
    Interface for classes for connecting to a MySql instances.
9
    """
10
11 1
    # ------------------------------------------------------------------------------------------------------------------
12 1
    @abc.abstractmethod
13
    def connect(self) -> MySQLConnection:
14
        """
15
        Connects to the MySql instance.
16
        """
17
        raise NotImplementedError()
18
19 1
    # ------------------------------------------------------------------------------------------------------------------
20 1
    @abc.abstractmethod
21
    def disconnect(self) -> None:
22
        """
23
        Disconnects from the MySql instance.
24
        """
25
        raise NotImplementedError()
26
27 1
    # ------------------------------------------------------------------------------------------------------------------
28 1
    @abc.abstractmethod
29
    def is_alive(self) -> bool:
30
        """
31
        Returns whether Python is (still) connected to a MySQL or MariaDB instance.
32
        """
33
        raise NotImplementedError()
34
35
# ----------------------------------------------------------------------------------------------------------------------
36