jacked.matchers._list   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ListMatcher.match() 0 8 1
A ListMatcher._matching_type() 0 2 1
1
"""
2
PRIVATE MODULE: do not import (from) it directly.
3
4
This module contains the ``ListMatcher``class.
5
"""
6
import inspect
7
from jacked._inject import get_candidates
8
from jacked._injectable import Injectable
9
from jacked._container import Container
10
from jacked.matchers._base_matcher import BaseMatcher
11
12
13
class ListMatcher(BaseMatcher):
14
15
    def match(
16
            self,
17
            hint: object,
18
            injectable: Injectable,
19
            container: Container):
20
        sub_hint = getattr(hint, '__args__', [None])[0]
21
        param = inspect.Parameter(name='_', kind=1, annotation=sub_hint)
22
        return get_candidates(param.annotation, container=container)
23
24
    def _matching_type(self):
25
        return list
26