Conditions | 2 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """Function for treating Python dicts sort of like Lua tables.""" |
||
9 | def nillable_write( |
||
10 | dct: typing.Dict[_K, _V], key: _K, value: typing.Optional[_V] |
||
11 | ) -> None: |
||
12 | """Set to the value or delete the given key in the given dict.""" |
||
13 | if value is None: |
||
14 | dct.pop(key, typing.cast(_V, None)) |
||
15 | else: |
||
16 | dct[key] = value |
||
17 |