| Total Complexity | 2 |
| Total Lines | 12 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """A utility function for guarding when adding elements to containers.""" |
||
| 2 | |||
| 3 | import typing |
||
| 4 | |||
| 5 | Item = typing.TypeVar("Item") |
||
| 6 | |||
| 7 | |||
| 8 | def not_in(*, container: typing.Container[Item], item: Item) -> None: |
||
| 9 | """Raise ValueError if ``item`` is in ``container``.""" |
||
| 10 | if item in container: |
||
| 11 | raise ValueError |
||
| 12 |