def iter_archive(self, resource): """Returns iterator over files within archive. **Important Note**: caller should read files as they are yielded. Reading out of order is slow. Args: resource: path to archive or `tfds.download.Resource`. Returns: Generator yielding tuple (path_within_archive, file_obj). """ if isinstance(resource, six.string_types): resource = resource_lib.Resource(path=resource) return extractor.iter_archive(resource.path, resource.extract_method)
def iter_archive( self, resource: ExtractPath, ) -> Iterator[Tuple[str, typing.BinaryIO]]: """Returns iterator over files within archive. **Important Note**: caller should read files as they are yielded. Reading out of order is slow. Args: resource: path to archive or `tfds.download.Resource`. Returns: Generator yielding tuple (path_within_archive, file_obj). """ if isinstance(resource, type_utils.PathLikeCls): resource = resource_lib.Resource(path=resource) return extractor.iter_archive(resource.path, resource.extract_method)