MySqlConnector.disconnect()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 1
cts 1
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
    # ------------------------------------------------------------------------------------------------------------------
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