Passed
Pull Request — master (#6)
by Konstantinos
03:56
created

artificial_artwork.pretrained_model.model_handler_interface   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 22
dl 0
loc 32
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A PretrainedModelRoutinesCapable.get_layers_dict() 0 1 1
A PretrainedModelRoutinesCapable.get_weights() 0 1 1
A ModelHandlerInterface.model_load_exception_text() 0 4 1
A PretrainedModelRoutinesCapable.get_id() 0 1 1
A ModelHandlerInterface.model_routines() 0 4 1
A PretrainedModelRoutinesCapable.load_layers() 0 1 1
A ModelHandlerInterface.environment_variable() 0 4 1
1
from abc import ABC, abstractmethod
2
from typing import Dict, Protocol, Tuple
3
from numpy.typing import NDArray
4
5
6
class PretrainedModelRoutinesCapable(Protocol):
7
    def load_layers(self, file_path: str) -> NDArray: ...
8
9
    def get_id(self, layer: NDArray) -> str: ...
10
    
11
    def get_layers_dict(self, layers: NDArray) -> Dict[str, NDArray]: ...
12
13
    def get_weights(self, layer: NDArray) -> Tuple[NDArray, NDArray]: ...
14
15
16
class ModelHandlerInterface(ABC):
17
18
    @property
19
    @abstractmethod
20
    def environment_variable(self) -> str:
21
        raise NotImplementedError
22
23
    @property
24
    @abstractmethod
25
    def model_routines(self) -> PretrainedModelRoutinesCapable:
26
        raise NotImplementedError
27
28
    @property
29
    @abstractmethod
30
    def model_load_exception_text(self) -> str:
31
        raise NotImplementedError