lagom.experimental.definitions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A PlainFunction.get_instance() 0 2 1
A PlainFunction.__init__() 0 3 1
1
"""
2
Similar to the main definitions module but these definitions do not
3
yet have a stable interface.
4
"""
5
6 1
from ..definitions import X, ConstructionWithContainer
7 1
from ..interfaces import SpecialDepDefinition, ReadableContainer
8
9
10 1
class PlainFunction(SpecialDepDefinition[X]):
11
    """Preserves a function without any dep injection performed on it"""
12
13 1
    callable_func: X
14
15 1
    def __init__(self, callable_func: X):
16
        """"""
17 1
        self.callable_func = callable_func
18
19 1
    def get_instance(self, _container: ReadableContainer) -> X:
20 1
        return self.callable_func
21
22
23 1
class AsyncConstructionWithContainer(ConstructionWithContainer):
24
    pass
25