pystratum_pgsql.PgSqlConnector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A PgSqlConnector.disconnect() 0 6 1
A PgSqlConnector.connect() 0 8 1
1 1
import abc
2 1
from typing import Any
3
4
5 1
class PgSqlConnector:
6
    """
7
    Interface for classes for connecting to a PostgreSQL instances.
8
    """
9
10
    # ------------------------------------------------------------------------------------------------------------------
11 1
    @abc.abstractmethod
12 1
    def connect(self) -> Any:
13
        """
14
        Connects to a PostgreSQL instance.
15
16
        :rtype: psycopg2.extensions.connection
17
        """
18
        raise NotImplementedError()
19
20
    # ------------------------------------------------------------------------------------------------------------------
21 1
    @abc.abstractmethod
22 1
    def disconnect(self) -> None:
23
        """
24
        Disconnects from a PostgreSQL instance.
25
        """
26
        raise NotImplementedError()
27
28
# ----------------------------------------------------------------------------------------------------------------------
29