jacked.matchers._list.ListMatcher.match()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nop 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
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