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

lagom.functools   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 21
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A wraps() 0 13 2
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 the wrapping object may not have __dict__
12
    """
13
14 1
    def _wrapper(wrapping):
15 1
        return functools_wraps(
16
            wrapped,
17
            updated=WRAPPER_UPDATES if hasattr(wrapping, "__dict__") else tuple(),
18
        )(wrapping)
19
20
    return _wrapper
21