This is an automated email from the ASF dual-hosted git repository.
tvalentyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 39652cf27a0 Address the warning in a DoFn from periodicsequence.py
(#37153)
39652cf27a0 is described below
commit 39652cf27a09852fd6fdb5ac6710704378cad30e
Author: tvalentyn <[email protected]>
AuthorDate: Mon Dec 22 05:20:03 2025 -0800
Address the warning in a DoFn from periodicsequence.py (#37153)
Change `return` to `break` to avoid the warning that a DoFn mixes 'return'
and 'yield' in the same method.
---
sdks/python/apache_beam/transforms/periodicsequence.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sdks/python/apache_beam/transforms/periodicsequence.py
b/sdks/python/apache_beam/transforms/periodicsequence.py
index 82b6fd0330c..e2bdc3c6c0f 100644
--- a/sdks/python/apache_beam/transforms/periodicsequence.py
+++ b/sdks/python/apache_beam/transforms/periodicsequence.py
@@ -169,11 +169,11 @@ class ImpulseSeqGenDoFn(beam.DoFn):
# we are too ahead of time, let's wait.
restriction_tracker.defer_remainder(
timestamp.Timestamp(current_output_timestamp))
- return
+ break
if not restriction_tracker.try_claim(current_output_index):
# nothing to claim, just stop
- return
+ break
output = self._get_output(current_output_index, current_output_timestamp)
@@ -186,6 +186,9 @@ class ImpulseSeqGenDoFn(beam.DoFn):
current_output_index += 1
+ # Don't yield any values here so that the generator
+ # raises StopIteration when we break out of the while loop.
+
class PeriodicSequence(PTransform):
'''