| Conditions | 3 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | 1 | from typing import Any |
|
| 36 | 1 | def __getattr__(self, item: str): |
|
| 37 | """ |
||
| 38 | injectable should never have it's attributes referenced or a method call. |
||
| 39 | This normally indicates that the default injectable value hasn't been |
||
| 40 | handled by lagom - which is likely a function missing a bind decorator. |
||
| 41 | """ |
||
| 42 | # Ignore dunder methods as it's likely some decorator magic and |
||
| 43 | # it doesn't really help to raise an exception then. |
||
| 44 | 1 | if item.startswith("__") and item.endswith("__"): |
|
| 45 | 1 | return None |
|
| 46 | 1 | raise InjectableNotResolved( |
|
| 47 | f"Cannot get {item} on injectable. Make sure the function was bound to a container instance" |
||
| 48 | ) |
||
| 53 |