mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 19:53:51 +01:00
Add __contains__
This commit is contained in:
parent
eaa836e8ca
commit
5b142788d2
1 changed files with 3 additions and 0 deletions
|
@ -13,6 +13,9 @@ class TreeCache(object):
|
|||
def __setitem__(self, key, value):
|
||||
return self.set(key, value)
|
||||
|
||||
def __contains__(self, key):
|
||||
return self.get(key, SENTINEL) is not SENTINEL
|
||||
|
||||
def set(self, key, value):
|
||||
node = self.root
|
||||
for k in key[:-1]:
|
||||
|
|
Loading…
Reference in a new issue