Passed
Pull Request — master (#226)
by Steve
02:52
created

lagom.functools.wraps()   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 1
dl 0
loc 7
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
"""
2
Exports some modified versions of functions from functools
3
"""
4
5 1
from functools import wraps as functools_wraps, WRAPPER_UPDATES
6
7
8 1
def wraps(wrapped):
9
    """
10
    This has the same functionality as single arity functools.wraps but deals with the case
11
    where wrapped may not have __dict__
12
    """
13 1
    return functools_wraps(
14
        wrapped, updated=WRAPPER_UPDATES if hasattr(wrapped, "__dict__") else tuple()
15
    )
16