Passed
Push — master ( 4bb259...06915f )
by Simon
04:09
created

SearchProcessNoMem.__init__()   B

Complexity

Conditions 2

Size

Total Lines 43
Code Lines 37

Duplication

Lines 43
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 37
nop 13
dl 43
loc 43
rs 8.9919
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
from ..candidate import CandidateNoMem
6
from .search_process_base import SearchProcess
7
from ..results_manager import ResultsManager
8
9
10
class SearchProcessNoMem(SearchProcess):
11 View Code Duplication
    def __init__(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12
        self,
13
        nth_process,
14
        p_bar,
15
        model,
16
        search_space,
17
        search_name,
18
        n_iter,
19
        training_data,
20
        optimizer,
21
        n_jobs,
22
        init_para,
23
        memory,
24
        random_state,
25
    ):
26
        super().__init__(
27
            nth_process,
28
            p_bar,
29
            model,
30
            search_space,
31
            search_name,
32
            n_iter,
33
            training_data,
34
            optimizer,
35
            n_jobs,
36
            init_para,
37
            memory,
38
            random_state,
39
        )
40
41
        self.cand = CandidateNoMem(
42
            self.model,
43
            self.training_data,
44
            self.search_space,
45
            self.init_para,
46
            self.memory,
47
            p_bar,
48
        )
49
50
        if not isinstance(search_name, str):
51
            search_name = str(nth_process)
52
53
        self.res = ResultsManager(search_name, model, search_space, training_data)
54