Completed
Pull Request — master (#36)
by Wojtek
02:16
created

Optimizer.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 3
cts 3
cp 1
cc 1
crap 1
1
"""Basic optimizer."""
2 1
from networkx import topological_sort
0 ignored issues
show
Configuration introduced by
The import networkx 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
5 1
class Optimizer(object):
6
    """Optimizer is object which optimize process."""
7
8 1
    def __init__(self, process):
9 1
        self.process = process
10 1
        self.ordered_stages = topological_sort(self.process)
11
12 1
    def set_custom_optimizing_order(self, ordered_stages):
13
        """Set custom order."""
14 1
        if set(self.ordered_stages) == set(ordered_stages) and len(
15
                self.ordered_stages) == len(ordered_stages):
16 1
            self.ordered_stages = ordered_stages
17
        else:
18
            raise ValueError("List of stages must contain all stages.")
19