Test Failed
Push — master ( 8a6195...3318f0 )
by P.R.
10:24
created

MySqlConnector.is_alive()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nop 1
crap 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
    @abc.abstractmethod
12 1
    def connect(self) -> MySQLConnection:
13
        """
14
        Connects to the MySql instance.
15
        """
16
        raise NotImplementedError()
17
18
    # ------------------------------------------------------------------------------------------------------------------
19 1
    @abc.abstractmethod
20 1
    def disconnect(self) -> None:
21
        """
22
        Disconnects from the MySql instance.
23
        """
24
        raise NotImplementedError()
25
26
    # ------------------------------------------------------------------------------------------------------------------
27 1
    @abc.abstractmethod
28 1
    def is_alive(self) -> bool:
29
        """
30
        Returns whether Python is (still) connected to a MySQL or MariaDB instance.
31
32
        :rtype: bool
33
        """
34
        raise NotImplementedError()
35
36
# ----------------------------------------------------------------------------------------------------------------------
37