Passed
Push — master ( aa21cd...9d2577 )
by Max
01:10
created

structured_data._descriptor.common.decorate()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
import functools
2
3
4
def decorate(matchers, structure, func):
5
    matchers.append((structure, func))
6
    return func
7
8
9
class Descriptor:
10
    """Base class for decorator classes."""
11
12
    __wrapped__ = None
13
14
    def __new__(cls, func, *args, **kwargs):
15
        new = super().__new__(cls, *args, **kwargs)
16
        new.__doc__ = None
17
        if func is None:
18
            return new
19
        return functools.wraps(func)(new)
20