Skip to content

Commit fd27a41

Browse files
committed
Fight with sphinx.
1 parent c763ab9 commit fd27a41

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

docs/errors.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,6 @@ best_match and by_relevance
309309
The :func:`best_match` function is a simple but useful function for attempting
310310
to guess the most relevant error in a given bunch.
311311

312-
.. autofunction:: best_match
313-
314-
Try to find an error that appears to be the best match among given errors.
315-
316-
In general, errors that are higher up in the instance (i.e. for which
317-
:attr:`ValidationError.path` is shorter) are considered better matches,
318-
since they indicate "more" is wrong with the instance.
319-
320312
.. doctest::
321313

322314
>>> from jsonschema import Draft4Validator
@@ -329,6 +321,15 @@ to guess the most relevant error in a given bunch.
329321
>>> print(best_match(Draft4Validator(schema).iter_errors(11)).message)
330322
11 is not of type 'array'
331323

324+
325+
.. autofunction:: best_match
326+
327+
Try to find an error that appears to be the best match among given errors.
328+
329+
In general, errors that are higher up in the instance (i.e. for which
330+
:attr:`ValidationError.path` is shorter) are considered better matches,
331+
since they indicate "more" is wrong with the instance.
332+
332333
If the resulting match is either :validator:`oneOf` or :validator:`anyOf`,
333334
the *opposite* assumption is made -- i.e. the deepest error is picked,
334335
since these validators only need to match once, and any other errors may
@@ -358,6 +359,14 @@ to guess the most relevant error in a given bunch.
358359
:func:`sorted` or :func:`max` will cause more relevant errors to be
359360
considered greater than less relevant ones.
360361

362+
:argument set weak: a collection of validators to consider to be "weak". If
363+
there are two errors at the same level of the instance and one is in
364+
the set of weak validators, the other error will take priority. By
365+
default, :validator:`anyOf` and :validator:`oneOf` are considered weak
366+
validators and will be superceded by other same-level validation
367+
errors.
368+
:argument set strong a collection of validators to consider to be "strong".
369+
361370
.. doctest::
362371

363372
>>> schema = {
@@ -377,11 +386,3 @@ to guess the most relevant error in a given bunch.
377386
... for e in sorted(errors, key=exceptions.by_relevance())
378387
... ]
379388
['home', 'name']
380-
381-
:argument set weak: a collection of validators to consider to be "weak". If
382-
there are two errors at the same level of the instance and one is in
383-
the set of weak validators, the other error will take priority. By
384-
default, :validator:`anyOf` and :validator:`oneOf` are considered weak
385-
validators and will be superceded by other same-level validation
386-
errors.
387-
:argument set strong a collection of validators to consider to be "strong".

0 commit comments

Comments
 (0)