0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 23:03:51 +01:00

Add __contains__

This commit is contained in:
David Baker 2016-01-22 11:49:59 +00:00
parent eaa836e8ca
commit 5b142788d2

View file

@ -13,6 +13,9 @@ class TreeCache(object):
def __setitem__(self, key, value): def __setitem__(self, key, value):
return self.set(key, value) return self.set(key, value)
def __contains__(self, key):
return self.get(key, SENTINEL) is not SENTINEL
def set(self, key, value): def set(self, key, value):
node = self.root node = self.root
for k in key[:-1]: for k in key[:-1]: