Add DictDefault
Browse files
src/axolotl/utils/dict.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from addict import Dict
|
2 |
+
|
3 |
+
|
4 |
+
class DictDefault(Dict):
|
5 |
+
'''
|
6 |
+
A Dict that returns None instead of returning empty Dict for missing keys.
|
7 |
+
'''
|
8 |
+
def __missing__(self, key):
|
9 |
+
return None
|