From dff3cca3a4a44f6c8e2aa7d2f475a7aca87d8bde Mon Sep 17 00:00:00 2001 From: Ihor Indyk Date: Fri, 20 Mar 2026 07:49:33 -0700 Subject: [PATCH] internal. PiperOrigin-RevId: 886786971 --- grain/_src/python/dataset/dataset.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/grain/_src/python/dataset/dataset.py b/grain/_src/python/dataset/dataset.py index e506508b1..e3a23346a 100644 --- a/grain/_src/python/dataset/dataset.py +++ b/grain/_src/python/dataset/dataset.py @@ -1708,6 +1708,12 @@ def __init__(self, parent: IterDataset[T], options: base.DatasetOptions): self.options = options def __iter__(self) -> DatasetIterator[T]: + """Returns an iterator for the dataset. + + Propagates the options through the pipeline ensuring there's a single merged + options object. Depending on the options, may apply iterator + transformations. + """ result = self._parent.__iter__() # The parent iterator options are merged from the entire subtree. Merge # them with the latest options and update the subtree options. @@ -1737,7 +1743,7 @@ class _OutputIterDataset(IterDataset[T]): """Dataset that is injected at the end of every pipeline.""" def __iter__(self) -> DatasetIterator[T]: - """Performs any injection that needs to happen at the end of the pipeline.""" + """Performs injections that need to happen at the end of the pipeline.""" # Loaded lazily due to a circular dependency (dataset <-> prefetch). # pylint: disable=g-import-not-at-top