Total Complexity | 2 |
Total Lines | 12 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import typing |
||
2 | |||
3 | _K = typing.TypeVar("_K") |
||
4 | _V = typing.TypeVar("_V") |
||
5 | |||
6 | |||
7 | def nillable_write(dct: typing.Dict[_K, _V], key: _K, value: typing.Optional[_V]): |
||
8 | if value is None: |
||
9 | dct.pop(key, typing.cast(_V, None)) |
||
10 | else: |
||
11 | dct[key] = value |
||
12 |