Parcourir la source

add __contains__

master
whut il y a 1 an
Parent
révision
8e1237f90c
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. +6
    -0
      src/confthing/__init__.py

+ 6
- 0
src/confthing/__init__.py Voir le fichier

@@ -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

Chargement…
Annuler
Enregistrer