How to use the cerberus.utils.drop_item_from_tuple function in Cerberus

To help you get started, we’ve selected a few Cerberus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyeve / cerberus / cerberus / base.py View on Github external
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)
github pypa / pipenv / pipenv / vendor / cerberus / validator.py View on Github external
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)
github pyeve / cerberus / cerberus / validator.py View on Github external
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)
github pyeve / cerberus / cerberus / validator.py View on Github external
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)
github pyeve / cerberus / cerberus / base.py View on Github external
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)
github pypa / pipenv / pipenv / vendor / cerberus / validator.py View on Github external
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)