Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)
def _drop_nodes_from_errorpaths(self, _errors, dp_items, sp_items):
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)
dp_items: Iterable[int],
sp_items: Iterable[int],
) -> None:
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)
def _drop_nodes_from_errorpaths(self, _errors, dp_items, sp_items):
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to drop from
the :attr:`document_path`.
:param sp_items: Alike ``dp_items``, but for :attr:`schema_path`.
"""
dp_basedepth = len(self.document_path)
sp_basedepth = len(self.schema_path)
for error in _errors:
for i in sorted(dp_items, reverse=True):
error.document_path = drop_item_from_tuple(
error.document_path, dp_basedepth + i
)
for i in sorted(sp_items, reverse=True):
error.schema_path = drop_item_from_tuple(
error.schema_path, sp_basedepth + i
)
if error.child_errors:
self._drop_nodes_from_errorpaths(error.child_errors, dp_items, sp_items)