Conditions | 4 |
Total Lines | 15 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """ |
||
14 | def match( |
||
15 | self, |
||
16 | hint: object, |
||
17 | injectable: Injectable, |
||
18 | container: Container): |
||
19 | # The hint is a regular type, so we're expecting to inject an instance. |
||
20 | if (inspect.isclass(injectable.subject) |
||
21 | and issubclass(injectable.subject, hint)): |
||
22 | if injectable.singleton: |
||
23 | container.set_instance(hint, injectable.subject(), |
||
24 | injectable.priority) |
||
25 | result = container.get_instance(hint) |
||
26 | else: |
||
27 | result = injectable.subject() |
||
28 | return result |
||
29 | |||
35 |