Browse Source

add __contains__

master
whut 1 year ago
parent
commit
8e1237f90c
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/confthing/__init__.py

+ 6
- 0
src/confthing/__init__.py View File

@@ -68,3 +68,9 @@ class Config:
def __setitem__(self, path, value):
self.set(path, value, self.clobber_subscript)

def __contains__(self, path):
try:
self.get(path, strict=True)
return True
except:
return False

Loading…
Cancel
Save