Total Complexity | 3 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
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 | |||
37 |