Skip to content

Commit f934357

Browse files
committed
GH-11: Implement FuzzyMap behavior for the get method of dict
1 parent dcc6a4d commit f934357

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fuzzymap/fuzzymap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def closest_key(self, key):
2929
return matching
3030
return key
3131

32+
def get(self, key, default=None):
33+
"""Invokes the __getitem__ to keep the `FuzzyMap` behavior"""
34+
35+
return self[key] or default
36+
3237
def __missing__(self, key):
3338
return super().get(self.closest_key(key))
3439

0 commit comments

Comments
 (0)