AbstractStage   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 0 Features 0
Metric Value
c 6
b 0
f 0
dl 0
loc 57
ccs 24
cts 24
cp 1
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A get_quality() 0 4 1
A is_enough_quality() 0 4 1
A get_output_of_stage() 0 4 1
A could_be_optimized() 0 4 1
A __init__() 0 15 1
A get_cost() 0 4 1
A get_maximal_acceptable_cost() 0 4 1
1
"""Module represent single stage in process."""
2 1
import numpy as np
0 ignored issues
show
Configuration introduced by
The import numpy could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
3
4 1
from grortir.main.model.core.optimization_status import OptimizationStatus
5
6
7
# pylint: disable=too-many-instance-attributes
0 ignored issues
show
introduced by
Locally disabling too-many-instance-attributes (R0902)
Loading history...
8
9
10 1
class AbstractStage:
11
    """Class represent single stage in process.
12
13
    Attributes:
14
        input_vector (list): initial vector
15
        optimization_status (OptimizationStatus): status of optimization
16
        control_params (list): actual control params
17
        lower_bounds (list): lower bounds for control params
18
        upper_bounds (list): upper bounds for control params
19
20
    """
21
22 1
    def __init__(self, input_vector=()):
23
        """Constructor.
24
25
        Args:
26
            input_vector (tuple): initial vector
27
        """
28 1
        self.input_vector = input_vector
29 1
        self.optimization_status = OptimizationStatus.not_started
30 1
        self.control_params = np.zeros_like(input_vector)
31 1
        dimensions = len(input_vector)
32 1
        self.lower_bounds = [-1] * dimensions
33 1
        self.upper_bounds = [1] * dimensions
34 1
        self.final_output = None
35 1
        self.final_quality = None
36 1
        self.final_cost = None
37
38 1
    @staticmethod
39
    def get_cost():
40
        """Return cost of stage."""
41 1
        raise NotImplementedError
42
43 1
    @staticmethod
44 1
    def get_quality(input_vector=None, control_params=None):
45
        """Return quality of stage."""
46 1
        raise NotImplementedError
47
48 1
    @staticmethod
49
    def could_be_optimized():
50
        """Return answer if it is still possible to optimize that stage."""
51 1
        raise NotImplementedError
52
53 1
    @staticmethod
54
    def is_enough_quality(value):
55
        """Return True if value is enough quality."""
56 1
        raise NotImplementedError
57
58 1
    @staticmethod
59
    def get_output_of_stage():
60
        """Result of processing input with current control params."""
61 1
        raise NotImplementedError
62
63 1
    @staticmethod
64
    def get_maximal_acceptable_cost():
65
        """Return maximum acceptable cost."""
66
        raise NotImplementedError
67