Completed
Pull Request — master (#27)
by Wojtek
06:24
created

__init__()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 6
rs 9.4285
1
"""Contains factory class of process with calls stages."""
2
from main.model.processes.monotype_process import MonotypeProcess
0 ignored issues
show
Bug introduced by
The name model does not seem to exist in module main.
Loading history...
Configuration introduced by
The import main.model.processes.monotype_process 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...
Unused Code introduced by
Unused MonotypeProcess imported from main.model.processes.monotype_process
Loading history...
3
4
from main.model.processes.calls_process import CallsProcess
0 ignored issues
show
Bug introduced by
The name model does not seem to exist in module main.
Loading history...
Configuration introduced by
The import main.model.processes.calls_process 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...
5
from main.model.stages.calls_stage import CallsStage
0 ignored issues
show
Bug introduced by
The name model does not seem to exist in module main.
Loading history...
Configuration introduced by
The import main.model.stages.calls_stage 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...
6
7
8
class CallsProcessFactory:
9
    """Class which produce process with the same type of stages.
10
11
    Attributes:
12
        structure_type (str): represent type of structure
13
        how_many_nodes (int): how many nodes should be in generated process
14
        process (CallsProcess): process which will be incrementally build
15
    """
16
17
    def __init__(self, structure_type, how_many_nodes):
18
        """Constructor."""
19
        self._stages_to_add = []
20
        self.structure_type = structure_type
21
        self.how_many_nodes = how_many_nodes
22
        self.process = CallsProcess()
23
24
    def _update_structure(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
25
        if "linear" == self.structure_type:
26
            self.process.add_path(self._stages_to_add)
27
28
    def _create_stages(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
29
        for i in range(self.how_many_nodes):
0 ignored issues
show
Unused Code introduced by
The variable i seems to be unused.
Loading history...
30
            self._stages_to_add += CallsStage()
31
32
    def construct_process(self):
33
        """Construct process."""
34
        self._create_stages()
35
        self._update_structure()
36
        return self.process
37