Total Complexity | 1 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """This module contains the apis that power Injectify.""" |
||
2 | |||
3 | |||
4 | def inject(target, injector): |
||
5 | """A decorator that injects code in the target object. |
||
6 | |||
7 | Args: |
||
8 | target: The object to inject code into. |
||
9 | injector: A :class:`~injectify.injectors.BaseInjector` to represent an |
||
10 | injection point. |
||
11 | """ |
||
12 | |||
13 | def decorator(f): |
||
14 | injector.prepare(target=target, handler=f) |
||
15 | injector.compile(injector.visit_target()) |
||
16 | return f |
||
17 | |||
18 | return decorator |
||
19 |