Passed
Push — master ( f66331...b4dcf5 )
by Simon
01:56
created

hyperactive.opt._common._score_params()   A

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 2
nop 2
1
"""Common functions used by multiple optimizers."""
2
3
__all__ = ["_score_params"]
4
5
6
def _score_params(params, meta):
7
    """Score parameters, used in parallelization."""
8
    meta = meta.copy()
9
    experiment = meta["experiment"]
10
    error_score = meta["error_score"]
11
12
    try:
13
        return experiment(**params)
14
    except Exception:  # noqa: B904
15
        # Catch all exceptions and assign error_score
16
        return error_score
17