)
            logger.debug(".")
        results = self.get_results(operations=operations)
        yield from self.parse_from_results(results)
[docs]    def parse_from_results(
        self, results: List[DocAIParsingResults]
    ) -> Iterator[Document]:
        try:
            from google.cloud.documentai_toolbox.wrappers.document import _get_shards
            from google.cloud.documentai_toolbox.wrappers.page import _text_from_layout
        except ImportError:
            raise ImportError(
                "documentai_toolbox package not found, please install it with"
                " `pip install google-cloud-documentai-toolbox`"
            )
        for result in results:
            output_gcs = result.parsed_path.split("/")
            gcs_bucket_name = output_gcs[2]
            gcs_prefix = "/".join(output_gcs[3:]) + "/"
            shards = _get_shards(gcs_bucket_name, gcs_prefix)
            docs, page_number = [], 1
            for shard in shards:
                for page in shard.pages:
                    docs.append(
                        Document(
                            page_content=_text_from_layout(page.layout, shard.text),
                            metadata={
                                "page": page_number,
                                "source": result.source_path,
                            },
                        )
                    )
                    page_number += 1
            yield from docs
[docs]    def operations_from_names(self, operation_names: List[str]) -> List["Operation"]:
        """Initializes Long-Running Operations from their names."""
        try:
            from google.longrunning.operations_pb2 import (
                GetOperationRequest,  # type: ignore
            )
        except ImportError:
            raise ImportError(
                "documentai package not found, please install it with"
                " `pip install gapic-google-longrunning`"