PlainFunction.get_instance()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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