Skip to content

Commit 39652cf

Browse files
authored
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.
1 parent cc8dc2f commit 39652cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sdks/python/apache_beam/transforms/periodicsequence.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ def process(
169169
# we are too ahead of time, let's wait.
170170
restriction_tracker.defer_remainder(
171171
timestamp.Timestamp(current_output_timestamp))
172-
return
172+
break
173173

174174
if not restriction_tracker.try_claim(current_output_index):
175175
# nothing to claim, just stop
176-
return
176+
break
177177

178178
output = self._get_output(current_output_index, current_output_timestamp)
179179

@@ -186,6 +186,9 @@ def process(
186186

187187
current_output_index += 1
188188

189+
# Don't yield any values here so that the generator
190+
# raises StopIteration when we break out of the while loop.
191+
189192

190193
class PeriodicSequence(PTransform):
191194
'''

0 commit comments

Comments
 (0)