Skip to content

Commit

Permalink
Document raised errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo committed Nov 24, 2024
1 parent a94ca1d commit 04a51a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/jsonyx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ def apply_patch(
:param allow: the JSON deviations from :mod:`jsonyx.allow`
:param use_decimal: use :class:`decimal.Decimal` instead of :class:`float`
:raises AssertionError: if an assertion fails
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if a query is invalid
:raises KeyError: if a key is not found
:raises TypeError: if a value has the wrong type
:raises ValueError: if a value is invalid
:return: the patched Python object
Expand Down Expand Up @@ -485,7 +487,9 @@ def run_select_query(
:param mapping: map every input node to a single output node
:param relative: query must start with ``"@"`` instead of ``"$"``
:param use_decimal: use :class:`decimal.Decimal` instead of :class:`float`
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if the select query is invalid
:raises KeyError: if a key is not found
:raises ValueError: if a value is invalid
:return: the selected list of nodes
Expand Down Expand Up @@ -524,7 +528,9 @@ def run_filter_query(
:param query: a JSON filter query
:param allow: the JSON deviations from :mod:`jsonyx.allow`
:param use_decimal: use :class:`decimal.Decimal` instead of :class:`float`
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if the filter query is invalid
:raises KeyError: if a key is not found
:return: the filtered list of nodes
>>> import jsonyx as json
Expand Down
6 changes: 6 additions & 0 deletions src/jsonyx/_manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,9 @@ def apply_patch(
:param obj: a Python object
:param patch: a JSON patch
:raises AssertionError: if an assertion fails
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if a query is invalid
:raises KeyError: if a key is not found
:raises TypeError: if a value has the wrong type
:raises ValueError: if a value is invalid
:return: the patched Python object
Expand Down Expand Up @@ -614,7 +616,9 @@ def run_select_query(
:param allow_slice: allow slice
:param mapping: map every input node to a single output node
:param relative: query must start with ``"@"`` instead of ``"$"``
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if the select query is invalid
:raises KeyError: if a key is not found
:raises ValueError: if a value is invalid
:return: the selected list of nodes
Expand Down Expand Up @@ -654,7 +658,9 @@ def run_filter_query(
:param nodes: a node or a list of nodes
:param query: a JSON filter query
:raises IndexError: if an index is out of range
:raises JSONSyntaxError: if the filter query is invalid
:raises KeyError: if a key is not found
:return: the filtered list of nodes
>>> import jsonyx as json
Expand Down

0 comments on commit 04a51a9

Please sign in to comment.