diff options
author | Julian Berman <Julian@GrayVines.com> | 2013-05-20 22:47:47 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2013-05-20 22:47:47 -0400 |
commit | e48bc4ab34bd52ca41021ec48cd8b57dcd6af7a5 (patch) | |
tree | 47afcb1c25fb873418c3d7f572261fd840d354f9 /jsonschema | |
parent | b03996f0515212e5568c498db9d93767d241f000 (diff) | |
download | jsonschema-e48bc4ab34bd52ca41021ec48cd8b57dcd6af7a5.tar.gz |
Add some more docstrings to ErrorTree
Diffstat (limited to 'jsonschema')
-rw-r--r-- | jsonschema/validators.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/jsonschema/validators.py b/jsonschema/validators.py index 69f05ea..1cb6c2e 100644 --- a/jsonschema/validators.py +++ b/jsonschema/validators.py @@ -417,8 +417,13 @@ class ErrorTree(object): self._instance = error.instance - def __contains__(self, k): - return k in self._contents + def __contains__(self, index): + """ + Check whether ``instance[index]`` has any errors. + + """ + + return index in self._contents def __getitem__(self, k): """ @@ -439,9 +444,19 @@ class ErrorTree(object): self._contents[k] = v def __iter__(self): + """ + Iterate (non-recursively) over the indices in the instance with errors. + + """ + return iter(self._contents) def __len__(self): + """ + Same as :attr:`total_errors`. + + """ + return self.total_errors def __repr__(self): |