Support and-schemas in python

This commit is contained in:
Tony Garnock-Jones 2022-06-03 16:50:03 +02:00
parent 1a090ce5ff
commit 597e993c05
1 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,11 @@ class SchemaObject:
if k not in v: return None
if cls.parse(pp, v[k], args) is None: return None
return ()
raise ValueError('Bad schema')
if p.key == AND:
for pp in p[0]:
if cls.parse(pp, v, args) is None: return None
return ()
raise ValueError(f'Bad schema {p}')
def __preserve__(self):
raise NotImplementedError('Subclass responsibility')