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

hyperactive.opt._common   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _score_params() 0 11 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