You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "liferoad (via GitHub)" <gi...@apache.org> on 2023/03/07 03:23:03 UTC

[GitHub] [beam] liferoad commented on a diff in pull request #25743: Raise the Runtime error when DoFn.process uses both yield and return

liferoad commented on code in PR #25743:
URL: https://github.com/apache/beam/pull/25743#discussion_r1127300944


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -1387,6 +1387,11 @@ def partition_for(self, element, num_partitions, *args, **kwargs):
     return self._fn(element, num_partitions, *args, **kwargs)
 
 
+def _check_fn_use_yield_and_return(fn):
+  source_code = inspect.getsource(fn)
+  return " yield " in source_code and " return " in source_code

Review Comment:
   only check the function source code to check yield and return, which should cover most of cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org